繁体   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