OpenID和Google托管域名

时间:2010-04-30 10:38:45

标签: openid

我收到“无法解析远程名称:'mine.com'”

使用此开放ID标识符时: https://www.google.com/accounts/o8/site-xrds?hd=mine.com

确实,mine.com DNS记录不存在。但我想知道为什么它首先会在那里看。我想要做的就是检查用户是否可以登录我们的托管域。这真的很难吗?

1 个答案:

答案 0 :(得分:2)

我正在使用DotNetOpenAuth,这就是我所缺少的......

relyingParty.DiscoveryServices.Insert(0, new DotNetOpenAuth.OpenId.HostMetaDiscoveryService { UseGoogleHostedHostMeta = true, });

首先放置HostMetaDiscoveryService并允许UseGoogleHostedHostMeta,请求将按预期工作。

结束这样的事情:

var relyingParty = new OpenIdRelyingParty();
relyingParty.DiscoveryServices.Insert(0, new DotNetOpenAuth.OpenId.HostMetaDiscoveryService { UseGoogleHostedHostMeta = true, });
var response = relyingParty.GetResponse();
if (response == null)
{
    var googleID = "https://www.google.com/accounts/o8/site-xrds?hd=my.domain";
    var request = relyingParty.CreateRequest(googleID);
    request.RedirectToProvider();
}
else
{
    switch (response.Status)
    {
        case AuthenticationStatus.Authenticated:
            break;

        default:
            break;
    }
}