summaryrefslogtreecommitdiffstats
path: root/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-04-29 06:40:59 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-04-29 06:40:59 -0700
commit6d234b8df2a2eee625b1f52f458c2e28706343ca (patch)
tree4097f4233d6d2b93df036a185c6e7740c9c613ef /projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
parentdc5c6421e4fbc243ed3c6e2485cc1b2974ca76ec (diff)
downloadDotNetOpenAuth-origin/dimebrain.zip
DotNetOpenAuth-origin/dimebrain.tar.gz
DotNetOpenAuth-origin/dimebrain.tar.bz2
An adaptation of @dimebrain's more MVC-ish way of doing OAuth SP.origin/dimebrain
We probably have a bit more work to do in this area before merging back.
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;
+ }
+ }
}
}