From b0aee54c7b495a4451091d3eec327a87fb0e64a5 Mon Sep 17 00:00:00 2001 From: Phillip Haydon Date: Thu, 9 Jan 2014 01:01:52 +0800 Subject: [PATCH] fixed user agent --- .../SharedAssemblyInfo.cs | 4 +- .../Providers/FacebookProvider.cs | 43 ++++++++++--------- .../RestClientFactory.cs | 21 +++++---- .../package-nugets.bat | 8 ++++ SimpleAuthentication.sln.DotSettings | 1 + 5 files changed, 45 insertions(+), 32 deletions(-) diff --git a/Code/Shared Assembly Info/SharedAssemblyInfo.cs b/Code/Shared Assembly Info/SharedAssemblyInfo.cs index 9cc267a0..b44307cf 100644 --- a/Code/Shared Assembly Info/SharedAssemblyInfo.cs +++ b/Code/Shared Assembly Info/SharedAssemblyInfo.cs @@ -28,5 +28,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.10.0")] -[assembly: AssemblyFileVersion("0.3.10.0")] \ No newline at end of file +[assembly: AssemblyVersion("0.3.11.0")] +[assembly: AssemblyFileVersion("0.3.11.0")] \ No newline at end of file diff --git a/Code/SimpleAuthentication.Core/Providers/FacebookProvider.cs b/Code/SimpleAuthentication.Core/Providers/FacebookProvider.cs index 3057ccac..625c6dbe 100644 --- a/Code/SimpleAuthentication.Core/Providers/FacebookProvider.cs +++ b/Code/SimpleAuthentication.Core/Providers/FacebookProvider.cs @@ -128,27 +128,28 @@ protected override string RetrieveAuthorizationCode(NameValueCollection queryStr // We'll manually create the data - if possible. // How - we will try and recreate the content result. restRequest.OnBeforeDeserialization = response => - { - // Grab the content and convert it into json. - if (response.StatusCode != HttpStatusCode.OK) - { - // Something is wrong - so just leave. This is handled elsewhere. - return; - } - - // Lets do this! - var querystringData = - HttpUtility.ParseQueryString(response.Content); - var json = new StringBuilder("{"); // Start. - foreach (var key in querystringData.AllKeys) - { - json.AppendFormat("\"{0}\":\"{1}\"", - key, querystringData[key]); - } - json.Append("}"); // End. - response.Content = json.ToString(); - response.ContentType = "text/json"; - }; + { + // Grab the content and convert it into json. + if (response.StatusCode != HttpStatusCode.OK) + { + // Something is wrong - so just leave. This is handled elsewhere. + return; + } + + // Lets do this! + var querystringData = HttpUtility.ParseQueryString(response.Content); + var json = new StringBuilder("{"); // Start. + + foreach (var key in querystringData.AllKeys) + { + json.AppendFormat("\"{0}\":\"{1}\"", key, querystringData[key]); + } + + json.Append("}"); // End. + + response.Content = json.ToString(); + response.ContentType = "text/json"; + }; return restClient.Execute(restRequest); } diff --git a/Code/SimpleAuthentication.Core/RestClientFactory.cs b/Code/SimpleAuthentication.Core/RestClientFactory.cs index c5eb9e67..dc8b64af 100644 --- a/Code/SimpleAuthentication.Core/RestClientFactory.cs +++ b/Code/SimpleAuthentication.Core/RestClientFactory.cs @@ -21,14 +21,14 @@ public RestClientFactory(IRestClient restClient) } _restClientDictionary = new Dictionary - { - { - string.IsNullOrEmpty(restClient.BaseUrl) - ? Guid.NewGuid().ToString() - : restClient.BaseUrl.ToLowerInvariant(), - restClient - } - }; + { + { + string.IsNullOrEmpty(restClient.BaseUrl) + ? Guid.NewGuid().ToString() + : restClient.BaseUrl.ToLowerInvariant(), + restClient + } + }; } public RestClientFactory(ICollection restClients) @@ -67,7 +67,10 @@ public IRestClient CreateRestClient(string baseUrl) ? _restClientDictionary[baseUrl] : _restClientDictionary.First().Value; } - return existingRestClient ?? new RestClient(baseUrl); + return existingRestClient ?? new RestClient(baseUrl) + { + UserAgent = "SimpleAuthentication" + }; } } } \ No newline at end of file diff --git a/NuGet Package Specifications/package-nugets.bat b/NuGet Package Specifications/package-nugets.bat index a70fdc40..2e06fe7a 100644 --- a/NuGet Package Specifications/package-nugets.bat +++ b/NuGet Package Specifications/package-nugets.bat @@ -1,5 +1,6 @@ @echo off set version=%1 +set key=%2 shift nuget.exe pack Glimpse.SimpleAuthentication.nuspec -Version %version% @@ -8,3 +9,10 @@ nuget.exe pack SimpleAuthentication.Core.nuspec -Version %version% nuget.exe pack SimpleAuthentication.ExtraProviders.nuspec -Version %version% nuget.exe pack SimpleAuthentication.Mvc-3.nuspec -Version %version% nuget.exe pack SimpleAuthentication.Mvc-4.nuspec -Version %version% + +nuget.exe push Glimpse.SimpleAuthentication.%version%.nupkg %key% +nuget.exe push Nancy.SimpleAuthentication.%version%.nupkg %key% +nuget.exe push SimpleAuthentication.Core.%version%.nupkg %key% +nuget.exe push SimpleAuthentication.ExtraProviders.%version%.nupkg %key% +nuget.exe push SimpleAuthentication.Mvc3.%version%.nupkg %key% +nuget.exe push SimpleAuthentication.Mvc4.%version%.nupkg %key% diff --git a/SimpleAuthentication.sln.DotSettings b/SimpleAuthentication.sln.DotSettings index d75c8f8e..2a78c889 100644 --- a/SimpleAuthentication.sln.DotSettings +++ b/SimpleAuthentication.sln.DotSettings @@ -13,6 +13,7 @@ TEMP_FOLDER TEMP_FOLDER + True True True True