OpenId 属性交换对 yahoo 不起作用?

发布于 2024-12-02 11:43:06 字数 1394 浏览 1 评论 0原文

我正在使用 Spring Security 3.0.5 为我的网站提供 openid 支持。我在 Spring-Security.xml 中编写了以下代码

<security:attribute-exchange>
                <security:openid-attribute name="axContactEmail" type="http://axschema.org/contact/email" required="true"/>
                <security:openid-attribute name="oiContactEmail" type="http://schema.openid.net/contact/email" required="true"/>
                <security:openid-attribute name="axNamePersonFullname" type="http://axschema.org/namePerson" required="true"/>
                <security:openid-attribute name="axNamePersonFriendlyName" type="http://axschema.org/namePerson/friendly" required="true"/>
                <security:openid-attribute name="axNamePersonFirstName" type="http://axschema.org/namePerson/first" required="true"/>
                <security:openid-attribute name="axNamePersonLastName" type="http://axschema.org/namePerson/last" required="true"/>
            </security:attribute-exchange>

,然后使用 OpenIDAuthenticationToken 访问属性...出于调试目的,我已在控制台上打印了该值...我已打印了参数...我在尝试 Yahoo 登录 时得到以下输出...

Email Address  : null
Full name  : null null
Prefered login  : null.null
Identifier here  : https://me.yahoo.com/a/L73gX9Yjkt2SKmqcgkzrbF7gGjRP **(correct!!! I have checked it)**

相同的代码适用于 gmail,并且我得到了我要求的所有属性...

提前致谢,

I am using Spring Security 3.0.5 for providing openid support to my web site. I have written following code in my Spring-Security.xml

<security:attribute-exchange>
                <security:openid-attribute name="axContactEmail" type="http://axschema.org/contact/email" required="true"/>
                <security:openid-attribute name="oiContactEmail" type="http://schema.openid.net/contact/email" required="true"/>
                <security:openid-attribute name="axNamePersonFullname" type="http://axschema.org/namePerson" required="true"/>
                <security:openid-attribute name="axNamePersonFriendlyName" type="http://axschema.org/namePerson/friendly" required="true"/>
                <security:openid-attribute name="axNamePersonFirstName" type="http://axschema.org/namePerson/first" required="true"/>
                <security:openid-attribute name="axNamePersonLastName" type="http://axschema.org/namePerson/last" required="true"/>
            </security:attribute-exchange>

Than I acces the attributes using OpenIDAuthenticationToken... For debugging purpose I have printed the value on console... I have printed the parameters... I get following output while trying for Yahoo login...

Email Address  : null
Full name  : null null
Prefered login  : null.null
Identifier here  : https://me.yahoo.com/a/L73gX9Yjkt2SKmqcgkzrbF7gGjRP **(correct!!! I have checked it)**

the same code works fine for gmail and I get all the attributes I asked...

Thanks in advance,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

携余温的黄昏 2024-12-09 11:43:06

这个问题很老了,但希望对其他人有帮助。

我们必须使用电子邮件属性名称而不是 axContactEmail 或 oiContactEmail

我的配置适用于 Google 和 Yahoo! :

<security:attribute-exchange>
<security:openid-attribute name="email" type="http://schema.openid.net/contact/email" required="true"/>
<security:openid-attribute name="forename" type="http://schema.openid.net/namePerson/first" required="true"/>
<security:openid-attribute name="surname" type="http://schema.openid.net/namePerson/last" required="true"/>
<security:openid-attribute name="name" type="http://schema.openid.net/namePerson/friendly" required="true"/>
<!--Yahoo-->
<security:openid-attribute name="fullname" type="http://axschema.org/namePerson" required="true"/>
<security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true"/>

了解更多

This question is old, but hope to help others.

We must use email attribute name instead axContactEmail or oiContactEmail

My config works with both Google and Yahoo! :

<security:attribute-exchange>
<security:openid-attribute name="email" type="http://schema.openid.net/contact/email" required="true"/>
<security:openid-attribute name="forename" type="http://schema.openid.net/namePerson/first" required="true"/>
<security:openid-attribute name="surname" type="http://schema.openid.net/namePerson/last" required="true"/>
<security:openid-attribute name="name" type="http://schema.openid.net/namePerson/friendly" required="true"/>
<!--Yahoo-->
<security:openid-attribute name="fullname" type="http://axschema.org/namePerson" required="true"/>
<security:openid-attribute name="email" type="http://axschema.org/contact/email" required="true"/>

Read more

小糖芽 2024-12-09 11:43:06

这个问题可能重复。 AX 属性不保证任何 OpenID 提供商都支持,并且不同 OpenID 提供商之间肯定存在很大差异。对于这些特定的示例,Yahoo 在响应 AX 请求时肯定会返回很少的信息,而 Google 返回的信息会稍微多一些。 (大约一年前,当我为我的书做研究时,MyOpenID 拥有主要 OpenID 提供商中最完整的 AX 支持)。

您可能应该查看一些属性交换规范以及有关 OpenID 的其他架构信息(如果您正在计划一些重大实施计划)。

Possible duplicate of this SO question. AX attributes are not guaranteed to be supported by any OpenID provider, and definitely do vary widely from OpenID provider to provider. With these particular examples, Yahoo definitely returns very little information in response to AX requests, and Google returns slightly more. (At the time I was doing the research for my book a year or so ago, MyOpenID had the most complete AX support of the major OpenID providers).

You should probably review some of the specs on attribute exchange and other architectural information about OpenID if you are planning some major implementation initiative.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文