Package org.opensaml.saml.saml2.binding.artifact

# Class SAML2ArtifactType0004

java.lang.Object
org.opensaml.saml.common.binding.artifact.AbstractSAMLArtifact
org.opensaml.saml.saml2.binding.artifact.AbstractSAML2Artifact
org.opensaml.saml.saml2.binding.artifact.SAML2ArtifactType0004

All Implemented Interfaces:
  `SAMLArtifact`, `SAMLSourceIDArtifact`, `SAML2Artifact`

public class SAML2ArtifactType0004 extends AbstractSAML2Artifact implements SAMLSourceIDArtifact
SAML 2 Type 0x004 Artifact. SAML 2, type 4, artifacts contains a 2 byte type code with a value of 4 follwed by a 2 byte endpoint index followed by a 20 byte source ID followed by a 20 byte message handle.

## Field Summary

Fields
Modifier and Type
Field
Description
`private byte[]`
`messageHandle`
20 byte message handle.
`private byte[]`
`sourceID`
20 byte artifact source ID.
`static final byte[]`
`TYPE_CODE`
SAML 2 artifact type code (0x0004).

## Constructor Summary

Constructors
Constructor
Description
`SAML2ArtifactType0004()`
Constructor.
`SAML2ArtifactType0004(byte[] endpointIndex, byte[] source, byte[] handle)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`getMessageHandle()`
Gets the 20 byte message handle of the artifact.
`byte[]`
`getRemainingArtifact()`
Gets the artifact bytes minus the type code.
`byte[]`
`getSourceID()`
Gets the 20 byte source ID of the artifact.
`static SAML2ArtifactType0004`
`parseArtifact(byte[] artifact)`
Constructs a SAML 2 artifact from its byte array representation.
`void`
`setMessageHandle(byte[] handle)`
Sets the 20 byte message handle of the artifact.
`void`
`setSourceID(byte[] newSourceID)`
Sets the 20 byte source ID of the artifact.

### Methods inherited from class org.opensaml.saml.saml2.binding.artifact.AbstractSAML2Artifact

`getArtifactBytes, getEndpointIndex, setEndpointIndex`

### Methods inherited from class org.opensaml.saml.common.binding.artifact.AbstractSAMLArtifact

`base64Encode, equals, getTypeCode, hashCode, hexEncode, setTypeCode, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.opensaml.saml.common.binding.artifact.SAMLArtifact

`getArtifactBytes, getTypeCode`

## Field Details

### TYPE_CODE

@Nonnull public static final byte[] TYPE_CODE
SAML 2 artifact type code (0x0004).

### sourceID

@Nonnull private byte[] sourceID
20 byte artifact source ID.

### messageHandle

@Nonnull private byte[] messageHandle
20 byte message handle.

## Constructor Details

### SAML2ArtifactType0004

public SAML2ArtifactType0004()
Constructor.

### SAML2ArtifactType0004

public SAML2ArtifactType0004(@Nonnull byte[] endpointIndex, @Nonnull byte[] source, @Nonnull byte[] handle)
Constructor.

Parameters:
  `endpointIndex` - 2 byte endpoint index of the artifact
  `source` - 20 byte source ID of the artifact
  `handle` - 20 byte message handle of the artifact
Throws:
  `IllegalArgumentException` - thrown if the endpoint index, source ID, or message handle arrays are not of the right size

## Method Details

### parseArtifact

public static SAML2ArtifactType0004 parseArtifact(byte[] artifact)
Constructs a SAML 2 artifact from its byte array representation.

Parameters:
  `artifact` - the byte array representing the artifact
Returns:
  the type 0x0004 artifact created from the byte array
Throws:
  `IllegalArgumentException` - thrown if the artifact is not the right type or length (44 bytes)

### getSourceID

@Nonnull public byte[] getSourceID()
Gets the 20 byte source ID of the artifact.

Specified by:
  `getSourceID` in interface `SAMLSourceIDArtifact`
Returns:
  the source ID of the artifact

### setSourceID

public void setSourceID(byte[] newSourceID)
Sets the 20 byte source ID of the artifact.

Parameters:
  `newSourceID` - 20 byte source ID of the artifact
Throws:
  `IllegalArgumentException` - thrown if the given source ID is not 20 bytes

### getMessageHandle

@Nonnull public byte[] getMessageHandle()
Gets the 20 byte message handle of the artifact.

Returns:
  20 byte message handle of the artifact

### setMessageHandle

public void setMessageHandle(byte[] handle)
Sets the 20 byte message handle of the artifact.

Parameters:
  `handle` - 20 byte message handle of the artifact

### getRemainingArtifact

@Nonnull public byte[] getRemainingArtifact()
Gets the artifact bytes minus the type code.

Specified by:
  `getRemainingArtifact` in class `AbstractSAMLArtifact`
Returns:
  artifact bytes minus the type code