Package org.keycloak.models.jpa
Class JpaRealmProvider
java.lang.Object
org.keycloak.models.jpa.JpaRealmProvider
- All Implemented Interfaces:
ClientProvider,ClientScopeProvider,DeploymentStateProvider,GroupProvider,RealmProvider,RoleProvider,Provider,ClientLookupProvider,ClientScopeLookupProvider,GroupLookupProvider,RoleLookupProvider
public class JpaRealmProvider
extends Object
implements RealmProvider, ClientProvider, ClientScopeProvider, GroupProvider, RoleProvider, DeploymentStateProvider
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJpaRealmProvider(KeycloakSession session, jakarta.persistence.EntityManager em, Set<String> clientSearchableAttributes, Set<String> groupSearchableAttributes) -
Method Summary
Modifier and TypeMethodDescriptionaddClient(RealmModel realm, String clientId) addClient(RealmModel realm, String id, String clientId) addClientRole(ClientModel client, String name) addClientRole(ClientModel client, String id, String name) addClientScope(RealmModel realm, String id, String name) voidaddClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) addRealmRole(RealmModel realm, String name) addRealmRole(RealmModel realm, String id, String name) voidaddTopLevelGroup(RealmModel realm, GroupModel subGroup) voidclose()createGroup(RealmModel realm, String id, String name, GroupModel toParent) createRealm(String name) createRealm(String id, String name) booleandeleteLocalizationText(RealmModel realm, String locale, String key) booleandeleteLocalizationTextsByLocale(RealmModel realm, String locale) getClientByClientId(RealmModel realm, String clientId) getClientById(RealmModel realm, String id) getClientRole(ClientModel client, String name) getClientRolesStream(ClientModel client, Integer first, Integer max) getClientScopeById(RealmModel realm, String id) getClientScopes(RealmModel realm, ClientModel client, boolean defaultScope) getClientScopesStream(RealmModel realm) longgetClientsCount(RealmModel realm) getClientsStream(RealmModel realm) getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults) getGroupById(RealmModel realm, String id) getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) getGroupsCount(RealmModel realm, Boolean onlyTopGroups) getGroupsCount(RealmModel realm, Stream<String> ids, String search) getGroupsCountByNameContaining(RealmModel realm, String search) getGroupsStream(RealmModel realm) getGroupsStream(RealmModel realm, Stream<String> ids) getGroupsStream(RealmModel realm, Stream<String> ids, Integer first, Integer max) getGroupsStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) getLocalizationTextsById(RealmModel realm, String locale, String key) getRealmByName(String name) getRealmRole(RealmModel realm, String name) getRealmRolesStream(RealmModel realm) getRealmRolesStream(RealmModel realm, Integer first, Integer max) getRealmsWithProviderTypeStream(Class<?> providerType) getRoleById(RealmModel realm, String id) getRolesStream(jakarta.persistence.TypedQuery<RoleEntity> query, RealmModel realm, Integer first, Integer max) getRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) getTopLevelGroupsStream(RealmModel realm, Integer first, Integer max) voidmoveGroup(RealmModel realm, GroupModel group, GroupModel toParent) voidpreRemove(RealmModel realm, RoleModel role) booleanremoveClient(RealmModel realm, String id) voidremoveClients(RealmModel realm) booleanremoveClientScope(RealmModel realm, String id) voidremoveClientScope(RealmModel realm, ClientModel client, ClientScopeModel clientScope) voidremoveClientScopes(RealmModel realm) voidbooleanremoveGroup(RealmModel realm, GroupModel group) booleanremoveRealm(String id) booleanremoveRole(RoleModel role) voidremoveRoles(ClientModel client) voidremoveRoles(RealmModel realm) roleRemovedEvent(RoleModel role) voidsaveLocalizationText(RealmModel realm, String locale, String key, String text) voidsaveLocalizationTexts(RealmModel realm, String locale, Map<String, String> localizationTexts) searchClientsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max) searchForGroupByNameStream(RealmModel realm, String search, Boolean exact, Integer first, Integer max) searchForRoles(jakarta.persistence.TypedQuery<RoleEntity> query, RealmModel realm, String search, Integer first, Integer max) searchForRolesStream(RealmModel realm, String search, Integer first, Integer max) searchGroupsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) booleanupdateLocalizationText(RealmModel realm, String locale, String key, String text) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.ClientScopeProvider
addClientScopeMethods inherited from interface org.keycloak.storage.group.GroupLookupProvider
searchForGroupByNameStreamMethods inherited from interface org.keycloak.models.GroupProvider
createGroup, createGroup, createGroupMethods inherited from interface org.keycloak.models.RealmProvider
createClientInitialAccessModel, decreaseRemainingCount, getClientInitialAccessModel, listClientInitialAccessStream, removeClientInitialAccessModelMethods inherited from interface org.keycloak.models.RoleProvider
getClientRolesStream
-
Field Details
-
logger
protected static final org.jboss.logging.Logger logger -
em
protected jakarta.persistence.EntityManager em
-
-
Constructor Details
-
JpaRealmProvider
public JpaRealmProvider(KeycloakSession session, jakarta.persistence.EntityManager em, Set<String> clientSearchableAttributes, Set<String> groupSearchableAttributes)
-
-
Method Details
-
getMigrationModel
- Specified by:
getMigrationModelin interfaceDeploymentStateProvider
-
createRealm
- Specified by:
createRealmin interfaceRealmProvider
-
createRealm
- Specified by:
createRealmin interfaceRealmProvider
-
getRealm
- Specified by:
getRealmin interfaceRealmProvider
-
getRealmsWithProviderTypeStream
- Specified by:
getRealmsWithProviderTypeStreamin interfaceRealmProvider
-
getRealmsStream
- Specified by:
getRealmsStreamin interfaceRealmProvider
-
getRealmByName
- Specified by:
getRealmByNamein interfaceRealmProvider
-
removeRealm
- Specified by:
removeRealmin interfaceRealmProvider
-
close
public void close() -
addRealmRole
- Specified by:
addRealmRolein interfaceRoleProvider
-
addRealmRole
- Specified by:
addRealmRolein interfaceRoleProvider
-
getRealmRole
- Specified by:
getRealmRolein interfaceRoleLookupProvider
-
addClientRole
- Specified by:
addClientRolein interfaceRoleProvider
-
addClientRole
- Specified by:
addClientRolein interfaceRoleProvider
-
getRealmRolesStream
- Specified by:
getRealmRolesStreamin interfaceRoleProvider
-
getClientRole
- Specified by:
getClientRolein interfaceRoleLookupProvider
-
getAllRedirectUrisOfEnabledClients
- Specified by:
getAllRedirectUrisOfEnabledClientsin interfaceClientProvider
-
getRealmRolesStream
- Specified by:
getRealmRolesStreamin interfaceRoleProvider
-
getRolesStream
public Stream<RoleModel> getRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) - Specified by:
getRolesStreamin interfaceRoleProvider
-
getClientRolesStream
- Specified by:
getClientRolesStreamin interfaceRoleProvider
-
getRolesStream
protected Stream<RoleModel> getRolesStream(jakarta.persistence.TypedQuery<RoleEntity> query, RealmModel realm, Integer first, Integer max) -
searchForClientRolesStream
public Stream<RoleModel> searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max) - Specified by:
searchForClientRolesStreamin interfaceRoleLookupProvider
-
searchForRolesStream
public Stream<RoleModel> searchForRolesStream(RealmModel realm, String search, Integer first, Integer max) - Specified by:
searchForRolesStreamin interfaceRoleLookupProvider
-
searchForRoles
protected Stream<RoleModel> searchForRoles(jakarta.persistence.TypedQuery<RoleEntity> query, RealmModel realm, String search, Integer first, Integer max) -
removeRole
- Specified by:
removeRolein interfaceRoleProvider
-
roleRemovedEvent
-
removeRoles
- Specified by:
removeRolesin interfaceRoleProvider
-
removeRoles
- Specified by:
removeRolesin interfaceRoleProvider
-
getRoleById
- Specified by:
getRoleByIdin interfaceRoleLookupProvider
-
getGroupById
- Specified by:
getGroupByIdin interfaceGroupLookupProvider
-
moveGroup
- Specified by:
moveGroupin interfaceGroupProvider
-
getGroupsStream
- Specified by:
getGroupsStreamin interfaceGroupProvider
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) - Specified by:
getGroupsStreamin interfaceGroupProvider
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids, Integer first, Integer max) - Specified by:
getGroupsStreamin interfaceGroupProvider
-
getGroupsStream
- Specified by:
getGroupsStreamin interfaceGroupProvider
-
getGroupsCount
- Specified by:
getGroupsCountin interfaceGroupProvider
-
getGroupsCount
- Specified by:
getGroupsCountin interfaceGroupProvider
-
getClientsCount
- Specified by:
getClientsCountin interfaceClientProvider
-
getGroupsCountByNameContaining
- Specified by:
getGroupsCountByNameContainingin interfaceGroupProvider
-
getGroupsByRoleStream
public Stream<GroupModel> getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) - Specified by:
getGroupsByRoleStreamin interfaceGroupProvider
-
getTopLevelGroupsStream
- Specified by:
getTopLevelGroupsStreamin interfaceGroupProvider
-
getTopLevelGroupsStream
- Specified by:
getTopLevelGroupsStreamin interfaceGroupProvider
-
removeGroup
- Specified by:
removeGroupin interfaceGroupProvider
-
createGroup
- Specified by:
createGroupin interfaceGroupProvider
-
addTopLevelGroup
- Specified by:
addTopLevelGroupin interfaceGroupProvider
-
preRemove
-
addClient
- Specified by:
addClientin interfaceClientProvider
-
addClient
- Specified by:
addClientin interfaceClientProvider
-
getClientsStream
- Specified by:
getClientsStreamin interfaceClientProvider
-
getClientsStream
public Stream<ClientModel> getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults) - Specified by:
getClientsStreamin interfaceClientProvider
-
getAlwaysDisplayInConsoleClientsStream
- Specified by:
getAlwaysDisplayInConsoleClientsStreamin interfaceClientProvider
-
getClientById
- Specified by:
getClientByIdin interfaceClientLookupProvider
-
getClientByClientId
- Specified by:
getClientByClientIdin interfaceClientLookupProvider
-
searchClientsByClientIdStream
public Stream<ClientModel> searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByClientIdStreamin interfaceClientLookupProvider
-
searchClientsByAttributes
public Stream<ClientModel> searchClientsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByAttributesin interfaceClientLookupProvider
-
removeClients
- Specified by:
removeClientsin interfaceClientProvider
-
removeClient
- Specified by:
removeClientin interfaceClientProvider
-
getClientScopeById
- Specified by:
getClientScopeByIdin interfaceClientScopeLookupProvider
-
getClientScopesStream
- Specified by:
getClientScopesStreamin interfaceClientScopeProvider
-
addClientScope
- Specified by:
addClientScopein interfaceClientScopeProvider
-
removeClientScope
- Specified by:
removeClientScopein interfaceClientScopeProvider
-
removeClientScopes
- Specified by:
removeClientScopesin interfaceClientScopeProvider
-
addClientScopes
public void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) - Specified by:
addClientScopesin interfaceClientProvider
-
removeClientScope
- Specified by:
removeClientScopein interfaceClientProvider
-
getClientScopes
public Map<String,ClientScopeModel> getClientScopes(RealmModel realm, ClientModel client, boolean defaultScope) - Specified by:
getClientScopesin interfaceClientLookupProvider
-
searchForGroupByNameStream
public Stream<GroupModel> searchForGroupByNameStream(RealmModel realm, String search, Boolean exact, Integer first, Integer max) - Specified by:
searchForGroupByNameStreamin interfaceGroupLookupProvider
-
searchGroupsByAttributes
public Stream<GroupModel> searchGroupsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) - Specified by:
searchGroupsByAttributesin interfaceGroupLookupProvider
-
removeExpiredClientInitialAccess
public void removeExpiredClientInitialAccess()- Specified by:
removeExpiredClientInitialAccessin interfaceRealmProvider
-
updateLocalizationText
- Specified by:
updateLocalizationTextin interfaceRealmProvider
-
saveLocalizationText
- Specified by:
saveLocalizationTextin interfaceRealmProvider
-
saveLocalizationTexts
public void saveLocalizationTexts(RealmModel realm, String locale, Map<String, String> localizationTexts) - Specified by:
saveLocalizationTextsin interfaceRealmProvider
-
deleteLocalizationTextsByLocale
- Specified by:
deleteLocalizationTextsByLocalein interfaceRealmProvider
-
getLocalizationTextsById
- Specified by:
getLocalizationTextsByIdin interfaceRealmProvider
-
deleteLocalizationText
- Specified by:
deleteLocalizationTextin interfaceRealmProvider
-
getClientSearchableAttributes
-