Class ArtifactImpl

  • All Implemented Interfaces:
    Artifact

    public class ArtifactImpl
    extends Object
    implements Artifact
    This class implements interface Artifact. It models type urn:oasis:names:tc:SAML:2.0:artifact-04 Artifact.

     SAML_artifact := B64(TypeCode EndpointIndex RemainingArtifact)
     TypeCode      := Byte1Byte2
     EndpointIndex := Byte1Byte2
    
     TypeCode          := 0x0004
     RemainingArtifact := SourceID messageHandle
     SourceID          := 20-byte_sequence
     MessageHandle     := 20-byte_sequence
     
    • Constructor Detail

      • ArtifactImpl

        public ArtifactImpl​(String encodedArtifactValue)
                     throws SAML2Exception
        Constructor with Base64 encoded Artifact value.
        Parameters:
        encodedArtifactValue - the Artifact value.
        Throws:
        SAML2Exception - if it fails to instantiate the object.
      • ArtifactImpl

        public ArtifactImpl​(byte[] typecode,
                            int endpointindex,
                            String sourceid,
                            String messagehandle)
                     throws SAML2Exception
        Constructor.
        Parameters:
        typecode - two byte sequence representing TypeCode.
        endpointindex - integer value of EndpointIndex. Its allowed range is between 0 and 65535.
        sourceid - String format of 20-byte sequence. Usually obtained from taking the SHA-1 hash of the identification URL (called provider ID).
        messagehandle - String format of 20-byte sequence identifying a message. This value is constructed from a cryptographically strong random or pseudorandom number sequence.
        Throws:
        SAML2Exception - if it fails to instantiate the object.
    • Method Detail

      • getArtifactValue

        public String getArtifactValue()
        Returns the artifact.
        Specified by:
        getArtifactValue in interface Artifact
        Returns:
        the value of the artifact. It's Base64 encoded.
      • getSourceID

        public String getSourceID()
        Returns the SourceID of the artifact.
        Specified by:
        getSourceID in interface Artifact
        Returns:
        The SourceID of the artifact.
      • getMessageHandle

        public String getMessageHandle()
        Returns the MessageHandle of the artifact. The result will be decoded.
        Specified by:
        getMessageHandle in interface Artifact
        Returns:
        The MessageHandle of the artifact.
      • getTypeCode

        public byte[] getTypeCode()
        Returns the TypeCode of the artifact.
        Specified by:
        getTypeCode in interface Artifact
        Returns:
        The byte array of the TypeCode for the artifact.
      • getEndpointIndex

        public int getEndpointIndex()
        Returns the EndpointIndex of the artifact.
        Specified by:
        getEndpointIndex in interface Artifact
        Returns:
        value of the EndpointIndex for the artifact.
      • toXMLString

        public String toXMLString()
                           throws SAML2Exception
        Returns a String representation of the element.
        Specified by:
        toXMLString in interface Artifact
        Returns:
        A string containing the valid XML for this element. By default name space name is prepended to the element name.
        Throws:
        SAML2Exception - if the object does not conform to the schema.
      • toXMLString

        public String toXMLString​(boolean includeNS,
                                  boolean declareNS)
                           throws SAML2Exception
        Returns a String representation of the element.
        Specified by:
        toXMLString in interface Artifact
        Parameters:
        includeNS - Determines whether or not the namespace qualifier is prepended to the Element when converted
        declareNS - Determines whether or not the namespace is declared within the Element.
        Returns:
        A string containing the valid XML for this element
        Throws:
        SAML2Exception - if the object does not conform to the schema.