diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-08 06:47:52 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-08 17:29:38 -0800 |
commit | bef6c27a1b50519f23a5308547d65b55c8e98868 (patch) | |
tree | 60aa3a0c5d3e4e97d6f89df4a90f478c42fb1a12 /src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs | |
parent | e40337bd6706ffdfd31a43124b0fd1e095ba7844 (diff) | |
download | DotNetOpenAuth-bef6c27a1b50519f23a5308547d65b55c8e98868.zip DotNetOpenAuth-bef6c27a1b50519f23a5308547d65b55c8e98868.tar.gz DotNetOpenAuth-bef6c27a1b50519f23a5308547d65b55c8e98868.tar.bz2 |
Removed OAuth1's dependency on OpenID assemblies.
Related to #71
Diffstat (limited to 'src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs')
-rw-r--r-- | src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs index 1338d87..06c3dca 100644 --- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs +++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs @@ -19,10 +19,6 @@ namespace DotNetOpenAuth.OAuth { using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; - using DotNetOpenAuth.OpenId; - using DotNetOpenAuth.OpenId.Extensions.OAuth; - using DotNetOpenAuth.OpenId.Messages; - using DotNetOpenAuth.OpenId.Provider; /// <summary> /// A web application that allows access via OAuth. @@ -293,88 +289,6 @@ namespace DotNetOpenAuth.OAuth { } /// <summary> - /// Gets the OAuth authorization request included with an OpenID authentication - /// request, if there is one. - /// </summary> - /// <param name="openIdRequest">The OpenID authentication request.</param> - /// <returns> - /// The scope of access the relying party is requesting, or null if no OAuth request - /// is present. - /// </returns> - /// <remarks> - /// <para>Call this method rather than simply extracting the OAuth extension - /// out from the authentication request directly to ensure that the additional - /// security measures that are required are taken.</para> - /// </remarks> - public AuthorizationRequest ReadAuthorizationRequest(IHostProcessedRequest openIdRequest) { - Requires.NotNull(openIdRequest, "openIdRequest"); - Requires.ValidState(this.TokenManager is ICombinedOpenIdProviderTokenManager); - var openidTokenManager = this.TokenManager as ICombinedOpenIdProviderTokenManager; - ErrorUtilities.VerifyOperation(openidTokenManager != null, OAuthStrings.OpenIdOAuthExtensionRequiresSpecialTokenManagerInterface, typeof(IOpenIdOAuthTokenManager).FullName); - - var authzRequest = openIdRequest.GetExtension<AuthorizationRequest>(); - if (authzRequest == null) { - return null; - } - - // OpenID+OAuth spec section 9: - // The Combined Provider SHOULD verify that the consumer key passed in the - // request is authorized to be used for the realm passed in the request. - string expectedConsumerKey = openidTokenManager.GetConsumerKey(openIdRequest.Realm); - ErrorUtilities.VerifyProtocol( - string.Equals(expectedConsumerKey, authzRequest.Consumer, StringComparison.Ordinal), - OAuthStrings.OpenIdOAuthRealmConsumerKeyDoNotMatch); - - return authzRequest; - } - - /// <summary> - /// Attaches the authorization response to an OpenID authentication response. - /// </summary> - /// <param name="openIdAuthenticationRequest">The OpenID authentication request.</param> - /// <param name="consumerKey">The consumer key. Must be <c>null</c> if and only if <paramref name="scope"/> is null.</param> - /// <param name="scope">The approved access scope. Use <c>null</c> to indicate no access was granted. The empty string will be interpreted as some default level of access is granted.</param> - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "We want to take IAuthenticationRequest because that's the only supported use case.")] - [Obsolete("Call the overload that doesn't take a consumerKey instead.")] - public void AttachAuthorizationResponse(IHostProcessedRequest openIdAuthenticationRequest, string consumerKey, string scope) { - Requires.NotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest"); - Requires.True((consumerKey == null) == (scope == null), null); - Requires.ValidState(this.TokenManager is ICombinedOpenIdProviderTokenManager); - var openidTokenManager = (ICombinedOpenIdProviderTokenManager)this.TokenManager; - ErrorUtilities.VerifyArgument(consumerKey == null || consumerKey == openidTokenManager.GetConsumerKey(openIdAuthenticationRequest.Realm), OAuthStrings.OpenIdOAuthRealmConsumerKeyDoNotMatch); - - this.AttachAuthorizationResponse(openIdAuthenticationRequest, scope); - } - - /// <summary> - /// Attaches the authorization response to an OpenID authentication response. - /// </summary> - /// <param name="openIdAuthenticationRequest">The OpenID authentication request.</param> - /// <param name="scope">The approved access scope. Use <c>null</c> to indicate no access was granted. The empty string will be interpreted as some default level of access is granted.</param> - [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "We want to take IAuthenticationRequest because that's the only supported use case.")] - public void AttachAuthorizationResponse(IHostProcessedRequest openIdAuthenticationRequest, string scope) { - Requires.NotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest"); - Requires.ValidState(this.TokenManager is ICombinedOpenIdProviderTokenManager); - - var openidTokenManager = this.TokenManager as ICombinedOpenIdProviderTokenManager; - IOpenIdMessageExtension response; - if (scope != null) { - // Generate an authorized request token to return to the relying party. - string consumerKey = openidTokenManager.GetConsumerKey(openIdAuthenticationRequest.Realm); - var approvedResponse = new AuthorizationApprovedResponse { - RequestToken = this.TokenGenerator.GenerateRequestToken(consumerKey), - Scope = scope, - }; - openidTokenManager.StoreOpenIdAuthorizedRequestToken(consumerKey, approvedResponse); - response = approvedResponse; - } else { - response = new AuthorizationDeclinedResponse(); - } - - openIdAuthenticationRequest.AddResponseExtension(response); - } - - /// <summary> /// Prepares the message to send back to the consumer following proper authorization of /// a token by an interactive user at the Service Provider's web site. /// </summary> |