【发布时间】:2016-10-05 12:24:54
【问题描述】:
以下是我作为 SAML 响应获得的示例响应。如何使用以下 XML 响应中的“NameID”属性,我应该包含哪些代码才能获取该属性,以及它应该包含在我的 ASP.NET (C#) 应用程序中的什么位置?
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">email</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData InResponseTo="_b221ce73-ae7e-4119-bacd-6e5d3fb457a1"
NotOnOrAfter="2015-10-16T14:15:04.877Z" Recipient="/ACS/Post.aspx"/>
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2015-10-16T14:10:04.873Z" NotOnOrAfter="2015-10-16T15:10:04.873Z">
<AudienceRestriction>
<Audience>yourAudience</Audience>
</AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
<AttributeValue>email@example.org</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname">
<AttributeValue>John</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname">
<AttributeValue>Doe</AttributeValue>
</Attribute>
</AttributeStatement>
<AuthnStatement AuthnInstant="2015-10-16T14:10:04.556Z"
SessionIndex="_0660f911-7f04-4616-8dd6-dea65ec0032b">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
【问题讨论】:
-
您是否使用 ADFS 手动实施身份验证?如果是这样,为什么不使用 WIF(Windows Identity Foundation)?
-
谢谢.. :) 是的。我也在检查WIF。你能建议我确切的链接,我可以在哪里找到实现它的步骤。
-
检查msdn.microsoft.com/en-us/library/hh545401(v=vs.110).aspx,在本页末尾,您可以找到包含 Web 表单和 MVC 说明的链接。