public static Set<Event> evaluateEventForProviderInContext(final Principal principal,
                                                               final RegisteredService registeredService,
                                                               final Service service,
                                                               final Optional<RequestContext> context,
                                                               final MultifactorAuthenticationProvider provider) {
        LOGGER.debug("Attempting check for availability of multifactor authentication provider [{}] for [{}]", provider, registeredService);
        if (provider != null) {
            LOGGER.debug("Provider [{}] is successfully verified", provider);
            val id = provider.getId();
            val eventAttrMap = MultifactorAuthenticationUtils.buildEventAttributeMap(principal,
                Optional.ofNullable(service), Optional.ofNullable(registeredService), provider);
            val event = MultifactorAuthenticationUtils.validateEventIdForMatchingTransitionInContext(id, context, eventAttrMap);
            return CollectionUtils.wrapSet(event);
        }
        LOGGER.debug("Provider could not be verified");
        return new HashSet<>();
    }
Evaluate event for provider in context set.

@param principal         the principal
@param registeredService the service
@param service           the service
@param context           the context
@param provider          the provider
@return the set
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationUtils.java