private SAML2Artifact parseArtifact(final String encodedArtifact)
        throws MessageDecodingException {

        //TODO not sure if this handles well bad input.  Determine if can throw an unchecked and handle here.
        try {
            val artifact = artifactBuilderFactory.buildArtifact(encodedArtifact);
            if (artifact == null) {
                throw new MessageDecodingException("Could not build SAML2Artifact instance from encoded artifact");
            }
            return artifact;
        } catch (final Exception e) {
            throw new MessageDecodingException(e);
        }
    }
Parse and decode the supplied encoded artifact string into a {@link SAML2Artifact} instance.

@param encodedArtifact the encoded artifact which was received
@return the decoded artifact instance
@throws MessageDecodingException if the encoded artifact could not be decoded
pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPArtifactDecoder.java