default Principal resolvePrincipal(final ApplicationContext applicationContext, final Principal principal) {
        val resolvers = applicationContext.getBeansOfType(MultifactorAuthenticationPrincipalResolver.class).values();
        return resolvers
            .stream()
            .sorted(AnnotationAwareOrderComparator.INSTANCE)
            .filter(resolver -> resolver.supports(principal))
            .findFirst()
            .map(r -> r.resolve(principal))
            .orElseThrow(() -> new IllegalStateException("Unable to resolve principal for multifactor authentication"));
    }
Resolve principal.

@param applicationContext the application context
@param principal          the principal
@return the principal
api/cas-server-core-api-mfa/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationHandler.java