protected Set<Event> determineMultifactorAuthenticationEvent(final Optional<RequestContext> context,
                                                                 final RegisteredService registeredService,
                                                                 final Service service,
                                                                 final Principal principal) {
        val globalPrincipalAttributeValueRegex = casProperties.getAuthn().getMfa()
            .getTriggers().getPrincipal().getGlobalPrincipalAttributeValueRegex();
        val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(applicationContext);
        val providers = providerMap.values();
        if (providers.size() == 1 && StringUtils.isNotBlank(globalPrincipalAttributeValueRegex)) {
            return resolveSingleMultifactorProvider(context, registeredService, service, principal, providers);
        }

        return resolveMultifactorProviderViaPredicate(context, registeredService, service, principal, providers);
    }
This is {@link PrincipalAttributeMultifactorAuthenticationTrigger}.

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