【问题标题】:Can we get the attributes sent by IDP after sending to saml2/ACS in SP return url?在SP返回url中发送到saml2/ACS后,我们可以得到IDP发送的属性吗?
【发布时间】:2019-06-18 15:31:00
【问题描述】:
我正在使用 Sustainsys.Saml2.MVC 对 MVC 应用程序实施 Saml 身份验证,并且可以成功地将用户导航到 IDP 并获得对 saml2/ACS 的 saml 响应。正如我所读到的,我们可以使用声明访问 Saml 响应参数,但是当我在声明中搜索以找到与在 Saml 响应中写入的声明相同的声明时,我找不到任何声明。我需要获取一些用 Saml 响应编写的属性,以继续我的其余实现。是否有解决方案可以在应用程序的重新发送 url 中获得发送到 saml2/Acs 的相同 Saml 响应?
【问题讨论】:
标签:
c#
asp.net-mvc
sustainsys-saml2
【解决方案1】:
要从发送到 Saml2/ACS 的 SAml 响应中获取所需的属性,我们需要在 webconfig 中声明 Sustainsys 元素时定义所需的属性:
就我而言,我是这样做的:
<nameIdPolicy allowCreate="true" format="Persistent" />
<metadata>
<requestedAttributes>
<add friendlyName="email" name="urn:email" nameFormat="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" isRequired="true" />
<add friendlyName="xdsuser" name="urn:xdsuser" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"></add>
<add friendlyName="globaluser" name="urn:globaluser" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"></add>
<add friendlyName="groups" name="groups" nameFormat="urn:oasis:names:tc:SAML:2.0:assertion" isRequired="true"></add>
<add name="Minimal" />
</requestedAttributes>
</metadata>
<identityProviders>
<add entityId="https://myIDPID" metadataLocation="~/App_Data/IDPConfig.xml" signOnUrl="https://MyIDPSignonUrl" allowUnsolicitedAuthnResponse="true" loadMetadata="true" />
</identityProviders>