diff options
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs index d5509aa..940ab85 100644 --- a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs +++ b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs @@ -1,20 +1,20 @@ -//----------------------------------------------------------------------- -// <copyright file="OAuthServiceProvider.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace RelyingPartyLogic { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Web; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OAuth2; - using DotNetOpenAuth.OAuth2.ChannelElements; - using DotNetOpenAuth.OAuth2.Messages; - - public class OAuthServiceProvider { +//-----------------------------------------------------------------------
+// <copyright file="OAuthServiceProvider.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace RelyingPartyLogic {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth2;
+ using DotNetOpenAuth.OAuth2.ChannelElements;
+ using DotNetOpenAuth.OAuth2.Messages;
+
+ public class OAuthServiceProvider {
private const string PendingAuthorizationRequestSessionKey = "PendingAuthorizationRequest";
/// <summary>
@@ -22,56 +22,56 @@ namespace RelyingPartyLogic { /// </summary>
private static readonly object InitializerLock = new object();
- /// <summary> - /// The shared service description for this web site. - /// </summary> - private static AuthorizationServerDescription authorizationServerDescription; - - /// <summary> - /// The shared authorization server. - /// </summary> - private static AuthorizationServer authorizationServer; - - /// <summary> - /// Gets the service provider. - /// </summary> - /// <value>The service provider.</value> - public static AuthorizationServer AuthorizationServer { - get { - EnsureInitialized(); - return authorizationServer; - } - } - - /// <summary> - /// Gets the service description. - /// </summary> - /// <value>The service description.</value> - public static AuthorizationServerDescription AuthorizationServerDescription { - get { - EnsureInitialized(); - return authorizationServerDescription; - } - } - - /// <summary> - /// Initializes the <see cref="authorizationServer"/> field if it has not yet been initialized. - /// </summary> - private static void EnsureInitialized() { - if (authorizationServer == null) { - lock (InitializerLock) { - if (authorizationServerDescription == null) { - authorizationServerDescription = new AuthorizationServerDescription { - AuthorizationEndpoint = new Uri(Utilities.ApplicationRoot, "OAuth.ashx"), - TokenEndpoint = new Uri(Utilities.ApplicationRoot, "OAuth.ashx"), - }; - } - - if (authorizationServer == null) { - authorizationServer = new AuthorizationServer(new OAuthAuthorizationServer()); - } - } - } - } - } -} + /// <summary>
+ /// The shared service description for this web site.
+ /// </summary>
+ private static AuthorizationServerDescription authorizationServerDescription;
+
+ /// <summary>
+ /// The shared authorization server.
+ /// </summary>
+ private static AuthorizationServer authorizationServer;
+
+ /// <summary>
+ /// Gets the service provider.
+ /// </summary>
+ /// <value>The service provider.</value>
+ public static AuthorizationServer AuthorizationServer {
+ get {
+ EnsureInitialized();
+ return authorizationServer;
+ }
+ }
+
+ /// <summary>
+ /// Gets the service description.
+ /// </summary>
+ /// <value>The service description.</value>
+ public static AuthorizationServerDescription AuthorizationServerDescription {
+ get {
+ EnsureInitialized();
+ return authorizationServerDescription;
+ }
+ }
+
+ /// <summary>
+ /// Initializes the <see cref="authorizationServer"/> field if it has not yet been initialized.
+ /// </summary>
+ private static void EnsureInitialized() {
+ if (authorizationServer == null) {
+ lock (InitializerLock) {
+ if (authorizationServerDescription == null) {
+ authorizationServerDescription = new AuthorizationServerDescription {
+ AuthorizationEndpoint = new Uri(Utilities.ApplicationRoot, "OAuth.ashx"),
+ TokenEndpoint = new Uri(Utilities.ApplicationRoot, "OAuth.ashx"),
+ };
+ }
+
+ if (authorizationServer == null) {
+ authorizationServer = new AuthorizationServer(new OAuthAuthorizationServer());
+ }
+ }
+ }
+ }
+ }
+}
|