Package org.opensaml.saml.saml1.binding.artifact

# Class SAML1ArtifactType0002

java.lang.Object
org.opensaml.saml.common.binding.artifact.AbstractSAMLArtifact
org.opensaml.saml.saml1.binding.artifact.AbstractSAML1Artifact
org.opensaml.saml.saml1.binding.artifact.SAML1ArtifactType0002

All Implemented Interfaces:
  `SAMLArtifact`, `SAMLSourceLocationArtifact`, `SAML1Artifact`

public class SAML1ArtifactType0002 extends AbstractSAML1Artifact implements SAMLSourceLocationArtifact
SAML 1 Type 0x0002 Artifact. SAML 1, type 2, artifacts contains a 2 byte type code with a value of 1 followed by a 20 byte assertion handle followed by an unspecified number of bytes which are a UTF-8 encoded source location string.

## Field Summary

Fields
Modifier and Type
Field
Description
`private byte[]`
`assertionHandle`
20 byte assertion handle.
`private String`
`sourceLocation`
Artifact source location component.
`static final byte[]`
`TYPE_CODE`
Artifact type code (0x0002).

## Constructor Summary

Constructors
Constructor
Description
`SAML1ArtifactType0002()`
Constructor.
`SAML1ArtifactType0002(byte[] handle, String location)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`getAssertionHandle()`
Gets the artifiact's 20 byte assertion handle.
`byte[]`
`getRemainingArtifact()`
Gets the artifact bytes minus the type code.
`String`
`getSourceLocation()`
Gets the source location component of this artifact.
`static SAML1ArtifactType0002`
`parseArtifact(byte[] artifact)`
Constructs a SAML 1 artifact from its byte representation.
`void`
`setAssertionHandle(byte[] handle)`
Sets the artifiact's 20 byte assertion handle.
`protected void`
`setSourceLocation(String newLocation)`
Sets source location component of this artifact.

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

`base64Encode, equals, getArtifactBytes, 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
Artifact type code (0x0002).

### assertionHandle

@Nonnull private byte[] assertionHandle
20 byte assertion handle.

### sourceLocation

@Nonnull private String sourceLocation
Artifact source location component.

## Constructor Details

### SAML1ArtifactType0002

public SAML1ArtifactType0002()
Constructor.

### SAML1ArtifactType0002

public SAML1ArtifactType0002(@Nonnull byte[] handle, @Nonnull String location)
Constructor.

Parameters:
  `handle` - 20 byte assertion handle artifact component
  `location` - source location artifact component
Throws:
  `IllegalArgumentException` - thrown if the given assertion handle is not 20 bytes or the source location is null or empty

## Method Details

### parseArtifact

public static SAML1ArtifactType0002 parseArtifact(byte[] artifact)
Constructs a SAML 1 artifact from its byte representation.

Parameters:
  `artifact` - the byte array representing the artifact
Returns:
  the artifact parsed from the byte representation
Throws:
  `IllegalArgumentException` - thrown if the artifact type is not 0x0002

### getAssertionHandle

@Nonnull public byte[] getAssertionHandle()
Gets the artifiact's 20 byte assertion handle.

Returns:
  artifiact's 20 byte assertion handle

### setAssertionHandle

public void setAssertionHandle(@Nonnull byte[] handle)
Sets the artifiact's 20 byte assertion handle.

Parameters:
  `handle` - artifiact's 20 byte assertion handle

### getSourceLocation

@Nonnull public String getSourceLocation()
Gets the source location component of this artifact.

Specified by:
  `getSourceLocation` in interface `SAMLSourceLocationArtifact`
Returns:
  source location component of this artifact

### setSourceLocation

protected void setSourceLocation(@Nonnull String newLocation)
Sets source location component of this artifact.

Parameters:
  `newLocation` - source location component of this artifact
Throws:
  `IllegalArgumentException` - thrown if the given location is empty or null

### 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