diff options
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); } } |