Creating and sending an AuthnRequest

Today we will introduce an example on how to create an AuthnRequest and send it to your IdentityProvider using our Ultimate SAML component:

AuthnRequest request = new AuthnRequest();
request.IsPassive = false;
request.ProtocolBinding = SamlBindingUri.HttpPost;
request.AssertionConsumerServiceURL = "your url";

request.Issuer = new Issuer();
request.Issuer.NameIdentifier = "your name identifier";

request.NameIdPolicy = new NameIdPolicy();
request.NameIdPolicy.SpNameQualifier = "moodle.sp.myname";
request.NameIdPolicy.AllowCreate = true;
request.NameIdPolicy.Format = SamlNameIdentifierFormat.Persistent;

request.RequestedAuthnContext = new RequestedAuthnContext();
request.RequestedAuthnContext.Comparison = SamlAuthenticationContextComparison.Exact;
request.RequestedAuthnContext.AuthenticationContexts.Add(new AuthnContextClassRef(SamlAuthenticationContext.PasswordProtectedTransport));

request.SendHttpPost(Response, "http://mybaseurl", "my_relay_state");

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now

Dont miss out Get update on new articles and other opportunities