我开始知道在任何 SSO 解决方案中,如果 SP 需要任何其他属性,它可以使用 AttributeConsumingService 参数在其元数据中发布它们。现在可以添加所需的属性,如下所示:
<md:AttributeConsumingService index="0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<md:ServiceName xml:lang="en">ABC</md:ServiceName>
<md:ServiceDescription xml:lang="en">ABC</md:ServiceDescription>
<md:RequestedAttribute isRequired="true"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
Name="urn:oid:2.5.4.42"
FriendlyName="FirstName"/>
</md:AttributeConsumingService>
现在,如果我想在我的 SP 元数据中添加一个自定义属性,比如说用户的“角色”,我应该如何将它添加到元数据中?我的意思是,它的名称是什么(这是我无法找到的!),NameFormat(是 urn:oasis:names:tc:SAML:2.0:attrname-format:uri 吗?)和 FriendlyName(我可以给它在这里是“角色”?)。我在 SAML2Core 文档中没有找到与此相关的任何内容。
请有任何建议!
谢谢,
阿比拉什
最佳答案
没有统一的答案,因为这取决于您使用的 IDP/联盟及其支持的内容。
通常,友好名称只是属性的人类可读标识符,可以自由定义值。
NameFormat 和 Name 是根据您的 IDP 使用的属性配置文件定义的(例如基本配置文件、X.500/LDAP 配置文件等)。预期值可以在 SAML 2.0 profiles document 中找到第 8 章。
您可以找到一个在实践中如何使用它的示例,例如在他们的共同联盟documentation .
关于single-sign-on - 如何在 SP 元数据中配置自定义属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23334826/