sreg Yahoo problems

我怕爱的太早我们不能终老 提交于 2019-12-11 16:31:41

问题


May you please look at the issue:

You may test Yahoo sreg at "https://test-id.org/OP/Sreg.aspx"

ID : "https://me.yahoo.com/" username: goughev@yahoo.com password: paranoid

Now the problem

This code work with Google but not with Yahoo sreg, becase response.GetUntrustedExtension() alwase returns null values for properties for Yahoo

        var opUrl = LoginCore.GetProviderUrl(provider, openId);
        var openIdRelyingParty = new OpenIdRelyingParty(null);
        var response = openIdRelyingParty.GetResponse();
        Identifier id;

        if (response == null)
        {
            if (Identifier.TryParse(opUrl, out id))
            {
                try
                {
                    var claim = new ClaimsRequest();
                    claim.Email = DemandLevel.Require;
                    claim.FullName = DemandLevel.Request;
                    claim.Gender = DemandLevel.Request;
                    claim.Nickname = DemandLevel.Require;
                    var request = openIdRelyingParty.CreateRequest(opUrl);

                    request.AddExtension(claim);
                    return request.RedirectingResponse.AsActionResult();
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                Model.Errors.Add(GeneralErrors.Unexpected());
                return View("SignupUnTrustedOpenId");
            }
        }
        else
        {
            switch (response.Status)
            {
                case AuthenticationStatus.Authenticated:
                   var claimsData = response.GetUntrustedExtension<ClaimsResponse>();
                    if (claimsData != null)
                    {
                        email = claimsData.Email;

I am using folowing configuration:

<dotNetOpenAuth>
    <openid>
        <relyingParty>
            <security requireSsl="false" ignoreUnsignedExtensions="false" maximumHashBitLength="256" minimumHashBitLength="160" rejectDelegatingIdentifiers="true" rejectUnsolicitedAssertions="false" requireAssociation="false" requireDirectedIdentity="false" />
            <behaviors>
                <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
            </behaviors>
        </relyingParty>
    </openid>
    <messaging>
        <untrustedWebRequest>
            <whitelistHosts>
                <add name="localhost" />
            </whitelistHosts>
        </untrustedWebRequest>
    </messaging>
</dotNetOpenAuth>

I am using the latiest version 3.2.0.9177

Thank you very much for help

Vitaly


回答1:


Yahoo's SREG extension support is currently only in beta. Yahoo is only willing to expose SREG support to whitelisted RPs. See here.

I went through the test-id.org test with my own Yahoo account and it worked. Your code to adding the sreg extension looks fine. So I suspect the only problem is that you're not on Yahoo's whitelist yet.



来源:https://stackoverflow.com/questions/1311607/sreg-yahoo-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!