protected void preparePeerEntityContext(final MessageDecoder decoder,
                                            final SAML2MessageContext decodedCtx,
                                            final SAMLBindingContext bindingContext,
                                            final EntityDescriptor metadata) {
        val decodedPeerContext = decoder.getMessageContext().getSubcontext(SAMLPeerEntityContext.class);
        CommonHelper.assertNotNull("SAMLPeerEntityContext", bindingContext);

        decodedCtx.getSAMLPeerEntityContext().setEntityId(metadata.getEntityID());
        decodedCtx.getSAMLPeerEntityContext().setAuthenticated(decodedPeerContext != null && decodedPeerContext.isAuthenticated());
    }
<p>preparePeerEntityContext.</p>

@param decoder a {@link AbstractPac4jDecoder} object
@param decodedCtx a {@link SAML2MessageContext} object
@param bindingContext a {@link SAMLBindingContext} object
@param metadata a {@link EntityDescriptor} object
pac4j-saml/src/main/java/org/pac4j/saml/credentials/extractor/SAML2CredentialsExtractor.java