Skip to content

Commit

Permalink
fixed user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
phillip-haydon committed Jan 8, 2014
1 parent 1cd8899 commit b0aee54
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Code/Shared Assembly Info/SharedAssemblyInfo.cs
Expand Up @@ -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")]
[assembly: AssemblyVersion("0.3.11.0")]
[assembly: AssemblyFileVersion("0.3.11.0")]
43 changes: 22 additions & 21 deletions Code/SimpleAuthentication.Core/Providers/FacebookProvider.cs
Expand Up @@ -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<AccessTokenResult>(restRequest);
}
Expand Down
21 changes: 12 additions & 9 deletions Code/SimpleAuthentication.Core/RestClientFactory.cs
Expand Up @@ -21,14 +21,14 @@ public RestClientFactory(IRestClient restClient)
}

_restClientDictionary = new Dictionary<string, IRestClient>
{
{
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<IRestClient> restClients)
Expand Down Expand Up @@ -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"
};
}
}
}
8 changes: 8 additions & 0 deletions 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%
Expand All @@ -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%
1 change: 1 addition & 0 deletions SimpleAuthentication.sln.DotSettings
Expand Up @@ -13,6 +13,7 @@

<s:String x:Key="/Default/Environment/Hierarchy/PsiConfiguration/LocationType/@EntryValue">TEMP_FOLDER</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/PsiConfigurationSettingsKey/LocationType/@EntryValue">TEMP_FOLDER</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/TextControl/HighlightCurrentLine/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=Jasmine/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=MSTest/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit b0aee54

Please sign in to comment.