@Override
    protected Event doExecuteInternal(final RequestContext requestContext) {
        return FunctionUtils.doUnchecked(() -> {
            val service = serviceSelectionStrategy.resolveService(WebUtils.getService(requestContext));
            if (service != null) {
                val samlService = servicesManager.findServiceBy(service, SamlRegisteredService.class);
                if (samlService != null) {
                    RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(service, samlService);
                    val adaptor = SamlRegisteredServiceMetadataAdaptor.get(resolver, samlService, service.getId());

                    if (adaptor.isEmpty()) {
                        LOGGER.debug("Cannot find SAML2 metadata linked to [{}]. Skipping MDUI...", service.getId());
                        return success();
                    }

                    val mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(adaptor.get().getEntityDescriptor(),
                        service.getId(), samlService, WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext));
                    WebUtils.putServiceUserInterfaceMetadata(requestContext, mdui);
                }
            }
            return success();
        });
    }
This is {@link SamlIdPMetadataUIAction}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/flow/SamlIdPMetadataUIAction.java