【问题标题】:Explicit SAML attributes in Spring SamlSpring Saml 中的显式 SAML 属性
【发布时间】:2016-09-01 12:31:25
【问题描述】:

有没有办法明确告诉 IDP 哪些我期望的属性?我想答案是肯定的,但我找不到例子。我需要在 SP 元数据 中指定“某事”吗?

是否有人能够扩展 Spring SAML MetadataGeneratorFilter 以实际构建 SP xml 的属性列表?

例如,我想在响应中包含以下内容:

  • 姓名
  • 公司名称
  • 部门
  • 角色

有什么建议吗?

【问题讨论】:

    标签: java spring saml spring-saml


    【解决方案1】:

    可以使用<md:RequestedAttribute> 元素在元数据中调用 SAML 2.0 服务提供者属性要求。

    该元素有一个布尔属性isRequired,可以按如下方式设置:

    <md:EntityDescriptor entityID="https://sp.example.org/saml"
        xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
      <md:SPSSODescriptor
          protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
        ...
        <!-- one or more indexed AssertionConsumerService elements -->
        <md:AssertionConsumerService index="1" Binding="..." Location="..."/>
        ...
        <!-- zero or more indexed AttributeConsumingService elements -->
        <md:AttributeConsumingService index="1">
          <md:ServiceName>The Virtual School of Computational Science and Engineering</md:ServiceName>
          <md:ServiceDescription>The Virtual School of Computational Science and Engineering (VSCSE) helps graduate students, post-docs and young professionals from all disciplines and institutions across the country gain the skills they need to use advanced computational resources to advance their research.</md:ServiceDescription>
          <md:RequestedAttribute isRequired="false"
              NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
              Name="urn:oid:2.5.4.42"
              FriendlyName="givenName"/>
          <md:RequestedAttribute isRequired="true"
              NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
              Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.7"
              FriendlyName="eduPersonEntitlement">
            <saml:AttributeValue
                xsi:type="xs:anyURI">https://example.org/is-a-grad-student</saml:AttributeValue>
          </md:RequestedAttribute>
        </md:AttributeConsumingService>
        ...
      </md:SPSSODescriptor>
      ...
    </md:EntityDescriptor>
    

    更多信息请访问:https://spaces.internet2.edu/.../SP+Attribute+Requirements

    请记住,您始终可以手动自定义/扩展元数据并发布它们(毕竟,我们谈论的是基于 Web 的应用程序),关闭 Spring SAML MetadataGeneratorFilter 的自动生成。

    考虑到这种方法不足以保证可靠的属性发布。如果身份提供者提供了所需的数据,您应该始终手动检查 SAMLUserDetailsService 的自定义实现,从而允许或拒绝用户身份验证。

    【讨论】:

    • 这是我尝试过的,但没有成功,但是在网上阅读了几篇文章后,我被引导相信 ADFS 并不关心那一点元数据。虽然不是 100% 确定...
    • 实际行为与具体实现有关(有些联邦系统只是忽略了一些规范)。一般来说,属性释放必须明确声明并同意作为身份提供者和服务提供者之间信任关系的策略。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-09
    • 1970-01-01
    • 1970-01-01
    • 2020-05-20
    • 1970-01-01
    • 1970-01-01
    • 2020-09-24
    相关资源
    最近更新 更多