Class ImportKeycloakSession
java.lang.Object
org.keycloak.models.map.datastore.ImportKeycloakSession
- All Implemented Interfaces:
AutoCloseable
,KeycloakSession
This implementation of
KeycloakSession
wraps an existing session and directs all calls to the datastore provider
to a separate KeycloakSessionFactory
.
This allows it to create instantiate different storage providers during import.- Author:
- Alexander Schwartz
-
Constructor Summary
ConstructorDescriptionImportKeycloakSession
(ImportSessionFactoryWrapper factory, KeycloakSession session) -
Method Summary
Modifier and TypeMethodDescriptionClient Policy Managerclients()
Returns a managed provider instance.Returns a managed provider instance.void
close()
void
enlistForClose
(Provider provider) getAllProviders
(Class<T> clazz) getAttribute
(String attribute) <T> T
getAttribute
(String attribute, Class<T> clazz) <T> T
getAttributeOrDefault
(String attribute, T defaultValue) <T extends Provider>
TgetComponentProvider
(Class<T> clazz, String componentId) Returns a component provider for a component from the realm that is relevant to this session.<T extends Provider>
TgetComponentProvider
(Class<T> clazz, String componentId, Function<KeycloakSessionFactory, ComponentModel> modelGetter) Returns a component provider for a component from the realm that is relevant to this session.<T extends Provider>
TgetProvider
(Class<T> clazz) Get dedicated provider instance of provider type clazz that was created for this session.<T extends Provider>
TgetProvider
(Class<T> clazz, String id) Get dedicated provider instance for a specific provider factory of id of provider type clazz that was created for this session.<T extends Provider>
TgetProvider
(Class<T> clazz, ComponentModel componentModel) getProviderClass
(String providerClassName) groups()
Returns a managed group provider instance.void
invalidate
(InvalidationHandler.InvalidableObjectType type, Object... ids) Invalidates intermediate states of the given objects, both immediately and at the end of this session.keys()
Key managerlistProviderIds
(Class<T> clazz) Get all provider factories that manage provider instances of class.Returns a managed provider instance.realms()
Returns a managed provider instance.removeAttribute
(String attribute) roles()
Returns a managed provider instance.sessions()
Returns a managed provider instance.void
setAttribute
(String name, Object value) theme()
Theme managertokens()
Token managerusers()
A cached view of all users in system including users loaded by UserStorageProvidersvault()
Vault transcriber
-
Constructor Details
-
ImportKeycloakSession
-
-
Method Details
-
getContext
- Specified by:
getContext
in interfaceKeycloakSession
-
getTransactionManager
- Specified by:
getTransactionManager
in interfaceKeycloakSession
-
getProvider
Description copied from interface:KeycloakSession
Get dedicated provider instance of provider type clazz that was created for this session. If one hasn't been created yet, find the factory and allocate by calling ProviderFactory.create(KeycloakSession). The provider to use is determined by the "provider" config entry in keycloak-server boot configuration. (keycloak-server.json)- Specified by:
getProvider
in interfaceKeycloakSession
- Returns:
-
getProvider
Description copied from interface:KeycloakSession
Get dedicated provider instance for a specific provider factory of id of provider type clazz that was created for this session. If one hasn't been created yet, find the factory and allocate by calling ProviderFactory.create(KeycloakSession).- Specified by:
getProvider
in interfaceKeycloakSession
- Returns:
-
getComponentProvider
Description copied from interface:KeycloakSession
Returns a component provider for a component from the realm that is relevant to this session. The relevant realm must be set prior to calling this method in the context, seeKeycloakContext.getRealm()
.- Specified by:
getComponentProvider
in interfaceKeycloakSession
componentId
- Component configuration- Returns:
- Provider configured according to the ,
null
if it cannot be instantiated.
-
getComponentProvider
public <T extends Provider> T getComponentProvider(Class<T> clazz, String componentId, Function<KeycloakSessionFactory, ComponentModel> modelGetter) Description copied from interface:KeycloakSession
Returns a component provider for a component from the realm that is relevant to this session. The relevant realm must be set prior to calling this method in the context, seeKeycloakContext.getRealm()
.- Specified by:
getComponentProvider
in interfaceKeycloakSession
componentId
- Component configurationmodelGetter
- Getter to retrieve componentModel- Returns:
- Provider configured according to the ,
null
if it cannot be instantiated.
-
getProvider
- Specified by:
getProvider
in interfaceKeycloakSession
- Returns:
-
listProviderIds
Description copied from interface:KeycloakSession
Get all provider factories that manage provider instances of class.- Specified by:
listProviderIds
in interfaceKeycloakSession
- Returns:
-
getAllProviders
- Specified by:
getAllProviders
in interfaceKeycloakSession
-
getProviderClass
- Specified by:
getProviderClass
in interfaceKeycloakSession
-
getAttribute
- Specified by:
getAttribute
in interfaceKeycloakSession
-
getAttribute
- Specified by:
getAttribute
in interfaceKeycloakSession
-
getAttributeOrDefault
- Specified by:
getAttributeOrDefault
in interfaceKeycloakSession
-
removeAttribute
- Specified by:
removeAttribute
in interfaceKeycloakSession
-
setAttribute
- Specified by:
setAttribute
in interfaceKeycloakSession
-
getAttributes
- Specified by:
getAttributes
in interfaceKeycloakSession
-
invalidate
Description copied from interface:KeycloakSession
Invalidates intermediate states of the given objects, both immediately and at the end of this session.- Specified by:
invalidate
in interfaceKeycloakSession
- Parameters:
type
- Type of the objects to invalidateids
- Parameters used for the invalidation
-
enlistForClose
- Specified by:
enlistForClose
in interfaceKeycloakSession
-
getKeycloakSessionFactory
- Specified by:
getKeycloakSessionFactory
in interfaceKeycloakSession
-
realms
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
realms
in interfaceKeycloakSession
- Returns:
-
clients
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
clients
in interfaceKeycloakSession
- Returns:
-
clientScopes
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
clientScopes
in interfaceKeycloakSession
- Returns:
- Currently used ClientScopeProvider instance.
-
groups
Description copied from interface:KeycloakSession
Returns a managed group provider instance.- Specified by:
groups
in interfaceKeycloakSession
- Returns:
- Currently used GroupProvider instance.
-
roles
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
roles
in interfaceKeycloakSession
- Returns:
-
sessions
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
sessions
in interfaceKeycloakSession
- Returns:
-
loginFailures
Description copied from interface:KeycloakSession
Returns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
loginFailures
in interfaceKeycloakSession
- Returns:
UserLoginFailureProvider
-
authenticationSessions
- Specified by:
authenticationSessions
in interfaceKeycloakSession
-
singleUseObjects
- Specified by:
singleUseObjects
in interfaceKeycloakSession
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceKeycloakSession
-
users
Description copied from interface:KeycloakSession
A cached view of all users in system including users loaded by UserStorageProviders- Specified by:
users
in interfaceKeycloakSession
- Returns:
- UserProvider instance
-
keys
Description copied from interface:KeycloakSession
Key manager- Specified by:
keys
in interfaceKeycloakSession
- Returns:
-
theme
Description copied from interface:KeycloakSession
Theme manager- Specified by:
theme
in interfaceKeycloakSession
- Returns:
-
tokens
Description copied from interface:KeycloakSession
Token manager- Specified by:
tokens
in interfaceKeycloakSession
- Returns:
-
vault
Description copied from interface:KeycloakSession
Vault transcriber- Specified by:
vault
in interfaceKeycloakSession
-
clientPolicy
Description copied from interface:KeycloakSession
Client Policy Manager- Specified by:
clientPolicy
in interfaceKeycloakSession
-