ComponentPro UltimateSaml

      AttributeStatement Class

      See AlsoMembersMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Represents an attribute statement.

      Syntax

      public class AttributeStatement : Statement

      Examples

      Shows how to create an AuthnStatement and add it to an Assertion.

      using System;
      using ComponentPro.Saml2;
      
      ...
      
      // Create SAML Assertion.
      Assertion samlAssertion = new Assertion();
      
      // Set Issuer
      samlAssertion.Issuer = new Issuer("http://idp.domain.org", null, null, SamlNameIdentifierFormat.Entity, null);
      samlAssertion.Subject = new Subject(new NameId("johnvu@test.com", null, null, SamlNameIdentifierFormat.EmailAddress, null));
      samlAssertion.Conditions = new Conditions(new TimeSpan(1, 0, 0));
      
      // Create SAML AuthnStatement.
      ComponentPro.Saml2.AuthnStatement authnStatement = new ComponentPro.Saml2.AuthnStatement();
      authnStatement.AuthnContext = new AuthnContext();
      authnStatement.SessionNotOnOrAfter = DateTime.UtcNow.AddDays(1);
      authnStatement.AuthnContext.AuthnContextClassRef = new AuthnContextClassRef(SamlAuthenticationContext.InternetProtocolPassword);
      
      // Add it to the assertion.
      samlAssertion.Statements.Add(authnStatement);
      
      // Add an attribute statement.
      AttributeStatement attributeStatement = new AttributeStatement();
      // Add FirstName attribute
      attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("FirstName", SamlAttributeNameFormat.Basic, null, "John"));
      
      samlAssertion.Statements.Add(attributeStatement);
      
      attributeStatement = new AttributeStatement();
      // Add LastName attribute
      attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("LastName", SamlAttributeNameFormat.Basic, null, "Vu"));
      
      samlAssertion.Statements.Add(attributeStatement);

      Inheritance Hierarchy

               ComponentPro.Saml2.ComponentPro.Saml2.AttributeStatement

      Framework

      .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