ComponentPro UltimateSaml

      SamlNameIdentifierFormat Class

      See AlsoMembersMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Name identifier format identifiers.


      public static class SamlNameIdentifierFormat


      Shows how to create an AuthnRequest request and send it over HTTP POST or HTTP Redirect.

      using System.Security.Cryptography.X509Certificates;
      using System.Web;
      using ComponentPro.Saml2;
      // Create a new instance of the AuthnRequest class.
      AuthnRequest request = new AuthnRequest();
      request.IsPassive = false;
      // Set Protocol Binding.
      request.ProtocolBinding = SamlBindingUri.HttpPost;
      // Set the target provider's Assertion Consumer Service Url.
      request.AssertionConsumerServiceUrl = "your url";
      // Set Issuer
      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));
      // Send the request over HTTP POST
      request.SendHttpPost(Response, "http://mybaseurl", "my_relay_state");
      // Or you can send it over HTTP Redirect 
      // X509Certificate2 certificate = new X509Certificate2("PKey.pfx", "password");
      // request.Redirect(Response, "http://mybaseurl", "my_relay_state", certificate.PrivateKey);

      Inheritance Hierarchy



      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Saml (in ComponentPro.Saml.dll)

      See Also