use of org.keycloak.storage.role.RoleStorageProvider in project keycloak by keycloak.
the class RoleStorageManager method getStorageProviderInstance.
public static RoleStorageProvider getStorageProviderInstance(KeycloakSession session, RoleStorageProviderModel model, RoleStorageProviderFactory factory) {
RoleStorageProvider instance = (RoleStorageProvider) session.getAttribute(model.getId());
if (instance != null)
return instance;
instance = factory.create(session, model);
if (instance == null) {
throw new IllegalStateException("RoleStorageProvideFactory (of type " + factory.getClass().getName() + ") produced a null instance");
}
session.enlistForClose(instance);
session.setAttribute(model.getId(), instance);
return instance;
}
use of org.keycloak.storage.role.RoleStorageProvider in project keycloak by keycloak.
the class RoleStorageManager method getStorageProvider.
public static RoleStorageProvider getStorageProvider(KeycloakSession session, RealmModel realm, String componentId) {
ComponentModel model = realm.getComponent(componentId);
if (model == null)
return null;
RoleStorageProviderModel storageModel = new RoleStorageProviderModel(model);
RoleStorageProviderFactory factory = (RoleStorageProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(RoleStorageProvider.class, model.getProviderId());
if (factory == null) {
throw new ModelException("Could not find RoletStorageProviderFactory for: " + model.getProviderId());
}
return getStorageProviderInstance(session, storageModel, factory);
}
Aggregations