@Override
    public BaseMultifactorAuthenticationProviderProperties.MultifactorAuthenticationProviderFailureModes evaluate(
        final RegisteredService service,
        final MultifactorAuthenticationProvider provider) {
        var failureMode = casProperties.getAuthn().getMfa().getCore().getGlobalFailureMode();
        LOGGER.debug("Setting failure mode to [{}] based on global policy", failureMode);

        if (provider != null && provider.getFailureMode() != MultifactorAuthenticationProviderFailureModes.UNDEFINED) {
            LOGGER.debug("Provider [{}] with failure mode [{}] is overriding global mode [{}]",
                provider.getId(), provider.getFailureMode(), failureMode);
            failureMode = provider.getFailureMode();
        }

        if (service != null) {
            val policy = service.getMultifactorAuthenticationPolicy();
            if (policy != null && policy.getFailureMode() != MultifactorAuthenticationProviderFailureModes.UNDEFINED) {
                LOGGER.debug("Service failure mode [{}] overriding current failure mode [{}]", policy.getFailureMode(), failureMode);
                failureMode = policy.getFailureMode();
            }
        }
        return failureMode;
    }
Default implementation of {@link MultifactorAuthenticationFailureModeEvaluator}.

@author Travis Schmidt
@since 6.0.5
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/DefaultMultifactorAuthenticationFailureModeEvaluator.java