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
-
-
Constructor Summary
Constructors Constructor Description JpaRealmProvider(KeycloakSession session, javax.persistence.EntityManager em, Set<String> clientSearchableAttributes, Set<String> groupSearchableAttributes)
-
Method Summary
-
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.RealmProvider
addClientRole, addClientRole, createClientInitialAccessModel, createGroup, createGroup, createGroup, decreaseRemainingCount, getClientInitialAccessModel, getClientRole, getClientRoles, getClientRoles, getClientScopeById, getRealmRoles, getRoleById, listClientInitialAccessStream, removeClientInitialAccessModel, removeRole, searchForClientRoles, searchForRoles
-
Methods inherited from interface org.keycloak.models.RoleProvider
getClientRolesStream
-
-
-
-
Constructor Detail
-
JpaRealmProvider
public JpaRealmProvider(KeycloakSession session, javax.persistence.EntityManager em, Set<String> clientSearchableAttributes, Set<String> groupSearchableAttributes)
-
-
Method Detail
-
getMigrationModel
public MigrationModel getMigrationModel()
- Specified by:
getMigrationModelin interfaceDeploymentStateProvider
-
createRealm
public RealmModel createRealm(String name)
- Specified by:
createRealmin interfaceRealmProvider
-
createRealm
public RealmModel createRealm(String id, String name)
- Specified by:
createRealmin interfaceRealmProvider
-
getRealm
public RealmModel getRealm(String id)
- Specified by:
getRealmin interfaceRealmProvider
-
getRealmsWithProviderTypeStream
public Stream<RealmModel> getRealmsWithProviderTypeStream(Class<?> providerType)
- Specified by:
getRealmsWithProviderTypeStreamin interfaceRealmProvider
-
getRealmsStream
public Stream<RealmModel> getRealmsStream()
- Specified by:
getRealmsStreamin interfaceRealmProvider
-
getRealmByName
public RealmModel getRealmByName(String name)
- Specified by:
getRealmByNamein interfaceRealmProvider
-
removeRealm
public boolean removeRealm(String id)
- Specified by:
removeRealmin interfaceRealmProvider
-
addRealmRole
public RoleModel addRealmRole(RealmModel realm, String name)
- Specified by:
addRealmRolein interfaceRealmProvider- Specified by:
addRealmRolein interfaceRoleProvider
-
addRealmRole
public RoleModel addRealmRole(RealmModel realm, String id, String name)
- Specified by:
addRealmRolein interfaceRealmProvider- Specified by:
addRealmRolein interfaceRoleProvider
-
getRealmRole
public RoleModel getRealmRole(RealmModel realm, String name)
- Specified by:
getRealmRolein interfaceRealmProvider- Specified by:
getRealmRolein interfaceRoleLookupProvider
-
addClientRole
public RoleModel addClientRole(ClientModel client, String name)
- Specified by:
addClientRolein interfaceRoleProvider
-
addClientRole
public RoleModel addClientRole(ClientModel client, String id, String name)
- Specified by:
addClientRolein interfaceRoleProvider
-
getRealmRolesStream
public Stream<RoleModel> getRealmRolesStream(RealmModel realm)
- Specified by:
getRealmRolesStreamin interfaceRoleProvider
-
getClientRole
public RoleModel getClientRole(ClientModel client, String name)
- Specified by:
getClientRolein interfaceRoleLookupProvider
-
getAllRedirectUrisOfEnabledClients
public Map<ClientModel,Set<String>> getAllRedirectUrisOfEnabledClients(RealmModel realm)
- Specified by:
getAllRedirectUrisOfEnabledClientsin interfaceClientProvider
-
getRealmRolesStream
public Stream<RoleModel> getRealmRolesStream(RealmModel realm, Integer first, Integer max)
- 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
public Stream<RoleModel> getClientRolesStream(ClientModel client, Integer first, Integer max)
- Specified by:
getClientRolesStreamin interfaceRoleProvider
-
getRolesStream
protected Stream<RoleModel> getRolesStream(javax.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(javax.persistence.TypedQuery<RoleEntity> query, RealmModel realm, String search, Integer first, Integer max)
-
removeRole
public boolean removeRole(RoleModel role)
- Specified by:
removeRolein interfaceRoleProvider
-
roleRemovedEvent
public RoleContainerModel.RoleRemovedEvent roleRemovedEvent(RoleModel role)
-
removeRoles
public void removeRoles(RealmModel realm)
- Specified by:
removeRolesin interfaceRoleProvider
-
removeRoles
public void removeRoles(ClientModel client)
- Specified by:
removeRolesin interfaceRoleProvider
-
getRoleById
public RoleModel getRoleById(RealmModel realm, String id)
- Specified by:
getRoleByIdin interfaceRoleLookupProvider
-
getGroupById
public GroupModel getGroupById(RealmModel realm, String id)
- Specified by:
getGroupByIdin interfaceGroupLookupProvider- Specified by:
getGroupByIdin interfaceRealmProvider
-
moveGroup
public void moveGroup(RealmModel realm, GroupModel group, GroupModel toParent)
- Specified by:
moveGroupin interfaceGroupProvider- Specified by:
moveGroupin interfaceRealmProvider
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm)
- 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
public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids)
- Specified by:
getGroupsStreamin interfaceGroupProvider
-
getGroupsCount
public Long getGroupsCount(RealmModel realm, Stream<String> ids, String search)
- Specified by:
getGroupsCountin interfaceGroupProvider
-
getGroupsCount
public Long getGroupsCount(RealmModel realm, Boolean onlyTopGroups)
- Specified by:
getGroupsCountin interfaceGroupProvider- Specified by:
getGroupsCountin interfaceRealmProvider
-
getClientsCount
public long getClientsCount(RealmModel realm)
- Specified by:
getClientsCountin interfaceClientProvider- Specified by:
getClientsCountin interfaceRealmProvider
-
getGroupsCountByNameContaining
public Long getGroupsCountByNameContaining(RealmModel realm, String search)
- Specified by:
getGroupsCountByNameContainingin interfaceGroupProvider- Specified by:
getGroupsCountByNameContainingin interfaceRealmProvider
-
getGroupsByRoleStream
public Stream<GroupModel> getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)
- Specified by:
getGroupsByRoleStreamin interfaceGroupProvider
-
getTopLevelGroupsStream
public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm)
- Specified by:
getTopLevelGroupsStreamin interfaceGroupProvider
-
getTopLevelGroupsStream
public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm, Integer first, Integer max)
- Specified by:
getTopLevelGroupsStreamin interfaceGroupProvider
-
removeGroup
public boolean removeGroup(RealmModel realm, GroupModel group)
- Specified by:
removeGroupin interfaceGroupProvider- Specified by:
removeGroupin interfaceRealmProvider
-
createGroup
public GroupModel createGroup(RealmModel realm, String id, String name, GroupModel toParent)
- Specified by:
createGroupin interfaceGroupProvider- Specified by:
createGroupin interfaceRealmProvider
-
addTopLevelGroup
public void addTopLevelGroup(RealmModel realm, GroupModel subGroup)
- Specified by:
addTopLevelGroupin interfaceGroupProvider- Specified by:
addTopLevelGroupin interfaceRealmProvider
-
preRemove
public void preRemove(RealmModel realm, RoleModel role)
-
addClient
public ClientModel addClient(RealmModel realm, String clientId)
- Specified by:
addClientin interfaceClientProvider- Specified by:
addClientin interfaceRealmProvider
-
addClient
public ClientModel addClient(RealmModel realm, String id, String clientId)
- Specified by:
addClientin interfaceClientProvider- Specified by:
addClientin interfaceRealmProvider
-
getClientsStream
public Stream<ClientModel> getClientsStream(RealmModel realm)
- Specified by:
getClientsStreamin interfaceClientProvider
-
getClientsStream
public Stream<ClientModel> getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults)
- Specified by:
getClientsStreamin interfaceClientProvider
-
getAlwaysDisplayInConsoleClientsStream
public Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)
- Specified by:
getAlwaysDisplayInConsoleClientsStreamin interfaceClientProvider
-
getClientById
public ClientModel getClientById(RealmModel realm, String id)
- Specified by:
getClientByIdin interfaceClientLookupProvider
-
getClientByClientId
public ClientModel getClientByClientId(RealmModel realm, String clientId)
- 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
public void removeClients(RealmModel realm)
- Specified by:
removeClientsin interfaceClientProvider
-
removeClient
public boolean removeClient(RealmModel realm, String id)
- Specified by:
removeClientin interfaceClientProvider
-
getClientScopeById
public ClientScopeModel getClientScopeById(RealmModel realm, String id)
- Specified by:
getClientScopeByIdin interfaceClientScopeLookupProvider- Specified by:
getClientScopeByIdin interfaceRealmProvider
-
getClientScopesStream
public Stream<ClientScopeModel> getClientScopesStream(RealmModel realm)
- Specified by:
getClientScopesStreamin interfaceClientScopeProvider
-
addClientScope
public ClientScopeModel addClientScope(RealmModel realm, String id, String name)
- Specified by:
addClientScopein interfaceClientScopeProvider
-
removeClientScope
public boolean removeClientScope(RealmModel realm, String id)
- Specified by:
removeClientScopein interfaceClientScopeProvider
-
removeClientScopes
public void removeClientScopes(RealmModel realm)
- Specified by:
removeClientScopesin interfaceClientScopeProvider
-
addClientScopes
public void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope)
- Specified by:
addClientScopesin interfaceClientProvider
-
removeClientScope
public void removeClientScope(RealmModel realm, ClientModel client, ClientScopeModel clientScope)
- 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
public boolean updateLocalizationText(RealmModel realm, String locale, String key, String text)
- Specified by:
updateLocalizationTextin interfaceRealmProvider
-
saveLocalizationText
public void saveLocalizationText(RealmModel realm, String locale, String key, String text)
- Specified by:
saveLocalizationTextin interfaceRealmProvider
-
saveLocalizationTexts
public void saveLocalizationTexts(RealmModel realm, String locale, Map<String,String> localizationTexts)
- Specified by:
saveLocalizationTextsin interfaceRealmProvider
-
deleteLocalizationTextsByLocale
public boolean deleteLocalizationTextsByLocale(RealmModel realm, String locale)
- Specified by:
deleteLocalizationTextsByLocalein interfaceRealmProvider
-
getLocalizationTextsById
public String getLocalizationTextsById(RealmModel realm, String locale, String key)
- Specified by:
getLocalizationTextsByIdin interfaceRealmProvider
-
deleteLocalizationText
public boolean deleteLocalizationText(RealmModel realm, String locale, String key)
- Specified by:
deleteLocalizationTextin interfaceRealmProvider
-
-