Asp.net mvc 使用SAML2.0从.NETMVC到另一个站点进行身份验证

Asp.net mvc 使用SAML2.0从.NETMVC到另一个站点进行身份验证,asp.net-mvc,saml-2.0,Asp.net Mvc,Saml 2.0,我以前从未使用过SAML,有点困惑。我以为我可以对xml和密钥进行base64编码,然后就可以开始了,但显然不是那么简单 我必须向post方法发送一个相同的响应 <form method="post" action="%ACS" ...> <input type="hidden" name="SAMLResponse" value="%RESPONSE" /> <input type="hidden" name="RelayState" value=

我以前从未使用过SAML,有点困惑。我以为我可以对xml和密钥进行base64编码,然后就可以开始了,但显然不是那么简单

我必须向post方法发送一个相同的响应

<form method="post" action="%ACS" ...>
    <input type="hidden" name="SAMLResponse" value="%RESPONSE" />
    <input type="hidden" name="RelayState" value="%RELAYSTATE" />
     ...
</form>

...
这个动作是他们的URL和我用certificare或IDP元数据和assertation生成的相同响应。我想我可以对xml进行编码

<samlp:Response xmlns:samlp='urn:oasis:names:tc:SAML:2.0:protocol'xmlns:saml='urn:oasis:names:tc:SAML:2.0:assertion'ID='identifier_1'Version='2.0'IssueInstant='2004-12-05T09:22:05Z'Destination='https://sp.example.com/SAML2/SSO/POST'> <saml:Issuer>https://idp.example.org/SAML2</saml:Issuer> <samlp:Status> <samlp:StatusCode Value='urn:oasis:names:tc:SAML:2.0:status:Success'/> </samlp:Status> <saml:Assertion xmlns:saml='urn:oasis:names:tc:SAML:2.0:assertion'ID='identifier_2'Version='2.0'IssueInstant='2004-12-05T09:22:05Z'> <saml:Issuer>https://idp.example.org/SAML2</saml:Issuer> <ds:Signature xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>...</ds:Signature> <saml:Subject> <saml:NameID Format='urn:oasis:names:tc:SAML:2.0:nameidformat:uid'> " + employeeID + " </saml:NameID> <saml:SubjectConfirmation Method='urn:oasis:names:tc:SAML:2.0:cm:bearer'> <saml:SubjectConfirmationData Recipient='https://sp.example.com/SAML2/SSO/POST'NotOnOrAfter='2004-12-05T09:27:05Z'/> </saml:SubjectConfirmation> </saml:Subject> <saml:Conditions NotBefore='2004-12-05T09:17:05Z'NotOnOrAfter='2004-12-05T09:27:05Z'> <saml:AudienceRestriction> <saml:Audience>https://sp.example.com/SAML2</saml:Audience> </saml:AudienceRestriction> </saml:Conditions> <saml:AuthnStatement AuthnInstant='2004-12-05T09:22:00Z'SessionIndex='identifier_2'> <saml:AuthnContext> <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:u nspecified</saml:AuthnContextClassRef> </saml:AuthnContext> </saml:AuthnStatement> </saml:Assertion> </samlp:Response>
https://idp.example.org/SAML2     https://idp.example.org/SAML2 ...   “+员工ID+”https://sp.example.com/SAML2     urn:oasis:name:tc:SAML:2.0:ac:classes:u未指定

提供商建议我使用ADFS 3.0,但我希望避免更改服务器上的任何内容。有没有其他的软件包可以帮助我完成这一切?

不要尝试自己动手。使用客户端SAML堆栈,例如

该堆栈将SAML与类似于ADF的IDP进行通信。您需要使用客户端堆栈的SAML参数配置ADF