【发布时间】:2011-03-12 16:43:34
【问题描述】:
我正在尝试实施混合 Google OpenID + OAuth 协议,以识别我的用户并访问他们的 Google 日历数据。
示例请求如下所示:
https://www.google.com/accounts/o8/id
?openid.ns=http://specs.openid.net/auth/2.0
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://www.example.com/checkauth
&openid.realm=http://www.example.com
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0
&openid.oauth.consumer=www.example.com
&openid.oauth.scope=http://docs.google.com/feeds/+http://spreadsheets.google.com/feeds/
我正在使用 openid4java。我试着关注这个帖子:library-to-integrate-googles-oauth-openid-hybrid-in-java-web-app
但是当我在 localhost 上测试我的应用程序时遇到了麻烦。
正如您在上述示例请求中看到的,三个属性必须相等:
openid.realm
openid.oauth.consumer
openid.return_to
我在谷歌注册了一些域名并获得了消费者密钥和秘密。但是当我想在本地主机上开发和调试我的应用程序时(即 openid.return_to=http://localhost:8080/ 和 openid.realm=http://*.mydomain.com 和 openid.oauth.consumer=www.mydomain.com)并提供我的密钥和秘密,openid4java RealmVerifier 拒绝了这样的身份验证请求。
我什至尝试提供完全有效的选项(我的注册域而不是本地主机) - 它似乎起作用,但重定向消失了(我不想/不能在该域中部署应用程序,因为缺少技术。)。
您能否建议,如何在本地主机上开发这样的应用程序?有什么技巧可以测试这样的应用程序吗?
感谢您的帮助!
【问题讨论】: