【问题标题】:SAML 2.0 and EncryptedAssertionSAML 2.0 和加密断言
【发布时间】:2012-02-01 16:51:14
【问题描述】:

我不熟悉此声明和 SAML 概念。我正在使用来自 ASP.NET 的 WIF,并从我的 IDP 收到以下请求。我通过 http 请求发送了用户名/密码并收到了此 SAML 响应。我现在具体做什么?我听说我需要验证签名和密钥,如果需要,如何(.NET)以及为什么?

<EncryptedAssertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
- <xenc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" /> 
- <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
- <e:EncryptedKey xmlns:e="http://www.w3.org/2001/04/xmlenc#">
- <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
</e:EncryptionMethod>
- <KeyInfo>
- <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
- <X509Data>
- <X509IssuerSerial>
<X509IssuerName>CN=LeastPrivilegeCA</X509IssuerName> 
<X509SerialNumber>458206499362374248562711</X509SerialNumber> 
</X509IssuerSerial>
</X509Data>
</o:SecurityTokenReference>
</KeyInfo>
- <e:CipherData>
<e:CipherValue>SOME DATA</e:CipherValue> 
</e:CipherData>
</e:EncryptedKey>
</KeyInfo>
- <xenc:CipherData>
<xenc:CipherValue>SOME DATA</xenc:CipherValue> 
</xenc:CipherData>
</xenc:EncryptedData>
</EncryptedAssertion>

【问题讨论】:

    标签: .net token wif claims-based-identity saml-2.0


    【解决方案1】:

    要将 SAML 2.0 与 Windows Identity Foundation (WIF) 结合使用,您需要 WIF Extension for the SAML 2.0 Protocol。下载后,您会发现一些关于如何使用 SAML 令牌进行身份验证的好示例。

    您确实不需要手动执行任何操作来解析此令牌,因为 WIF 应该为您管理所有这些。您只需要确保安装并配置了正确的证书即可解密消息。如果您使用的是 SAML 2.0 扩展,这将在 web.config 中引用的服务提供商配置中进行设置:

    <microsoft.identityModel.saml metadata="bin\App_Data\serviceprovider.xml">
        <!-- The location of the configuration files of all the partners this service trusts. -->
        <identityProviders>
            <metadata file="bin\App_Data\identityprovider.xml"/>
        </identityProviders>
    </microsoft.identityModel.saml>
    

    希望这会有所帮助。

    【讨论】:

    • 有点帮助。我通过 REST 请求从 IDP 收到的上述 SAML/XML。
    • SAML 可能同时引用协议和令牌格式。该协议仅需要 WIF 扩展。 WIF 支持开箱即用的 SAML 令牌。
    • 这个问题被标记为 SAML 2.0,所以这就是我认为他需要扩展的原因。
    猜你喜欢
    • 1970-01-01
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 2012-03-14
    • 1970-01-01
    • 2019-08-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多