@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        val entityId = getEntityIdFromRequest(requestContext);
        if (StringUtils.isBlank(entityId)) {
            LOGGER.debug("No entity id found for parameter [{}]", this.entityIdParameterName);
            return success();
        }
        LOGGER.debug("Located entity id [{}] from request", entityId);
        if (!MetadataUIUtils.isMetadataFoundForEntityId(metadataAdapter, entityId)) {
            LOGGER.debug("Metadata is not found for entity [{}] and CAS service registry is consulted for the entity definition", entityId);
            val registeredService = getRegisteredServiceFromRequest(requestContext, entityId);
            LOGGER.debug("Registered service definition linked to [{}] is found as [{}]", entityId, registeredService);
            verifyRegisteredService(requestContext, registeredService);
            loadSamlMetadataIntoRequestContext(requestContext, entityId, registeredService);
        } else {
            LOGGER.debug("Metadata is found for entity [{}]", entityId);
            val registeredService = getRegisteredServiceFromRequest(requestContext);
            LOGGER.debug("Registered service definition linked to [{}] is found as [{}]", entityId, registeredService);
            verifyRegisteredService(requestContext, registeredService);
            loadSamlMetadataIntoRequestContext(requestContext, entityId, registeredService);
        }

        return success();
    }
This is {@link SamlMetadataUIParserAction} that attempts to parse
the MDUI extension block for a SAML SP from the provided metadata locations.
The result is put into the flow request context. The entity id parameter is
specified by default at {@link org.apereo.cas.support.saml.SamlProtocolConstants#PARAMETER_ENTITY_ID}.
<p>This action is best suited to be invoked when the CAS login page
is about to render so that the page, once the MDUI info is obtained,
has a chance to populate the UI with relevant info about the SP.</p>

@author Misagh Moayyed
@since 4.1.0
support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java