/// <summary> /// Initializes the <see cref="serviceProvider"/> field if it has not yet been initialized. /// </summary> private static void EnsureInitialized() { if (serviceProvider == 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); serviceDescription = new ServiceProviderDescription { TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }, RequestTokenEndpoint = postEndpoint, AccessTokenEndpoint = postEndpoint, UserAuthorizationEndpoint = getEndpoint, }; } if (tokenManager == null) { tokenManager = new OAuthServiceProviderTokenManager(); } if (serviceProvider == null) { serviceProvider = new ServiceProvider(serviceDescription, tokenManager); } } } }
/// <summary> /// Initializes the <see cref="serviceProvider"/> field if it has not yet been initialized. /// </summary> private static void EnsureInitialized() { if (serviceProvider == 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); serviceDescription = new ServiceProviderDescription { TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }, RequestTokenEndpoint = postEndpoint, AccessTokenEndpoint = postEndpoint, UserAuthorizationEndpoint = getEndpoint, }; } if (tokenManager == null) { tokenManager = new OAuthServiceProviderTokenManager(); } if (serviceProvider == null) { serviceProvider = new ServiceProvider(serviceDescription, tokenManager); } } } }