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.