Attributes Shibboleth-如何读取属性?

Attributes Shibboleth-如何读取属性?,attributes,shibboleth,Attributes,Shibboleth,我正在使用Shibboleth成功登录我的服务提供商测试页面。然后转到/Shibboleth.sso/Session页面,我看到以下内容: Attributes affiliation: 1 value(s) entitlement: 1 value(s) eppn: 1 value(s) persistent-id: 1 value(s) unscoped-affiliation: 1 value(s) 我的问题是。。。我如何读取这些值?我在Fiddler的HTTP请求头中没有看到它们 我的

我正在使用Shibboleth成功登录我的服务提供商测试页面。然后转到/Shibboleth.sso/Session页面,我看到以下内容:

Attributes
affiliation: 1 value(s)
entitlement: 1 value(s)
eppn: 1 value(s)
persistent-id: 1 value(s)
unscoped-affiliation: 1 value(s)
我的问题是。。。我如何读取这些值?我在Fiddler的HTTP请求头中没有看到它们


我的web应用程序将在ASP.NET MVC 4(C#)中实现。

您可以使用请求读取IdP发送的Shibboleth SAML属性。ServerVariables对象:

string server = Request.ServerVariables["HTTP_FIRSTNAME"];
查看是否要列出并打印会话中的所有属性。

记住配置Shibbolethattribute map.xml以处理IdP可能发送的自定义属性:

<Attribute name="firstname" id="firstname" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
    <AttributeDecoder xsi:type="StringAttributeDecoder"/>
</Attribute>

您还可以在
shibboleth2.xml
中的会话处理程序中将
showAttributeValue
设置为
true
。注意,在生产环境中不建议这样做。然后重新启动shibboleth服务;会话页面的属性部分将包括实际值

<!-- Session diagnostic service. -->
<Handler type="Session" Location="/Session" showAttributeValues="true"/>

既然你提到了fiddler,我将继续补充(问题几年后)有一个非常好的firefox浏览器插件,名为“SAML tracer”。(只要搜索“saml tracer”,你就会找到它的mozilla插件页面。)一旦安装在firefox中,你就可以打开它的窗口,它将显示所有http请求和响应。如果其中有saml,它会在url旁边用一个“saml”标记来表示;然后,您可以单击该url,选择“SAML”选项卡,并读取idp或sp与浏览器之间发送的所有SAML。这是一个非常好的在线故障排除工具,因此您不必处理sp和/或idp上的任何问题(甚至不必访问它们)