1

DotnetOpenAuth サンプル (OpenIdProviderMvc の OpenId コントローラー) の次のサンプル コードを使用しています。

public ActionResult ProcessAuthRequest() {
        if (ProviderEndpoint.PendingRequest == null) {
            return this.RedirectToAction("Index", "Home");
        }

        // Try responding immediately if possible.
        ActionResult response;
        if (this.AutoRespondIfPossible(out response)) {
            return response;
        }

        // We can't respond immediately with a positive result.  But if we still have to respond immediately...
        if (ProviderEndpoint.PendingRequest.Immediate) {
            // We can't stop to prompt the user -- we must just return a negative response.
            return this.SendAssertion();
        }

        return this.RedirectToAction("AskUser");
    }

private bool AutoRespondIfPossible(out ActionResult response)
    {
        if (ProviderEndpoint.PendingRequest.IsReturnUrlDiscoverable(OpenIdProvider.Channel.WebRequestHandler) == RelyingPartyDiscoveryResult.Success
            && User.Identity.IsAuthenticated) {
                if (ProviderEndpoint.PendingAuthenticationRequest != null) {
                    if (ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity
                        || this.UserControlsIdentifier(ProviderEndpoint.PendingAuthenticationRequest)) {
                            ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated = true;
                            response = this.SendAssertion();
                            return true;
                    }
                }

                if (ProviderEndpoint.PendingAnonymousRequest != null) {
                    ProviderEndpoint.PendingAnonymousRequest.IsApproved = true;
                    response = this.SendAssertion();
                    return true;
                }
        }

        response = null;
        return false;
    }

ただし、ユーザーに何も尋ねたくありません。ユーザーがログインしている場合 (ログインしている場合)、RP に自動的に肯定的に応答する Web アプリケーション ポータルをセットアップしようとしています。それでもAutoRespondIfPossiblefalse を返します。なぜなら、ProviderEndpoint.PendingRequest.IsReturnUrlDiscoverablefalse を返しますが、その理由がわからないからです。ここで私はどのような行動をとるべきですか?

ログ:

RP: http://pastebin.com/0EX2ZE1C EP: http://pastebin.com/q5CPrWp6

以前の関連する質問:

SSO - OpenID エンドポイントが見つかりません

OpenIdProvider.GetRequest() は null を返します

OpenID レルムは Web サイトのベース URL である必要がありますか?

4

1 に答える 1

1

IsReturnUrlDiscoverableOpenID が「RP Discovery」と呼ぶものを実行します。とにかく重要ですが、特にユーザーを自動ログインさせる場合は、セキュリティにとって重要です. 返されているという事実falseは、これを正しく行うために RP に何らかの作業が必要であることを示しています。

このブログ投稿では、「RP Discovery」テストに合格するために RP が行う必要があることについて説明しています。

于 2012-10-25T14:36:02.173 に答える