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
-
Constructor Summary
ConstructorDescriptionJpaRealmProvider
(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) void
addClientScopes
(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) addRealmRole
(RealmModel realm, String name) addRealmRole
(RealmModel realm, String id, String name) void
addTopLevelGroup
(RealmModel realm, GroupModel subGroup) void
close()
createGroup
(RealmModel realm, String id, String name, GroupModel toParent) createRealm
(String name) createRealm
(String id, String name) boolean
deleteLocalizationText
(RealmModel realm, String locale, String key) boolean
deleteLocalizationTextsByLocale
(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) long
getClientsCount
(RealmModel realm) getClientsStream
(RealmModel realm) getClientsStream
(RealmModel realm, Integer firstResult, Integer maxResults) getGroupById
(RealmModel realm, String id) getGroupByName
(RealmModel realm, GroupModel parent, String name) 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, String search, Boolean exact, Integer firstResult, Integer maxResults) void
moveGroup
(RealmModel realm, GroupModel group, GroupModel toParent) void
preRemove
(RealmModel realm, RoleModel role) boolean
removeClient
(RealmModel realm, String id) void
removeClients
(RealmModel realm) boolean
removeClientScope
(RealmModel realm, String id) void
removeClientScope
(RealmModel realm, ClientModel client, ClientScopeModel clientScope) void
removeClientScopes
(RealmModel realm) void
boolean
removeGroup
(RealmModel realm, GroupModel group) boolean
removeRealm
(String id) boolean
removeRole
(RoleModel role) void
removeRoles
(ClientModel client) void
removeRoles
(RealmModel realm) roleRemovedEvent
(RoleModel role) void
saveLocalizationText
(RealmModel realm, String locale, String key, String text) void
saveLocalizationTexts
(RealmModel realm, String locale, Map<String, String> localizationTexts) searchClientsByAttributes
(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) searchClientsByAuthenticationFlowBindingOverrides
(RealmModel realm, Map<String, String> overrides, Integer firstResult, Integer maxResults) searchClientsByClientIdStream
(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) searchForClientRolesStream
(ClientModel client, String search, Integer first, Integer max) searchForClientRolesStream
(RealmModel realm, String search, Stream<String> excludedIds, Integer first, Integer max) searchForClientRolesStream
(RealmModel realm, Stream<String> ids, 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) boolean
updateLocalizationText
(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, wait
Methods inherited from interface org.keycloak.models.ClientScopeProvider
addClientScope
Methods inherited from interface org.keycloak.storage.group.GroupLookupProvider
searchForGroupByNameStream
Methods inherited from interface org.keycloak.models.GroupProvider
createGroup, createGroup, createGroup, getTopLevelGroupsStream, getTopLevelGroupsStream
Methods inherited from interface org.keycloak.models.RealmProvider
createClientInitialAccessModel, decreaseRemainingCount, getClientInitialAccessModel, listClientInitialAccessStream, removeClientInitialAccessModel
Methods 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:
getMigrationModel
in interfaceDeploymentStateProvider
-
createRealm
- Specified by:
createRealm
in interfaceRealmProvider
-
createRealm
- Specified by:
createRealm
in interfaceRealmProvider
-
getRealm
- Specified by:
getRealm
in interfaceRealmProvider
-
getRealmsWithProviderTypeStream
- Specified by:
getRealmsWithProviderTypeStream
in interfaceRealmProvider
-
getRealmsStream
- Specified by:
getRealmsStream
in interfaceRealmProvider
-
getRealmByName
- Specified by:
getRealmByName
in interfaceRealmProvider
-
removeRealm
- Specified by:
removeRealm
in interfaceRealmProvider
-
close
public void close() -
addRealmRole
- Specified by:
addRealmRole
in interfaceRoleProvider
-
addRealmRole
- Specified by:
addRealmRole
in interfaceRoleProvider
-
getRealmRole
- Specified by:
getRealmRole
in interfaceRoleLookupProvider
-
addClientRole
- Specified by:
addClientRole
in interfaceRoleProvider
-
addClientRole
- Specified by:
addClientRole
in interfaceRoleProvider
-
getRealmRolesStream
- Specified by:
getRealmRolesStream
in interfaceRoleProvider
-
getClientRole
- Specified by:
getClientRole
in interfaceRoleLookupProvider
-
getAllRedirectUrisOfEnabledClients
- Specified by:
getAllRedirectUrisOfEnabledClients
in interfaceClientProvider
-
getRealmRolesStream
- Specified by:
getRealmRolesStream
in interfaceRoleProvider
-
getRolesStream
public Stream<RoleModel> getRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) - Specified by:
getRolesStream
in interfaceRoleProvider
-
searchForClientRolesStream
public Stream<RoleModel> searchForClientRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) - Specified by:
searchForClientRolesStream
in interfaceRoleLookupProvider
-
searchForClientRolesStream
public Stream<RoleModel> searchForClientRolesStream(RealmModel realm, String search, Stream<String> excludedIds, Integer first, Integer max) - Specified by:
searchForClientRolesStream
in interfaceRoleLookupProvider
-
getClientRolesStream
- Specified by:
getClientRolesStream
in 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:
searchForClientRolesStream
in interfaceRoleLookupProvider
-
searchForRolesStream
public Stream<RoleModel> searchForRolesStream(RealmModel realm, String search, Integer first, Integer max) - Specified by:
searchForRolesStream
in interfaceRoleLookupProvider
-
searchForRoles
protected Stream<RoleModel> searchForRoles(jakarta.persistence.TypedQuery<RoleEntity> query, RealmModel realm, String search, Integer first, Integer max) -
removeRole
- Specified by:
removeRole
in interfaceRoleProvider
-
roleRemovedEvent
-
removeRoles
- Specified by:
removeRoles
in interfaceRoleProvider
-
removeRoles
- Specified by:
removeRoles
in interfaceRoleProvider
-
getRoleById
- Specified by:
getRoleById
in interfaceRoleLookupProvider
-
getGroupById
- Specified by:
getGroupById
in interfaceGroupLookupProvider
-
getGroupByName
- Specified by:
getGroupByName
in interfaceGroupLookupProvider
-
moveGroup
- Specified by:
moveGroup
in interfaceGroupProvider
-
getGroupsStream
- Specified by:
getGroupsStream
in interfaceGroupProvider
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) - Specified by:
getGroupsStream
in interfaceGroupProvider
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids, Integer first, Integer max) - Specified by:
getGroupsStream
in interfaceGroupProvider
-
getGroupsStream
- Specified by:
getGroupsStream
in interfaceGroupProvider
-
getGroupsCount
- Specified by:
getGroupsCount
in interfaceGroupProvider
-
getGroupsCount
- Specified by:
getGroupsCount
in interfaceGroupProvider
-
getClientsCount
- Specified by:
getClientsCount
in interfaceClientProvider
-
getGroupsCountByNameContaining
- Specified by:
getGroupsCountByNameContaining
in interfaceGroupProvider
-
getGroupsByRoleStream
public Stream<GroupModel> getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) - Specified by:
getGroupsByRoleStream
in interfaceGroupProvider
-
getTopLevelGroupsStream
public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm, String search, Boolean exact, Integer firstResult, Integer maxResults) - Specified by:
getTopLevelGroupsStream
in interfaceGroupProvider
-
removeGroup
- Specified by:
removeGroup
in interfaceGroupProvider
-
createGroup
- Specified by:
createGroup
in interfaceGroupProvider
-
addTopLevelGroup
- Specified by:
addTopLevelGroup
in interfaceGroupProvider
-
preRemove
-
addClient
- Specified by:
addClient
in interfaceClientProvider
-
addClient
- Specified by:
addClient
in interfaceClientProvider
-
getClientsStream
- Specified by:
getClientsStream
in interfaceClientProvider
-
getClientsStream
public Stream<ClientModel> getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults) - Specified by:
getClientsStream
in interfaceClientProvider
-
getAlwaysDisplayInConsoleClientsStream
- Specified by:
getAlwaysDisplayInConsoleClientsStream
in interfaceClientProvider
-
getClientById
- Specified by:
getClientById
in interfaceClientLookupProvider
-
getClientByClientId
- Specified by:
getClientByClientId
in interfaceClientLookupProvider
-
searchClientsByClientIdStream
public Stream<ClientModel> searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByClientIdStream
in interfaceClientLookupProvider
-
searchClientsByAttributes
public Stream<ClientModel> searchClientsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByAttributes
in interfaceClientLookupProvider
-
searchClientsByAuthenticationFlowBindingOverrides
public Stream<ClientModel> searchClientsByAuthenticationFlowBindingOverrides(RealmModel realm, Map<String, String> overrides, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByAuthenticationFlowBindingOverrides
in interfaceClientLookupProvider
-
removeClients
- Specified by:
removeClients
in interfaceClientProvider
-
removeClient
- Specified by:
removeClient
in interfaceClientProvider
-
getClientScopeById
- Specified by:
getClientScopeById
in interfaceClientScopeLookupProvider
-
getClientScopesStream
- Specified by:
getClientScopesStream
in interfaceClientScopeProvider
-
addClientScope
- Specified by:
addClientScope
in interfaceClientScopeProvider
-
removeClientScope
- Specified by:
removeClientScope
in interfaceClientScopeProvider
-
removeClientScopes
- Specified by:
removeClientScopes
in interfaceClientScopeProvider
-
addClientScopes
public void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) - Specified by:
addClientScopes
in interfaceClientProvider
-
removeClientScope
- Specified by:
removeClientScope
in interfaceClientProvider
-
getClientScopes
public Map<String,ClientScopeModel> getClientScopes(RealmModel realm, ClientModel client, boolean defaultScope) - Specified by:
getClientScopes
in interfaceClientLookupProvider
-
searchForGroupByNameStream
public Stream<GroupModel> searchForGroupByNameStream(RealmModel realm, String search, Boolean exact, Integer first, Integer max) - Specified by:
searchForGroupByNameStream
in interfaceGroupLookupProvider
-
searchGroupsByAttributes
public Stream<GroupModel> searchGroupsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) - Specified by:
searchGroupsByAttributes
in interfaceGroupLookupProvider
-
removeExpiredClientInitialAccess
public void removeExpiredClientInitialAccess()- Specified by:
removeExpiredClientInitialAccess
in interfaceRealmProvider
-
updateLocalizationText
- Specified by:
updateLocalizationText
in interfaceRealmProvider
-
saveLocalizationText
- Specified by:
saveLocalizationText
in interfaceRealmProvider
-
saveLocalizationTexts
public void saveLocalizationTexts(RealmModel realm, String locale, Map<String, String> localizationTexts) - Specified by:
saveLocalizationTexts
in interfaceRealmProvider
-
deleteLocalizationTextsByLocale
- Specified by:
deleteLocalizationTextsByLocale
in interfaceRealmProvider
-
getLocalizationTextsById
- Specified by:
getLocalizationTextsById
in interfaceRealmProvider
-
deleteLocalizationText
- Specified by:
deleteLocalizationText
in interfaceRealmProvider
-
getClientSearchableAttributes
-