我在用春天萨姆执行。在 WebSSOProfileConsumerImpl 类中,我可以找到以下代码行,用于检查 nameIdSAML 响应的断言.
NameID nameID;
if (subject.getEncryptedID() != null) {
Assert.notNull(context.getLocalDecrypter(), "Can't decrypt NameID, no decrypter is set in the context");
nameID = (NameID) context.getLocalDecrypter().decrypt(subject.getEncryptedID());
} else {
nameID = subject.getNameID();
}
根据代码,很明显 nameId 应该是主题的一部分。但大多数 IDP(包括我正在使用的 IDP)都提到 nameId 可能是主题/属性。似乎有一些实现接受主题中的 nameId 就像简单SAMLPHP.
The subject我收到的信息如下,并且没有包含 nameId
<saml2:Subject>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData Address="91.X.X.X" InResponseTo="XXXX" NotOnOrAfter="2014-10-10T10:34:26.619Z" Recipient="http://localhost:8080/XXXX/saml/SSO"/>
</saml2:SubjectConfirmation>
</saml2:Subject>
然而,有一个属性其中有一个nameId as its 属性值。为什么不能用这个来代替subject.
<saml2:Attribute FriendlyName="testID" Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml2:AttributeValue>
<saml2:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" NameQualifier="https://XXXX/idp/shibboleth" SPNameQualifier="urn:XX:XX:XX">XXXXXXXXXXXXXXXXX=
</saml2:NameID>
</saml2:AttributeValue>
</saml2:Attribute>
谁能解释一下背后的原因nameId成为唯一的一部分subject in 春天萨姆执行。
@vschafer 有没有办法自定义安全上下文.xml选择nameId这是特定的一部分属性而不是来自subject?