summaryrefslogtreecommitdiffstats
path: root/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs')
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs52
1 files changed, 46 insertions, 6 deletions
diff --git a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
index 807da2d..357464a 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
@@ -107,17 +107,23 @@ namespace RelyingPartyLogic {
/// Initializes the <see cref="serviceProvider"/> field if it has not yet been initialized.
/// </summary>
private static void EnsureInitialized() {
- if (serviceProvider == null) {
+ if (serviceProvider == null || serviceDescription == null) {
lock (initializerLock) {
if (serviceDescription == null) {
- var postEndpoint = new MessageReceivingEndpoint(new Uri(Utilities.ApplicationRoot, "OAuth.ashx"), HttpDeliveryMethods.PostRequest);
- var getEndpoint = new MessageReceivingEndpoint(postEndpoint.Location, HttpDeliveryMethods.GetRequest);
+ //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 = postEndpoint,
- AccessTokenEndpoint = postEndpoint,
- UserAuthorizationEndpoint = getEndpoint,
+ RequestTokenEndpoint = _requestTokenEndpoint,
+ AccessTokenEndpoint = _accessTokenEndpoint,
+ UserAuthorizationEndpoint = _userAuthorizationEndpoint,
};
+
+ if (tokenManager == null) {
+ tokenManager = new OAuthServiceProviderTokenManager();
+ }
+ serviceProvider = new ServiceProvider(serviceDescription, tokenManager);
}
if (tokenManager == null) {
@@ -130,5 +136,39 @@ namespace RelyingPartyLogic {
}
}
}
+
+ private static MessageReceivingEndpoint _requestTokenEndpoint;
+ private static MessageReceivingEndpoint _accessTokenEndpoint;
+ private static MessageReceivingEndpoint _userAuthorizationEndpoint;
+
+ public static MessageReceivingEndpoint RequestTokenEndpoint {
+ get {
+ return _requestTokenEndpoint;
+ }
+ set {
+ _requestTokenEndpoint = value;
+ serviceDescription = null;
+ }
+ }
+
+ public static MessageReceivingEndpoint AccessTokenEndpoint {
+ get {
+ return _accessTokenEndpoint;
+ }
+ set {
+ _accessTokenEndpoint = value;
+ serviceDescription = null;
+ }
+ }
+
+ public static MessageReceivingEndpoint UserAuthorizationEndpoint {
+ get {
+ return _userAuthorizationEndpoint;
+ }
+ set {
+ _userAuthorizationEndpoint = value;
+ serviceDescription = null;
+ }
+ }
}
}