跳过未映射的SAML 2.0属性,即使name和nameFormat matchf

SP运行Shibboleth 2.5.6。 对于一个特定的IdP,我有这些属性映射:

<Attribute name="role" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" id="role" /> <Attribute name="urn:mace:dir:attribute-def:givenName" nameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri" id="givenName" /> 

我收到一条包含以下内容的电报

 <AttributeStatement> <Attribute Name="role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Educator</AttributeValue> </Attribute> <Attribute Name="urn:mace:dir:attribute-def:givenName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"> <AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">intraguest</AttributeValue> </Attribute> </AttributeStatement> 

哪些日志:

 Shibboleth.AttributeExtractor.XML : creating mapping for Attribute role, Format/Namespace:urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified Shibboleth.AttributeExtractor.XML : creating mapping for Attribute urn:mace:dir:attribute-def:givenName ... DEBUG Shibboleth.AttributeDecoder.String [1]: decoding SimpleAttribute (role) from SAML 2 Attribute (role) with 1 value(s) INFO Shibboleth.AttributeExtractor.XML [1]: skipping unmapped SAML 2.0 Attribute with Name: urn:mace:dir:attribute-def:givenName, Format:urn:mace:shibboleth:1.0:attributeNamespace:uri 

为什么givenName忽略,当它的namenameFormat匹配?

我注意到Format/Namespace评论是从givenName创build映射日志行中缺less,但我认为这是因为给定的nameFormat匹配的默认值。


更新:

IdP是一个PingFederate源代码,其元数据声明为SAML 2.以下是元数据的相关摘录:

 <md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" ID="..." entityID="..."> <md:IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> <saml:Attribute xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Name="urn:mace:dir:attribute-def:givenName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/> <saml:Attribute xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Name="role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"/> </md:IDPSSODescriptor> </md:EntityDescriptor> 

我们遇到同样的问题。 显然Shibboleth不能混合SAML 1和SAML 2的格式。你必须按如下方式使用它们( https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAddAttribute ):

  • SAML 1:
    • urn:mace:sh​​ibboleth:1.0:attributeNamespace:uri (默认)
    • 如果要以另一种格式(而不是SAML 2格式)映射属性,则必须使用nameFormat属性在属性映射中指定它。
  • SAML 2:
    • urn:oasis:names:tc:SAML:2.0:attrname-format:uri (默认)
    • urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified (默认)
    • 如果要以另一种格式(而不是SAML 1格式)映射属性,则必须使用nameFormat属性在属性映射中指定它。

因此,您遇到的问题是,即使您明确告诉Shibboleth使用nameFormat属性使用SAML1格式,也会收到带有使用SAML 1格式的属性的SAML 2消息,而Shibboleth不支持该消息。

我们通过要求PingFederate IdP团队使用SAML 2“urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified”格式向我们发送属性来解决这个问题(因为这显然是一种容易在PingFederate支持)。 在我们的属性映射中,我们不使用nameFormat属性,因为这个格式是Shibboleth的默认值。

我希望这可以帮助你解决这个问题。