我是 SAML 新手,在完全理解完整的 SAML2 SSO 流程方面遇到了一些困难。
具体来说,当服务提供商使用元素响应资源请求时,元素中的哪一部分数据标识要由身份提供商验证的主体(即用户)?
例如,以下 AuthnRequest 中似乎没有任何内容可以识别主体:
<samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="identifier_1"
Version="2.0"
IssueInstant="2004-12-05T09:21:59"
AssertionConsumerServiceIndex="0">
<saml:Issuer>https://sp.example.com/SAML2</saml:Issuer>
<samlp:NameIDPolicy
AllowCreate="true"
Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"/></samlp:AuthnRequest>
在 AuthnRequest 到达浏览器后,是否会添加识别主体的信息(可能来自 cookie?),还是根本不会将识别特定用户的信息发送到身份提供商?
最佳答案
规范对身份验证请求进行了如下说明(SAML 配置文件,http://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf,第 4.1.4.1 节):
Note that the service provider MAY include a
<Subject>
element in the request that names the actual identity about which it wishes to receive an assertion.
然而,这种方法很少使用,也没有在不同的提供商/堆栈中广泛实现,因此您的情况可能会有所不同。事实上,有一些部署配置文件明确禁止使用 <Subject>
,例如http://saml2int.org/profile/current/第 8.2 节说:
The
<saml2p:AuthnRequest>
message MUST NOT contain a<saml2:Subject>
element.
通常的交互是服务提供商确定身份提供商而不是用户。后者留给身份提供者,包括识别和认证。这是一个更干净的界面,可以避免两者之间关于标识符和帐户的潜在冲突。
关于authentication - 如何在 SAML 2.0 Web 浏览器 SSO 的 AuthnRequest 中识别主体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32381733/