Class AuthnContext

java.lang.Object
org.bouncycastle.asn1.ASN1Object
se.swedenconnect.cert.extensions.AuthnContext
All Implemented Interfaces:
org.bouncycastle.asn1.ASN1Encodable, org.bouncycastle.util.Encodable

public class AuthnContext extends org.bouncycastle.asn1.ASN1Object
AuthnContext X.509 extension implementation for extending Bouncycastle.
  • Field Details

    • OID

      public static final org.bouncycastle.asn1.ASN1ObjectIdentifier OID
    • CONTENT_TYPE

      public static final String CONTENT_TYPE
      See Also:
  • Constructor Details

    • AuthnContext

      public AuthnContext(List<SAMLAuthContext> statementInfoList)
      Constructor
      Parameters:
      statementInfoList - list of statement infos
  • Method Details

    • getInstance

      public static AuthnContext getInstance(Object obj)
      Creates an instance of the Authentication context extension
      Parameters:
      obj - object holding extension data
      Returns:
      Authentication context extension
    • getInstance

      public static AuthnContext getInstance(Object obj, boolean strictMode)
      Creates an instance of the Authentication context extension
      Parameters:
      obj - object holding extension data
      strictMode - strict syntax processing
      Returns:
      Authentication context extension
    • fromExtensions

      public static AuthnContext fromExtensions(org.bouncycastle.asn1.x509.Extensions extensions)
      Creates an instance of the Authentication context extension
      Parameters:
      extensions - Authentication context extension
      Returns:
      Authentication context extension
    • fromExtensions

      public static AuthnContext fromExtensions(org.bouncycastle.asn1.x509.Extensions extensions, boolean strictMode)
      Creates an instance of the Authentication context extension
      Parameters:
      extensions - Authentication context extension
      strictMode - strict syntax processing
      Returns:
      Authentication context extension
    • toASN1Primitive

      public org.bouncycastle.asn1.ASN1Primitive toASN1Primitive()
      Produce an object suitable for an ASN1OutputStream.
       AuthenticationContexts ::= SEQUENCE SIZE (1..MAX) OF
                                  AuthenticationContext
      
       AuthenticationContext ::= SEQUENCE {
           contextType     UTF8String,
           contextInfo     UTF8String OPTIONAL
       }
       
      Specified by:
      toASN1Primitive in interface org.bouncycastle.asn1.ASN1Encodable
      Specified by:
      toASN1Primitive in class org.bouncycastle.asn1.ASN1Object
      Returns:
      ASN.1 object of the extension
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAuthnContext

      public static SAMLAuthContext getAuthnContext(String xml, boolean strictMode) throws IOException
      Creates a SAMLAuthContext object from an xml string
      Parameters:
      xml - xml string
      strictMode - true to strictly enforce content requirement rules
      Returns:
      SAMLAuthContext object
      Throws:
      IOException - on error parsing data
    • printAuthnContext

      public static String printAuthnContext(SAMLAuthContext authnConext, boolean formatted) throws IOException
      Converts a SAMLAuthContext object to XML string
      Parameters:
      authnConext - SAMLAuthContext object
      formatted - true to generate pretty printing version
      Returns:
      XML string
      Throws:
      IOException - on error parsing data