asp.net-mvc - 使用 SAML 2.0 从 .net mvc 到另一个站点进行身份验证

标签 asp.net-mvc saml-2.0

我以前从未使用过 SAML,所以有点困惑。我以为我可以只对 xml 和一个 key 进行 base64 编码,然后就可以了,但显然没那么简单。

我必须将 SAMLRESPONSE 发送到 post 方法

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

操作是他们的 URL 和我在我这边生成的带有证书或 IDP MEta 数据和断言的 SAMLRESPONSE。我以为我可以编码我的 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>

提供商建议我使用 ADFS 3.0,但我想避免更改服务器上的任何内容。我可以使用不同的软件包来帮助完成这一切吗?

最佳答案

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

此堆栈将 SAML 与 ADFS 等 IDP 进行对话。您需要使用客户端堆栈的 SAML 参数配置 ADFS。

关于asp.net-mvc - 使用 SAML 2.0 从 .net mvc 到另一个站点进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48388685/

相关文章:

.net - 使用 Sustainsys/Saml2 将 .NET MVC 应用程序与 SAML 联合起来

spring-security - Spring Security SAML-无法验证签名

javascript - 使用 Javascript 和 .NET MVC 将小数格式化为两位

asp.net-mvc - 在 ASP.NET MVC 中处理内容 URL 的正确和最简单的方法是什么?

javascript - 我的 asp.net 应用程序的 Excel 网格

spring - Spring-SAML 的 SSL 配置问题

java - SAML2 SSO 断言使用者

c# - 域模型和列表/详细信息页面

c# - 如何在asp.net mvc中将字符串列表从 Controller 发送到javascript(存在于 View 中)

java - Spring 安全 SAML : Accept only signed SAML response messages from IDP