编程语言
首页 > 编程语言> > php-LightOpenID validate()在Google Apps上失败

php-LightOpenID validate()在Google Apps上失败

作者:互联网

我正在使用LightOpenID来针对Google Apps验证OpenID.我发出了初始的authURL()请求,一切都很好.我调用validate(),但失败了.通过大量回显,我已将其追溯到validate()的最后几行.

在validate()中,传递给discover($url)的URL是https://www.google.com/accounts/o8/user-xrds?uri=http://my-domain.com/openid?id=117665028262121597341

discover()首先检查xrds位置(不存在). discover()接下来检查content-type是否为xrds xml,这是正确的. discover()检查Service(.*)/ Service,这是正确的.这是Service的片段,/ Service

<Service priority="0">
<Type>http://specs.openid.net/auth/2.0/signon</Type> 

<Type>http://openid.net/srv/ax/1.0</Type>
<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>
<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>
<Type>http://specs.openid.net/extensions/pape/1.0</Type>
<URI>https://www.google.com/a/<my domain>.com/o8/ud?be=o8</URI>
</Service>

discover()发现我们正在使用OpenID 2,并将URI字段提取到$server变量中. discover()继续提取CanonicalID,发现Google支持AX而不支持SREG.最后,discover()将$server返回为https://www.google.com/a/my-domain.com/o8/ud?be=o8

validate()继续根据是否使用magic_quotes清理data []中的每个字段.它将openid.mode设置为“ check_authentication”,请求discover($url)和preg的“ / is_valid:true”返回的$server.这是最后一个preg_match失败. $server网址不返回验证,而是说:“您请求的页面无效.”

我正在寻找的答案是Google Apps验证的正确网址.网址应该是什么样,我将仔细研究Google Apps返回的信息,看看是否有类似的内容.

添加:不确定是否重要,但是我确实有一个/.well-known/host-meta文件.这里是内容:
链接:< https://www.google.com/accounts/o8/site-xrds?hd = my-domain.com&gt ;; rel =“由http://reltype.google.com/openid/xrd-op描述”; type =“ application / xrds xml” 让我知道是否需要更多代码或数据. 谢谢,
埃里克·B.

解决方法:

确保您的服务器上已安装PHP curl extension.最近,我们在生产中遇到了完全相同的症状,这与服务器配置的问题有关.

如果您在Debian上运行应用程序,只需使用:

apt-get install php5-curl

标签:php,openid,google-apps,lightopenid
来源: https://codeday.me/bug/20191010/1886796.html