Package org.keycloak.services
Class DefaultKeycloakSession
java.lang.Object
org.keycloak.services.DefaultKeycloakSession
- All Implemented Interfaces:
AutoCloseable
,KeycloakSession
- Author:
- Stian Thorgersen
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClient Policy Managerclients()
Returns a managed provider instance.Returns a managed provider instance.void
close()
protected RuntimeException
protected abstract DefaultKeycloakContext
createKeycloakContext
(KeycloakSession session) void
enlistForClose
(Provider provider) getAllProviders
(Class<T> clazz) getAttribute
(String attribute) <T> T
getAttribute
(String attribute, Class<T> clazz) <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.Returns the default IDP provider .void
invalidate
(InvalidationHandler.InvalidableObjectType type, Object... ids) Invalidates intermediate states of the given objects, both immediately and at the end of this session.boolean
isClosed()
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 managertoString()
users()
A cached view of all users in system including users loaded by UserStorageProvidersvault()
Vault transcriberMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.keycloak.models.KeycloakSession
getAttributeOrDefault
-
Constructor Details
-
DefaultKeycloakSession
-
-
Method Details
-
getContext
- Specified by:
getContext
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
-
getAttribute
- Specified by:
getAttribute
in interfaceKeycloakSession
-
getAttribute
- Specified by:
getAttribute
in interfaceKeycloakSession
-
removeAttribute
- Specified by:
removeAttribute
in interfaceKeycloakSession
-
setAttribute
- Specified by:
setAttribute
in interfaceKeycloakSession
-
getAttributes
- Specified by:
getAttributes
in interfaceKeycloakSession
-
getTransactionManager
- Specified by:
getTransactionManager
in interfaceKeycloakSession
-
getKeycloakSessionFactory
- Specified by:
getKeycloakSessionFactory
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
-
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
-
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
-
identityProviders
Description copied from interface:KeycloakSession
Returns the default IDP provider .- Specified by:
identityProviders
in interfaceKeycloakSession
- Returns:
- the default IDP provider.
-
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
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceKeycloakSession
-
closeTransactionManager
-
toString
-
createKeycloakContext
-
isClosed
public boolean isClosed()- Specified by:
isClosed
in interfaceKeycloakSession
-