protected SAML2MessageContext prepareDecodedContext(final SAML2MessageContext context, final AbstractPac4jDecoder decoder) {
        val decodedCtx = new SAML2MessageContext(decoder.getCallContext());
        decodedCtx.setSaml2Configuration(saml2Configuration);

        decodedCtx.setMessageContext(decoder.getMessageContext());
        val message = (SAMLObject) decoder.getMessageContext().getMessage();
        if (message == null) {
            throw new SAMLException("Response from the context cannot be null");
        }
        decodedCtx.getMessageContext().setMessage(message);
        context.getMessageContext().setMessage(message);
        decodedCtx.setSamlMessageStore(context.getSamlMessageStore());

        val bindingContext = prepareBindingContext(context, decoder, decodedCtx);

        val metadata = context.getSAMLPeerMetadataContext().getEntityDescriptor();
        if (metadata == null) {
            throw new SAMLException("IDP Metadata cannot be null");
        }

        preparePeerEntityContext(decoder, decodedCtx, bindingContext, metadata);
        prepareSelfEntityContext(context, decodedCtx);

        decodedCtx.getSAMLSelfMetadataContext().setRoleDescriptor(context.getSPSSODescriptor());
        return decodedCtx;
    }
<p>prepareDecodedContext.</p>

@param context a {@link SAML2MessageContext} object
@param decoder a {@link AbstractPac4jDecoder} object
@return a {@link SAML2MessageContext} object
pac4j-saml/src/main/java/org/pac4j/saml/credentials/extractor/SAML2CredentialsExtractor.java