【问题标题】:Migrating from Google OpenID 2.0 to OpenID Connect with different redirect_uri and openid.realm parameters使用不同的 redirect_uri 和 openid.realm 参数从 Google OpenID 2.0 迁移到 OpenID Connect
【发布时间】:2014-10-21 19:54:03
【问题描述】:

我正在从 Google OpenID 2.0 迁移到 OpenID Connect。我目前正在使用Microsofts ACS,它使用谷歌贬值的 OpenID 2.0 进行身份验证。这意味着我的领域被自动设置为“https://mywebsite.accesscontrol.windows.net:443/v2/openid”。

ACS 没有升级计划,因此我已开始直接与 Google OpenID Connect 集成。我正在关注Googles migration documentation,它说我可以添加一个openid.realm 参数(设置为用于OpenID 2.0 的领域),然后获取映射现有用户帐户所需的openid_id。它还说redirect_uri 需要与openid.realm 相同。我猜是出于安全原因。

所以我的问题是我无法将重定向 uri 设置为与领域相同,因为领域是 ACS 端点,例如

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=id.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fmywebsite.com%3A2018%2F&scope=openid%20profile%20email&state=state&openid.realm=https%3A%2F%2Fmywebsite.accesscontrol.windows.net%3A443%2Fv2%2Fopenid

我尝试将它们设置不同,但出现错误

'领域不匹配redirect_uri/origin。错误代码:5'

Google 是否计划支持此类案例?

关于如何解决这个问题的任何想法?

【问题讨论】:

    标签: oauth-2.0 google-oauth acs google-openid openid-connect


    【解决方案1】:

    老问题,但如果它仍然很重要,我认为Google docs 实际上会说:

    “找到您的应用程序的redirect_uri 并更改它(如有必要),使其与您的OpenID 2.0 openid.realm 值匹配,根据section 9.2 of the OpenID 2.0 spec 中的匹配规则

    这归结为域匹配和redirect_uriopenid.realm 中路径的子路径,如果有的话。

    由于您的openid.realm 包含一条路径,我认为您有点搞砸了,您将不得不在您的服务器中设置某种重定向来将旧的redirect_url 映射到您的新路径。幸运的是,就我而言,我可以将redirect_url 设置为任何新路径,因为我的openid.realm 只有一个域名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-28
      • 1970-01-01
      • 2015-02-09
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多