2012-02-01 66 views
0

我对这个声明和SAML概念很陌生。我从ASP.NET使用WIF并从我的IDP接收下面的请求。我通过http请求发送了用户名/密码,并收到了SAML响应。我现在正在做什么?我听说我需要验证签名和密钥,如果是的话,(.NET)以及为什么?SAML 2.0和加密声明

<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> 

回答

1

要使用Windows身份验证基础(WIF)使用SAML 2.0,您将需要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> 

希望这有助于。

+0

它有一点帮助。以上我通过REST请求从IDP收到的SAML/XML。 – 2012-02-01 20:50:38

+0

SAML可能同时指协议和令牌格式。协议只需要WIF扩展。 WIF支持开箱即用的SAML令牌。 – 2012-02-02 12:24:32

+0

这个问题被标记为SAML 2.0,所以我认为他会需要扩展。 – 2012-02-02 14:56:11