Package org.keycloak.services
Class DefaultKeycloakSession
java.lang.Object
org.keycloak.services.DefaultKeycloakSession
- All Implemented Interfaces:
AutoCloseable,KeycloakSession
- Author:
- Stian Thorgersen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClient Policy Managerclients()Returns a managed provider instance.Returns a managed provider instance.voidclose()protected RuntimeExceptionprotected abstract DefaultKeycloakContextcreateKeycloakContext(KeycloakSession session) voidenlistForClose(Provider provider) getAllProviders(Class<T> clazz) getAttribute(String attribute) <T> TgetAttribute(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 .voidinvalidate(InvalidationHandler.InvalidableObjectType type, Object... ids) Invalidates intermediate states of the given objects, both immediately and at the end of this session.booleanisClosed()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.voidsetAttribute(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, waitMethods inherited from interface org.keycloak.models.KeycloakSession
getAttributeOrDefault
-
Constructor Details
-
DefaultKeycloakSession
-
-
Method Details
-
getContext
- Specified by:
getContextin interfaceKeycloakSession
-
invalidate
Description copied from interface:KeycloakSessionInvalidates intermediate states of the given objects, both immediately and at the end of this session.- Specified by:
invalidatein interfaceKeycloakSession- Parameters:
type- Type of the objects to invalidateids- Parameters used for the invalidation
-
enlistForClose
- Specified by:
enlistForClosein interfaceKeycloakSession
-
getAttribute
- Specified by:
getAttributein interfaceKeycloakSession
-
getAttribute
- Specified by:
getAttributein interfaceKeycloakSession
-
removeAttribute
- Specified by:
removeAttributein interfaceKeycloakSession
-
setAttribute
- Specified by:
setAttributein interfaceKeycloakSession
-
getAttributes
- Specified by:
getAttributesin interfaceKeycloakSession
-
getTransactionManager
- Specified by:
getTransactionManagerin interfaceKeycloakSession
-
getKeycloakSessionFactory
- Specified by:
getKeycloakSessionFactoryin interfaceKeycloakSession
-
users
Description copied from interface:KeycloakSessionA cached view of all users in system including users loaded by UserStorageProviders- Specified by:
usersin interfaceKeycloakSession- Returns:
- UserProvider instance
-
getProvider
Description copied from interface:KeycloakSessionGet 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:
getProviderin interfaceKeycloakSession- Returns:
-
getProvider
Description copied from interface:KeycloakSessionGet 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:
getProviderin interfaceKeycloakSession- Returns:
-
getComponentProvider
Description copied from interface:KeycloakSessionReturns 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:
getComponentProviderin interfaceKeycloakSessioncomponentId- Component configuration- Returns:
- Provider configured according to the ,
nullif it cannot be instantiated.
-
getComponentProvider
public <T extends Provider> T getComponentProvider(Class<T> clazz, String componentId, Function<KeycloakSessionFactory, ComponentModel> modelGetter) Description copied from interface:KeycloakSessionReturns 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:
getComponentProviderin interfaceKeycloakSessioncomponentId- Component configurationmodelGetter- Getter to retrieve componentModel- Returns:
- Provider configured according to the ,
nullif it cannot be instantiated.
-
getProvider
- Specified by:
getProviderin interfaceKeycloakSession- Returns:
-
listProviderIds
Description copied from interface:KeycloakSessionGet all provider factories that manage provider instances of class.- Specified by:
listProviderIdsin interfaceKeycloakSession- Returns:
-
getAllProviders
- Specified by:
getAllProvidersin interfaceKeycloakSession
-
getProviderClass
- Specified by:
getProviderClassin interfaceKeycloakSession
-
realms
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
realmsin interfaceKeycloakSession- Returns:
-
clients
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
clientsin interfaceKeycloakSession- Returns:
-
clientScopes
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
clientScopesin interfaceKeycloakSession- Returns:
- Currently used ClientScopeProvider instance.
-
groups
Description copied from interface:KeycloakSessionReturns a managed group provider instance.- Specified by:
groupsin interfaceKeycloakSession- Returns:
- Currently used GroupProvider instance.
-
roles
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
rolesin interfaceKeycloakSession- Returns:
-
sessions
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
sessionsin interfaceKeycloakSession- Returns:
-
loginFailures
Description copied from interface:KeycloakSessionReturns a managed provider instance. Will start a provider transaction. This transaction is managed by the KeycloakSession transaction.- Specified by:
loginFailuresin interfaceKeycloakSession- Returns:
UserLoginFailureProvider
-
authenticationSessions
- Specified by:
authenticationSessionsin interfaceKeycloakSession
-
singleUseObjects
- Specified by:
singleUseObjectsin interfaceKeycloakSession
-
identityProviders
Description copied from interface:KeycloakSessionReturns the default IDP provider .- Specified by:
identityProvidersin interfaceKeycloakSession- Returns:
- the default IDP provider.
-
keys
Description copied from interface:KeycloakSessionKey manager- Specified by:
keysin interfaceKeycloakSession- Returns:
-
theme
Description copied from interface:KeycloakSessionTheme manager- Specified by:
themein interfaceKeycloakSession- Returns:
-
tokens
Description copied from interface:KeycloakSessionToken manager- Specified by:
tokensin interfaceKeycloakSession- Returns:
-
vault
Description copied from interface:KeycloakSessionVault transcriber- Specified by:
vaultin interfaceKeycloakSession
-
clientPolicy
Description copied from interface:KeycloakSessionClient Policy Manager- Specified by:
clientPolicyin interfaceKeycloakSession
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceKeycloakSession
-
closeTransactionManager
-
toString
-
createKeycloakContext
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceKeycloakSession
-