Search in sources :

Example 1 with EnvironmentDependentProviderFactory

use of org.keycloak.provider.EnvironmentDependentProviderFactory in project keycloak by keycloak.

the class FeatureDeployerUtil method loadEnabledEnvironmentFactories.

private static Map<ProviderFactory, Spi> loadEnabledEnvironmentFactories() {
    KeycloakDeploymentInfo di = KeycloakDeploymentInfo.create().services();
    ClassLoader classLoader = DefaultKeycloakSession.class.getClassLoader();
    DefaultProviderLoader loader = new DefaultProviderLoader(di, classLoader);
    Map<ProviderFactory, Spi> providerFactories = new HashMap<>();
    for (Spi spi : loader.loadSpis()) {
        List<ProviderFactory> currentFactories = loader.load(spi);
        for (ProviderFactory factory : currentFactories) {
            if (factory instanceof EnvironmentDependentProviderFactory) {
                if (((EnvironmentDependentProviderFactory) factory).isSupported()) {
                    providerFactories.put(factory, spi);
                }
            }
        }
    }
    return providerFactories;
}
Also used : KeycloakDeploymentInfo(org.keycloak.provider.KeycloakDeploymentInfo) DefaultProviderLoader(org.keycloak.provider.DefaultProviderLoader) EnvironmentDependentProviderFactory(org.keycloak.provider.EnvironmentDependentProviderFactory) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) EnvironmentDependentProviderFactory(org.keycloak.provider.EnvironmentDependentProviderFactory) ProviderFactory(org.keycloak.provider.ProviderFactory) Spi(org.keycloak.provider.Spi)

Aggregations

HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 DefaultProviderLoader (org.keycloak.provider.DefaultProviderLoader)1 EnvironmentDependentProviderFactory (org.keycloak.provider.EnvironmentDependentProviderFactory)1 KeycloakDeploymentInfo (org.keycloak.provider.KeycloakDeploymentInfo)1 ProviderFactory (org.keycloak.provider.ProviderFactory)1 Spi (org.keycloak.provider.Spi)1