【问题标题】:Shibboleth return username as HTTP Header instead of SAML attributeShibboleth 返回用户名作为 HTTP 标头而不是 SAML 属性
【发布时间】:2016-09-29 20:41:26
【问题描述】:

Shibboleth IDP 和 SP 谈得很好,我需要的数据在 SAML 中。

允许 shibboleth 返回包含我需要的信息的 HTTP 标头需要什么配置(是的,我知道这是个坏主意,但别无选择)。

我在 IIS 上运行 SP 2.6,需要一个带有 shibboleth3 IDP 响应中用户名的 HTTP 标头。

这是我为 attribute-map.xml 尝试过的内容

<Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" id="netId" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"/>

它在 SAML 中为我提供了这些数据

 <saml2:AttributeStatement>
        <saml2:Attribute FriendlyName="eduPersonPrincipalName"
                         Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6"
                         NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                  xsi:type="xsd:string">me@school.edu</saml2:AttributeValue>
        </saml2:Attribute>
    </saml2:AttributeStatement>

由于我正在使用的软件,我需要 HTTP 标头中的用户名。

【问题讨论】:

  • 您需要以某种方式解析断言,获取所需属性,并在 http 标头中发送到您的软件。
  • 是的,我正试图避免编写中间件脚本,但我就在那个时候。

标签: http-headers saml saml-2.0 shibboleth


【解决方案1】:

您不能让身份提供者发布 HTTP 标头。那不是 SAML Web 浏览器 SSO 配置文件。

你已经有了你正在谈论的中间件,它是 Shibboleth 服务提供者,如果你的 attribute-map.xml 文件是正确的,你将能够从你的应用程序逻辑中访问属性作为 env 变量或 http 标头如here所述

属性如何映射到 HTTP 标头的示例如下:

假设你

  • 从 IdP 中释放 SAML 名称为 urn:oid:1.3.6.1.4.1.5923.1.1.1.6 的属性,并且

  • 在您的 SP attribute-map.xml 中,您有一个属性解码器,例如:

<Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" id="netId" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"/>

考虑到

使用标头时,主要区别在于,应用程序必须使用“HTTP_”作为前缀,而不是使用通过映射过程定义的名称,并且在大多数工具中,名称的其余部分也是大写的。

HTTP 标头最终将是HTTP_NETID

关于如何读取标头值,如this thread 中所述,

遍历所有传递的:

foreach (string key in Request.ServerVariables.AllKeys)

引用特定值:

value = Request.ServerVariables[key];

【讨论】:

  • 你能分享一个将变量映射到http头的attribute-map.xml的具体例子吗?
猜你喜欢
  • 1970-01-01
  • 2012-11-05
  • 2013-02-12
  • 1970-01-01
  • 1970-01-01
  • 2021-11-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多