Search in sources :

Example 1 with DefaultProviderLoader

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

the class FeatureDeployerUtil method loadFactories.

private static void loadFactories(ProviderManager pm) {
    KeycloakDeploymentInfo di = KeycloakDeploymentInfo.create().services();
    ClassLoader classLoader = DefaultKeycloakSession.class.getClassLoader();
    DefaultProviderLoader loader = new DefaultProviderLoader(di, classLoader);
    loader.loadSpis().forEach(pm::load);
}
Also used : KeycloakDeploymentInfo(org.keycloak.provider.KeycloakDeploymentInfo) DefaultProviderLoader(org.keycloak.provider.DefaultProviderLoader)

Example 2 with DefaultProviderLoader

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

the class ModuleProviderLoaderFactory method create.

@Override
public ProviderLoader create(KeycloakDeploymentInfo info, ClassLoader baseClassLoader, String resource) {
    try {
        Module module = Module.getContextModuleLoader().loadModule(ModuleIdentifier.fromString(resource));
        ModuleClassLoader classLoader = module.getClassLoader();
        return new DefaultProviderLoader(info, classLoader);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DefaultProviderLoader(org.keycloak.provider.DefaultProviderLoader) ModuleClassLoader(org.jboss.modules.ModuleClassLoader) Module(org.jboss.modules.Module)

Example 3 with DefaultProviderLoader

use of org.keycloak.provider.DefaultProviderLoader 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

DefaultProviderLoader (org.keycloak.provider.DefaultProviderLoader)3 KeycloakDeploymentInfo (org.keycloak.provider.KeycloakDeploymentInfo)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Module (org.jboss.modules.Module)1 ModuleClassLoader (org.jboss.modules.ModuleClassLoader)1 EnvironmentDependentProviderFactory (org.keycloak.provider.EnvironmentDependentProviderFactory)1 ProviderFactory (org.keycloak.provider.ProviderFactory)1 Spi (org.keycloak.provider.Spi)1