public void AttachAuthorizationResponse(IHostProcessedRequest openIdAuthenticationRequest, string scope) { Requires.NotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest"); RequiresEx.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); }
public void AttachAuthorizationResponse(IHostProcessedRequest openIdAuthenticationRequest, string scope) { Contract.Requires(openIdAuthenticationRequest != null); Contract.Requires(this.TokenManager is IOpenIdOAuthTokenManager); ErrorUtilities.VerifyArgumentNotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest"); var openidTokenManager = this.TokenManager as ICombinedOpenIdProviderTokenManager; ErrorUtilities.VerifyOperation(openidTokenManager != null, OAuthStrings.OpenIdOAuthExtensionRequiresSpecialTokenManagerInterface, typeof(ICombinedOpenIdProviderTokenManager).FullName); 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); }