diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-11 07:59:00 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-11 07:59:00 -0800 |
commit | 1df77ecb4d90bd74dddab2a700180be40a9e6071 (patch) | |
tree | 87018339c6aa84a6a59671368e273f88318a77f2 /projecttemplates/WebFormsRelyingParty/Code | |
parent | 5e21bc06b16e6c4bed2a9c29294b1203bd92bd3c (diff) | |
download | DotNetOpenAuth-1df77ecb4d90bd74dddab2a700180be40a9e6071.zip DotNetOpenAuth-1df77ecb4d90bd74dddab2a700180be40a9e6071.tar.gz DotNetOpenAuth-1df77ecb4d90bd74dddab2a700180be40a9e6071.tar.bz2 |
Bug fixes and updated db creation script with new OAuth tables.
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty/Code')
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/Code/OAuthServiceProvider.cs | 9 | ||||
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/Code/Utilities.cs | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Code/OAuthServiceProvider.cs b/projecttemplates/WebFormsRelyingParty/Code/OAuthServiceProvider.cs index 473b6d2..2c7126f 100644 --- a/projecttemplates/WebFormsRelyingParty/Code/OAuthServiceProvider.cs +++ b/projecttemplates/WebFormsRelyingParty/Code/OAuthServiceProvider.cs @@ -94,12 +94,13 @@ namespace WebFormsRelyingParty.Code { if (serviceProvider == null) { lock (initializerLock) { if (serviceDescription == null) { - var endpoint = new MessageReceivingEndpoint(Utilities.ApplicationRoot + "OAuth.ashx", HttpDeliveryMethods.PostRequest); + var postEndpoint = new MessageReceivingEndpoint(new Uri(Utilities.ApplicationRoot, "OAuth.ashx"), HttpDeliveryMethods.PostRequest); + var getEndpoint = new MessageReceivingEndpoint(postEndpoint.Location, HttpDeliveryMethods.GetRequest); serviceDescription = new ServiceProviderDescription { TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }, - RequestTokenEndpoint = endpoint, - AccessTokenEndpoint = endpoint, - UserAuthorizationEndpoint = endpoint, + RequestTokenEndpoint = postEndpoint, + AccessTokenEndpoint = postEndpoint, + UserAuthorizationEndpoint = getEndpoint, }; } diff --git a/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs b/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs index 5bf803d..a211cad 100644 --- a/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs +++ b/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs @@ -15,14 +15,17 @@ namespace WebFormsRelyingParty.Code { private const string csrfCookieName = "CsrfCookie"; private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider(); - public static string ApplicationRoot { + /// <summary> + /// Gets the full URI of the web application root. Guaranteed to end in a slash. + /// </summary> + public static Uri ApplicationRoot { get { string appRoot = HttpContext.Current.Request.ApplicationPath; if (!appRoot.EndsWith("/", StringComparison.Ordinal)) { appRoot += "/"; } - return appRoot; + return new Uri(HttpContext.Current.Request.Url, appRoot); } } |