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

标签 spring openid spring-security yahoo

我正在使用 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 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)**

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

提前致谢,

最佳答案

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

我们必须使用电子邮件属性名称而不是 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"/>

Read more

关于spring - OpenId 属性交换对 yahoo 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7243644/

相关文章:

azure - 如何代表流将 cookie 与 Azure AD 结合使用来获取其他资源的访问 token

Spring Security + JPA 用户架构

java - Spring Security 在 IE 中的行为确实很奇怪

java - 停止 Ajax 请求以及 Spring 中 Controller 上启动的进程

java - 如何在我的 context.xml 中配置 hibernate.dialect

authentication - 链接 OpenID token

c# - IDX10501 : Signature validation failed. 无法匹配 key

spring - 在 spring boot 中将控制从一个 Controller 重定向到另一个 Controller

java -/api-url 在 Spring Boot Security 中有一个空的过滤器列表

java - Spring @Cacheable 分页方法