Windows Live Open ID Connect/Oauth 2.0 如何使用 Apache 进行 SSO mod_auth_openidc

Windows Live Open ID Connect/Oauth 2.0 How to use for SSO with Apache mod_auth_openidc

我已经 mod_auth_openidc 使用 Google 和手卷版本的 phpOIDC 作为我的 OP,mod_auth_openidc 作为我的身份提供者。

我的问题似乎是 Microsoft 实施中的错误。

mod_auth_openidc 很棒 mod 并且做了相当多的验证日志。

JWT 中返回的内容之一是 "aud" 参数,即受众。

根据 Open ID Connect 规范:

aud REQUIRED. Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 client_id of the Relying Party as an audience value. It MAY also contain identifiers for other audiences. In the general case, the aud value is an array of case sensitive strings. In the common special case when there is one audience, the aud value MAY be a single case sensitive string.

我的客户ID是00000001234(不是我的真实ID,只是一个例子)。

我通过了握手,一切都是 groovy,我从 Windows Live 得到了我的随机数 "code",然后我用它交换了我的令牌,但是我得到的令牌back 的 "aud" 值为:

00000000-0000-0000-0000-00000001234

mod_auth_openidc 正确检查了返回令牌中的 "aud" 值并响应错误,因为 "aud" 与配置的 cliend_id 不匹配,这是应该的,根据规范

我的问题是,除了不验证令牌的受众之外,还有什么方法可以在 MS Developer 控制台中配置应用程序,以便 returns [=38] 的客户端 ID 正确=] 返回令牌中的值?

还有,在他们的实施中报告此类错误的最佳位置在哪里?

实际上 login.live.com 的文档中没有任何地方说 MS Live 是 OpenID Connect 兼容的。它确实提到它已经在 OAuth 2.0 之上构建了自己的 SSO 协议。

您似乎通过反复试验发现 MS Live 支持 OpenID Connect 的重要部分(知名位置的发现文档、JWKS URI、openid 范围等) ,这对我来说本身就是新闻。但不幸的是,似乎仍然缺少一件小事......这可能也是尚未宣布 OpenID Connect 支持 MS Live ID 的原因。

MS 在 Azure AD 中的 OpenID Connect 实现 已经完全兼容,Live ID 还没有。我想你所能做的就是窃听 MS。

在 MSA 上,00000000-0000-0000-0000-00000001234 和 00000001234 是同一应用程序的不同标识符。新的应用程序门户 (apps.dev.microsoft.com) 更喜欢 128 位标识符 (guid),旧的应用程序门户 (account.live.com/developers/applications) 更喜欢旧的 64 位标识符。 id_token 将始终包含新标识符。

您可以使用新的标识符格式(即 00000000-0000-0000-0000-00000001234)使请求 client_id 匹配令牌 'aud' 声明。

已创建新标识符,以便 MSA 和 AAD 标识符匹配。