簡體   English   中英

IsReturnUrlDiscoverable有什么作用?

[英]What does IsReturnUrlDiscoverable do?

我正在使用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;
    }

但是,我不想問任何問題。 我正在嘗試建立一個Web應用程序門戶,如果用戶登錄(他是登錄用戶),該門戶應自動對RP做出積極響應。 但是AutoRespondIfPossible返回false,因為ProviderEndpoint.PendingRequest.IsReturnUrlDiscoverable返回false,但我不確定為什么。 我應該在這里采取什么行動?

日志:

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

先前的相關問題:

SSO-找不到OpenID端點

OpenIdProvider.GetRequest()返回null

OpenID領域是否必須是網站的基本URL?

IsReturnUrlDiscoverable執行OpenID所謂的“ RP發現”。 無論如何,這都很重要,但是特別是如果您將自動登錄用戶時,這對於安全性至關重要。 它返回false的事實告訴您RP需要一些工作才能正確執行此操作。

這篇博客文章解釋了RP必須執行哪些操作才能通過“ RP Discovery”測試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM