public static Optional<MultifactorAuthenticationProvider> resolveProvider(
        final Map<String, MultifactorAuthenticationProvider> providers,
        final Collection<String> requestMfaMethod) {
        return providers.values()
            .stream()
            .filter(provider -> requestMfaMethod.stream().filter(Objects::nonNull).anyMatch(provider::matches))
            .findFirst();
    }
Resolve provider optional.

@param providers        the providers
@param requestMfaMethod the request mfa method
@return the optional
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationUtils.java