@Override
    public Optional<MultifactorAuthenticationProvider> isActivated(final Authentication authentication,
                                                                   final RegisteredService registeredService,
                                                                   final HttpServletRequest request,
                                                                   final HttpServletResponse response,
                                                                   final Service service) {
        val context = contextProvider.getObject();
        val webContext = new JEEContext(request, response);
        val result = SamlIdPSessionManager.of(context.getOpenSamlConfigBean(), context.getSessionStore()).fetch(webContext, AuthnRequest.class);
        val mappings = getAuthenticationContextMappings();
        return result
            .filter(pair -> registeredService instanceof SamlRegisteredService && pair.getLeft() instanceof AuthnRequest)
            .filter(pair -> isAuthnRequestSigned((SamlRegisteredService) registeredService, request, (AuthnRequest) pair.getLeft(), pair.getRight(), context))
            .map(pair -> (AuthnRequest) pair.getLeft())
            .flatMap(authnRequest -> authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs()
                .stream()
                .filter(Objects::nonNull)
                .filter(ref -> StringUtils.isNotBlank(ref.getURI()))
                .filter(ref -> {
                    val clazz = ref.getURI();
                    return mappings.containsKey(clazz);
                })
                .findFirst()
                .map(mapped -> mappings.get(mapped.getURI())))
            .flatMap(id -> {
                val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(
                    context.getOpenSamlConfigBean().getApplicationContext());
                return MultifactorAuthenticationUtils.resolveProvider(providerMap, id);
            });
    }
This is {@link SamlIdPMultifactorAuthenticationTrigger}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/web/SamlIdPMultifactorAuthenticationTrigger.java