public Collection<MultifactorAuthenticationProvider> getMultifactorAuthenticationProviderForService(
        final RegisteredService service,
        final ApplicationContext applicationContext) {
        return Optional.ofNullable(service.getMultifactorAuthenticationPolicy())
            .map(policy -> policy.getMultifactorAuthenticationProviders()
                .stream()
                .map(provider ->
                    MultifactorAuthenticationUtils.getMultifactorAuthenticationProviderFromApplicationContext(provider, applicationContext))
                .filter(Optional::isPresent)
                .map(Optional::get)
                .collect(Collectors.toSet()))
            .orElseGet(HashSet::new);
    }
Gets authentication provider for service.

@param service            the service
@param applicationContext the application context
@return the authentication provider for service
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationUtils.java