SAML2使用ASP.NET与ADFS联合元数据进行身份验证
我正在尝试通过 ASP.NET Web应用程序(SP)(。Net Framework 4.0)实现SAML2身份验证,并使用ADFS(IDP)实现。我已经集成了saml2.o掘金,并尝试以多种方式从HTML表单中获取凭证输入并发布SAML响应。但是无法显示输入表格并获得SAML响应?
这是我的示例源代码:(我已经实现了HTTP Post Binding)
StringBuilder sb = new StringBuilder();
Saml20AuthnRequest samlRequest = ADFSRequest.GetDefault();
samlRequest.Request.Destination = ConfigurationManager.AppSettings["IdentityProviderUrl"];
samlRequest.Request.AssertionConsumerServiceUrl = ConfigurationManager.AppSettings["ServiceProviderUrl"];
sb.Append(string.Format("{0}wia?SAMLRequest=",ConfigurationManager.AppSettings["IdentityProviderUrl"]));
sb.Append(HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.UTF8.GetBytes(samlRequest.GetXml().OuterXml))));
sb.Append("&client-request-id=").Append(samlRequest.Id);
HttpContext.Current.Response.Redirect(sb.ToString(),false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
任何人都可以帮助在ASP.NET应用程序中实现SAML2? 注意:我不想使用任何30个部分的工具,开源是可以的。
I am trying to implement the SAML2 authentication from ASP.NET Web Application(SP)(.Net Framework 4.0) with ADFS(IdP). I had integrated SAML2.o nugget and tried to many ways to get the credential inputs from HTML form and Post the SAML Response. But unable to display the input form and get the SAML Response?
Here is my sample source code : (I have implement the HTTP Post Binding)
StringBuilder sb = new StringBuilder();
Saml20AuthnRequest samlRequest = ADFSRequest.GetDefault();
samlRequest.Request.Destination = ConfigurationManager.AppSettings["IdentityProviderUrl"];
samlRequest.Request.AssertionConsumerServiceUrl = ConfigurationManager.AppSettings["ServiceProviderUrl"];
sb.Append(string.Format("{0}wia?SAMLRequest=",ConfigurationManager.AppSettings["IdentityProviderUrl"]));
sb.Append(HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.UTF8.GetBytes(samlRequest.GetXml().OuterXml))));
sb.Append("&client-request-id=").Append(samlRequest.Id);
HttpContext.Current.Response.Redirect(sb.ToString(),false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Anyone can help to implement the SAML2 in ASP.Net application?
Note: I don’t want to use any thirty-part tools and open source is fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)