public SAMLObject resolveArtifact(SAMLMessageContext context, String artifactId, String endpointURI) throws MessageDecodingException {
try {
// Decode artifact.
SAML2ArtifactType0004 decodedArtifact = new SAML2ArtifactType0004Builder().buildArtifact(Base64.decode(artifactId));
// Endpoint index.
int endpointIndex = parseEndpointIndex(decodedArtifact.getEndpointIndex());
// Locate sender using the artifact sourceID