@Override
    public AuthenticationContextValidationResult validateAuthenticationContext(
        final HttpServletRequest request,
        final HttpServletResponse response,
        final RegisteredService registeredService,
        final Authentication authentication,
        final Service service) throws Throwable {
        
        if (registeredService != null && registeredService.getMultifactorAuthenticationPolicy().isBypassEnabled()) {
            LOGGER.debug("Multifactor authentication execution is ignored for [{}]", registeredService.getName());
            return toSuccessfulResult();
        }

        val providerResult = multifactorTriggerSelectionStrategy.resolve(request, response, registeredService, authentication, service);
        if (providerResult.isEmpty()) {
            LOGGER.debug("No authentication context is required for this request");
            return toSuccessfulResult();
        }

        val providers = providerResult
            .map(provider -> {
                if (provider instanceof final ChainingMultifactorAuthenticationProvider chain) {
                    return chain.getMultifactorAuthenticationProviders().stream()
                        .filter(p -> p.equals(provider)).collect(Collectors.toList());
                }
                return List.of(provider);
            })
            .orElseGet(List::of);

        if (providers.stream()
            .map(provider -> validateMultifactorProviderBypass(provider, registeredService, authentication, service, request))
            .allMatch(AuthenticationContextValidationResult::isSuccess)) {
            return toSuccessfulResult();
        }

        LOGGER.debug("Multifactor providers eligible for validation are [{}]", providers);
        return providers.stream()
            .sorted(Comparator.comparing(MultifactorAuthenticationProvider::getOrder))
            .map(provider -> authenticationContextValidator.validate(authentication, provider.getId(),
                Optional.ofNullable(registeredService)))
            .filter(MultifactorAuthenticationContextValidationResult::isSuccess)
            .findAny()
            .map(result -> AuthenticationContextValidationResult.builder()
                .success(result.isSuccess())
                .contextId(result.getProvider().map(MultifactorAuthenticationProvider::getId))
                .build())
            .map(AuthenticationContextValidationResult.class::cast)
            .orElseGet(DefaultRequestedAuthenticationContextValidator::toFailureResult);
    }
This is {@link DefaultRequestedAuthenticationContextValidator}.

@author Misagh Moayyed
@since 6.0.0
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/DefaultRequestedAuthenticationContextValidator.java