protected Set<Event> handlePossibleSuspiciousAttempt(final HttpServletRequest request, final Authentication authentication,
        final RegisteredService service) throws Throwable {

        val applicationContext = getConfigurationContext().getApplicationContext();
        val clientInfo = ClientInfoHolder.getClientInfo();
        applicationContext.publishEvent(new CasRiskBasedAuthenticationEvaluationStartedEvent(this, authentication, service, clientInfo));

        LOGGER.debug("Evaluating possible suspicious authentication attempt for [{}]", authentication.getPrincipal());
        val score = authenticationRiskEvaluator.evaluate(authentication, service, clientInfo);

        if (authenticationRiskEvaluator.isRiskyAuthenticationScore(score, authentication, service)) {
            applicationContext.publishEvent(new CasRiskyAuthenticationDetectedEvent(this, authentication, service, score, clientInfo));
            LOGGER.debug("Calculated risk score [{}] for authentication request by [{}] is above the risk threshold",
                score.getScore(), authentication.getPrincipal());
            applicationContext.publishEvent(new CasRiskBasedAuthenticationMitigationStartedEvent(this, authentication, service, score, clientInfo));
            val res = authenticationRiskMitigator.mitigate(authentication, service, score, request);
            applicationContext.publishEvent(new CasRiskyAuthenticationMitigatedEvent(this, authentication, service, res, clientInfo));
            return CollectionUtils.wrapSet(res.result());
        }

        LOGGER.debug("Authentication request for [{}] is below the risk threshold", authentication.getPrincipal());
        return null;
    }
This is {@link RiskAwareAuthenticationWebflowEventResolver}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-electrofence/src/main/java/org/apereo/cas/web/flow/RiskAwareAuthenticationWebflowEventResolver.java