use of org.keycloak.component.ComponentFactory in project keycloak by keycloak.
the class ComponentUtil method getComponentFactory.
private static ComponentFactory getComponentFactory(KeycloakSession session, String providerType, String providerId) {
Class<? extends Provider> provider = session.getProviderClass(providerType);
if (provider == null) {
throw new IllegalArgumentException("Invalid provider type '" + providerType + "'");
}
ProviderFactory<? extends Provider> f = session.getKeycloakSessionFactory().getProviderFactory(provider, providerId);
if (f == null) {
throw new IllegalArgumentException("No such provider '" + providerId + "'");
}
ComponentFactory cf = (ComponentFactory) f;
return cf;
}
use of org.keycloak.component.ComponentFactory in project keycloak by keycloak.
the class ComponentUtil method notifyPreRemove.
public static void notifyPreRemove(KeycloakSession session, RealmModel realm, ComponentModel model) {
try {
ComponentFactory factory = getComponentFactory(session, model);
factory.preRemove(session, realm, model);
} catch (IllegalArgumentException iae) {
// We allow to remove broken providers without throwing an exception
logger.warn(iae.getMessage());
}
}
Aggregations