Package org.keycloak.models
Interface RealmProvider
- 
- All Superinterfaces:
- ClientLookupProvider,- ClientProvider,- ClientScopeLookupProvider,- ClientScopeProvider,- GroupLookupProvider,- GroupProvider,- Provider,- RoleLookupProvider,- RoleProvider
 - All Known Subinterfaces:
- CacheRealmProvider
 - All Known Implementing Classes:
- JpaRealmProvider,- MapRealmProvider,- RealmCacheSession
 
 public interface RealmProvider extends Provider, ClientProvider, ClientScopeProvider, GroupProvider, RoleProvider - Version:
- $Revision: 1 $
- Author:
- Bill Burke
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default ClientModeladdClient(RealmModel realm, String clientId)Deprecated.Use the corresponding method fromClientProvider.ClientModeladdClient(RealmModel realm, String id, String clientId)Deprecated.Use the corresponding method fromClientProvider.default RoleModeladdClientRole(RealmModel realm, ClientModel client, String name)Deprecated.Use the corresponding method fromRoleProvider.default RoleModeladdClientRole(RealmModel realm, ClientModel client, String id, String name)Deprecated.Use the corresponding method fromRoleProvider.default RoleModeladdRealmRole(RealmModel realm, String name)Deprecated.Use the corresponding method fromRoleProvider.RoleModeladdRealmRole(RealmModel realm, String id, String name)Deprecated.Use the corresponding method fromRoleProvider.voidaddTopLevelGroup(RealmModel realm, GroupModel subGroup)Deprecated.Use the corresponding method fromGroupProvider.default ClientInitialAccessModelcreateClientInitialAccessModel(RealmModel realm, int expiration, int count)default GroupModelcreateGroup(RealmModel realm, String name)Deprecated.Use the corresponding method fromGroupProvider.default GroupModelcreateGroup(RealmModel realm, String id, String name)Deprecated.Use the corresponding method fromGroupProvider.GroupModelcreateGroup(RealmModel realm, String id, String name, GroupModel toParent)Deprecated.Use the corresponding method fromGroupProvider.default GroupModelcreateGroup(RealmModel realm, String name, GroupModel toParent)Deprecated.Use the corresponding method fromGroupProvider.RealmModelcreateRealm(String name)Creates new realm with the given name.RealmModelcreateRealm(String id, String name)Created new realm with given ID and name.default voiddecreaseRemainingCount(RealmModel realm, ClientInitialAccessModel clientInitialAccess)booleandeleteLocalizationText(RealmModel realm, String locale, String key)booleandeleteLocalizationTextsByLocale(RealmModel realm, String locale)default ClientInitialAccessModelgetClientInitialAccessModel(RealmModel realm, String id)default RoleModelgetClientRole(RealmModel realm, ClientModel client, String name)Deprecated.Use the corresponding method fromRoleProvider.default Set<RoleModel>getClientRoles(RealmModel realm, ClientModel client)Deprecated.Use the corresponding method fromRoleProvider.default Set<RoleModel>getClientRoles(RealmModel realm, ClientModel client, Integer first, Integer max)Deprecated.Use the corresponding method fromRoleProvider.default ClientScopeModelgetClientScopeById(String id, RealmModel realm)Deprecated.Use the corresponding method fromClientScopeProvider.ClientScopeModelgetClientScopeById(RealmModel realm, String id)Deprecated.Use the corresponding method fromClientScopeProvider.longgetClientsCount(RealmModel realm)Deprecated.Use the corresponding method fromClientProvider.GroupModelgetGroupById(RealmModel realm, String id)Deprecated.Use the corresponding method fromGroupProvider.LonggetGroupsCount(RealmModel realm, Boolean onlyTopGroups)Deprecated.Use the corresponding method fromGroupProvider.LonggetGroupsCountByNameContaining(RealmModel realm, String search)Deprecated.Use the corresponding method fromGroupProvider.StringgetLocalizationTextsById(RealmModel realm, String locale, String key)RealmModelgetRealm(String id)Exact search for a realm by its internal ID.RealmModelgetRealmByName(String name)Exact search for a realm by its name.RoleModelgetRealmRole(RealmModel realm, String name)Deprecated.Use the corresponding method fromRoleProvider.default Set<RoleModel>getRealmRoles(RealmModel realm, Integer first, Integer max)Deprecated.Use the corresponding method fromRoleProvider.Stream<RealmModel>getRealmsStream()Returns realms as a stream.Stream<RealmModel>getRealmsWithProviderTypeStream(Class<?> type)Returns stream of realms which has component with the given provider type.default RoleModelgetRoleById(String id, RealmModel realm)Deprecated.Use the corresponding method fromRoleProvider.default Stream<ClientInitialAccessModel>listClientInitialAccessStream(RealmModel realm)Returns client's initial access as a stream.voidmoveGroup(RealmModel realm, GroupModel group, GroupModel toParent)Deprecated.Use the corresponding method fromGroupProvider.default voidremoveClientInitialAccessModel(RealmModel realm, String id)voidremoveExpiredClientInitialAccess()Removes all expired client initial accesses from all realms.booleanremoveGroup(RealmModel realm, GroupModel group)Deprecated.Use the corresponding method fromGroupProvider.booleanremoveRealm(String id)Removes realm with the given id.default booleanremoveRole(RealmModel realm, RoleModel role)Deprecated.Use the corresponding method fromRoleProvider.voidsaveLocalizationText(RealmModel realm, String locale, String key, String text)voidsaveLocalizationTexts(RealmModel realm, String locale, Map<String,String> localizationTexts)default Set<RoleModel>searchForClientRoles(RealmModel realm, ClientModel client, String search, Integer first, Integer max)Deprecated.Use the corresponding method fromRoleProvider.default Set<RoleModel>searchForRoles(RealmModel realm, String search, Integer first, Integer max)Deprecated.Use the corresponding method fromRoleProvider.booleanupdateLocalizationText(RealmModel realm, String locale, String key, String text)- 
Methods inherited from interface org.keycloak.storage.client.ClientLookupProvidergetClientByClientId, getClientById, getClientScopes, searchClientsByAttributes, searchClientsByClientIdStream
 - 
Methods inherited from interface org.keycloak.models.ClientProvideraddClientScopes, getAllRedirectUrisOfEnabledClients, getAlwaysDisplayInConsoleClientsStream, getClientsStream, getClientsStream, removeClient, removeClients, removeClientScope
 - 
Methods inherited from interface org.keycloak.models.ClientScopeProvideraddClientScope, addClientScope, getClientScopesStream, removeClientScope, removeClientScopes
 - 
Methods inherited from interface org.keycloak.storage.group.GroupLookupProvidersearchForGroupByNameStream, searchForGroupByNameStream, searchGroupsByAttributes
 - 
Methods inherited from interface org.keycloak.models.GroupProvidergetGroupsByRoleStream, getGroupsCount, getGroupsStream, getGroupsStream, getGroupsStream, getGroupsStream, getTopLevelGroupsStream, getTopLevelGroupsStream
 - 
Methods inherited from interface org.keycloak.storage.role.RoleLookupProvidergetClientRole, getRoleById, searchForClientRolesStream, searchForRolesStream
 - 
Methods inherited from interface org.keycloak.models.RoleProvideraddClientRole, addClientRole, getClientRolesStream, getClientRolesStream, getRealmRolesStream, getRealmRolesStream, getRolesStream, removeRole, removeRoles, removeRoles
 
- 
 
- 
- 
- 
Method Detail- 
createRealmRealmModel createRealm(String name) Creates new realm with the given name. The internal ID will be generated automatically.- Parameters:
- name- String name of the realm
- Returns:
- Model of the created realm.
 
 - 
createRealmRealmModel createRealm(String id, String name) Created new realm with given ID and name.- Parameters:
- id- Internal ID of the realm or- nullif one is to be created by the underlying store. If the store expects the ID to have a certain format (for example- UUID) and the supplied ID doesn't follow the expected format, the store may replace the- idwith a new one at its own discretion.
- name- String name of the realm
- Returns:
- Model of the created realm.
 
 - 
getRealmRealmModel getRealm(String id) Exact search for a realm by its internal ID.- Parameters:
- id- Internal ID of the realm.
- Returns:
- Model of the realm
 
 - 
getRealmByNameRealmModel getRealmByName(String name) Exact search for a realm by its name.- Parameters:
- name- String name of the realm
- Returns:
- Model of the realm
 
 - 
getRealmsStreamStream<RealmModel> getRealmsStream() Returns realms as a stream.- Returns:
- Stream of RealmModel. Never returnsnull.
 
 - 
getRealmsWithProviderTypeStreamStream<RealmModel> getRealmsWithProviderTypeStream(Class<?> type) Returns stream of realms which has component with the given provider type.- Parameters:
- type-- Class<?>Type of the provider.
- Returns:
- Stream of RealmModel. Never returnsnull.
 
 - 
removeRealmboolean removeRealm(String id) Removes realm with the given id.- Parameters:
- id- of realm.
- Returns:
- trueif the realm was successfully removed.
 
 - 
createClientInitialAccessModeldefault ClientInitialAccessModel createClientInitialAccessModel(RealmModel realm, int expiration, int count) 
 - 
getClientInitialAccessModeldefault ClientInitialAccessModel getClientInitialAccessModel(RealmModel realm, String id) 
 - 
removeClientInitialAccessModeldefault void removeClientInitialAccessModel(RealmModel realm, String id) 
 - 
listClientInitialAccessStreamdefault Stream<ClientInitialAccessModel> listClientInitialAccessStream(RealmModel realm) Returns client's initial access as a stream.- Parameters:
- realm-- RealmModelThe realm where to list client's initial access.
- Returns:
- Stream of ClientInitialAccessModel. Never returnsnull.
 
 - 
removeExpiredClientInitialAccessvoid removeExpiredClientInitialAccess() Removes all expired client initial accesses from all realms.
 - 
decreaseRemainingCountdefault void decreaseRemainingCount(RealmModel realm, ClientInitialAccessModel clientInitialAccess) 
 - 
saveLocalizationTextvoid saveLocalizationText(RealmModel realm, String locale, String key, String text) 
 - 
saveLocalizationTextsvoid saveLocalizationTexts(RealmModel realm, String locale, Map<String,String> localizationTexts) 
 - 
updateLocalizationTextboolean updateLocalizationText(RealmModel realm, String locale, String key, String text) 
 - 
deleteLocalizationTextsByLocaleboolean deleteLocalizationTextsByLocale(RealmModel realm, String locale) 
 - 
deleteLocalizationTextboolean deleteLocalizationText(RealmModel realm, String locale, String key) 
 - 
getLocalizationTextsByIdString getLocalizationTextsById(RealmModel realm, String locale, String key) 
 - 
addClientClientModel addClient(RealmModel realm, String id, String clientId) Deprecated.Use the corresponding method fromClientProvider.Description copied from interface:ClientProviderAdds a client with given internal ID andclientIdto the given realm.- Specified by:
- addClientin interface- ClientProvider
- Parameters:
- realm- Realm owning this client.
- id- Internal ID of the client or- nullif one is to be created by the underlying store
- clientId- String that identifies the client to the external parties. Maps to- client_idin OIDC or- entityIDin SAML.
- Returns:
- Model of the created client.
 
 - 
addClientdefault ClientModel addClient(RealmModel realm, String clientId) Deprecated.Use the corresponding method fromClientProvider.Description copied from interface:ClientProviderAdds a client with givenclientIdto the given realm. The internal ID of the client will be created automatically.- Specified by:
- addClientin interface- ClientProvider
- Parameters:
- realm- Realm owning this client.
- clientId- String that identifies the client to the external parties. Maps to- client_idin OIDC or- entityIDin SAML.
- Returns:
- Model of the created client.
 
 - 
getClientsCountlong getClientsCount(RealmModel realm) Deprecated.Use the corresponding method fromClientProvider.Description copied from interface:ClientProviderReturns number of clients in the given realm- Specified by:
- getClientsCountin interface- ClientProvider
- Parameters:
- realm- Realm.
- Returns:
- Number of the clients in the given realm.
 
 - 
getClientScopeByIddefault ClientScopeModel getClientScopeById(String id, RealmModel realm) Deprecated.Use the corresponding method fromClientScopeProvider.
 - 
getClientScopeByIdClientScopeModel getClientScopeById(RealmModel realm, String id) Deprecated.Use the corresponding method fromClientScopeProvider.Description copied from interface:ClientScopeLookupProviderExact search for a client scope by its internal ID..- Specified by:
- getClientScopeByIdin interface- ClientScopeLookupProvider
- Parameters:
- realm- Realm.
- id- Internal ID of the role.
- Returns:
- Model of the client scope.
 
 - 
addRealmRoledefault RoleModel addRealmRole(RealmModel realm, String name) Deprecated.Use the corresponding method fromRoleProvider.Description copied from interface:RoleProviderAdds a realm role with givennameto the given realm. The internal ID of the role will be created automatically.- Specified by:
- addRealmRolein interface- RoleProvider
- Parameters:
- realm- Realm owning this role.
- name- String name of the role.
- Returns:
- Model of the created role.
 
 - 
addRealmRoleRoleModel addRealmRole(RealmModel realm, String id, String name) Deprecated.Use the corresponding method fromRoleProvider.Description copied from interface:RoleProviderAdds a realm role with given internal ID andnameto the given realm.- Specified by:
- addRealmRolein interface- RoleProvider
- Parameters:
- realm- Realm owning this role.
- id- Internal ID of the role or- nullif one is to be created by the underlying store
- name- String name of the role.
- Returns:
- Model of the created client.
 
 - 
getRealmRoleRoleModel getRealmRole(RealmModel realm, String name) Deprecated.Use the corresponding method fromRoleProvider.Description copied from interface:RoleLookupProviderExact search for a role by given name.- Specified by:
- getRealmRolein interface- RoleLookupProvider
- Parameters:
- realm- Realm.
- name- String name of the role.
- Returns:
- Model of the role, or nullif no role is found.
 
 - 
getRoleByIddefault RoleModel getRoleById(String id, RealmModel realm) Deprecated.Use the corresponding method fromRoleProvider.
 - 
getRealmRolesdefault Set<RoleModel> getRealmRoles(RealmModel realm, Integer first, Integer max) Deprecated.Use the corresponding method fromRoleProvider.
 - 
searchForRolesdefault Set<RoleModel> searchForRoles(RealmModel realm, String search, Integer first, Integer max) Deprecated.Use the corresponding method fromRoleProvider.
 - 
removeRoledefault boolean removeRole(RealmModel realm, RoleModel role) Deprecated.Use the corresponding method fromRoleProvider.
 - 
addClientRoledefault RoleModel addClientRole(RealmModel realm, ClientModel client, String name) Deprecated.Use the corresponding method fromRoleProvider.
 - 
addClientRoledefault RoleModel addClientRole(RealmModel realm, ClientModel client, String id, String name) Deprecated.Use the corresponding method fromRoleProvider.
 - 
getClientRoledefault RoleModel getClientRole(RealmModel realm, ClientModel client, String name) Deprecated.Use the corresponding method fromRoleProvider.
 - 
getClientRolesdefault Set<RoleModel> getClientRoles(RealmModel realm, ClientModel client) Deprecated.Use the corresponding method fromRoleProvider.
 - 
getClientRolesdefault Set<RoleModel> getClientRoles(RealmModel realm, ClientModel client, Integer first, Integer max) Deprecated.Use the corresponding method fromRoleProvider.
 - 
searchForClientRolesdefault Set<RoleModel> searchForClientRoles(RealmModel realm, ClientModel client, String search, Integer first, Integer max) Deprecated.Use the corresponding method fromRoleProvider.
 - 
moveGroupvoid moveGroup(RealmModel realm, GroupModel group, GroupModel toParent) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderThis method is used for moving groups in group structure, for example:- making an existing child group child group of some other group,
- setting a top level group (i.e. group without parent group) child of some group,
- making a child group top level group (i.e. removing its parent group).
 - Specified by:
- moveGroupin interface- GroupProvider
- Parameters:
- realm- Realm owning this group.
- group- Group to update.
- toParent- New parent group, or- nullif we are moving the group to top level group.
 
 - 
getGroupByIdGroupModel getGroupById(RealmModel realm, String id) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupLookupProviderReturns a group from the given realm with the corresponding id- Specified by:
- getGroupByIdin interface- GroupLookupProvider
- Parameters:
- realm- Realm.
- id- Id.
- Returns:
- GroupModel with the corresponding id.
 
 - 
getGroupsCountLong getGroupsCount(RealmModel realm, Boolean onlyTopGroups) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderReturns a number of groups/top level groups (i.e. groups without parent group) for the given realm.- Specified by:
- getGroupsCountin interface- GroupProvider
- Parameters:
- realm- Realm.
- onlyTopGroups- When true the function returns a count of top level groups only.
- Returns:
- Number of groups/top level groups.
 
 - 
getGroupsCountByNameContainingLong getGroupsCountByNameContaining(RealmModel realm, String search) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderReturns the number of top level groups containing groups with the given string in name for the given realm.- Specified by:
- getGroupsCountByNameContainingin interface- GroupProvider
- Parameters:
- realm- Realm.
- search- Case insensitive string which will be searched for.
- Returns:
- Number of groups with the given string in its name.
 
 - 
removeGroupboolean removeGroup(RealmModel realm, GroupModel group) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderRemoves the given group for the given realm.- Specified by:
- removeGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- group- Group.
- Returns:
- true if the group was removed, false if group doesn't exist or doesn't belong to the given realm
 
 - 
createGroupdefault GroupModel createGroup(RealmModel realm, String name) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderCreates a new group with the given name in the given realm. Effectively the same ascreateGroup(realm, null, name, null).- Specified by:
- createGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- name- Name.
- Returns:
- Model of the created group.
 
 - 
createGroupdefault GroupModel createGroup(RealmModel realm, String id, String name) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderCreates a new group with the given id and name in the given realm. Effectively the same ascreateGroup(realm, id, name, null)- Specified by:
- createGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- id- Id.
- name- Name.
- Returns:
- Model of the created group
 
 - 
createGroupdefault GroupModel createGroup(RealmModel realm, String name, GroupModel toParent) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderCreates a new group with the given name and parent to the given realm. Effectively the same ascreateGroup(realm, null, name, toParent).- Specified by:
- createGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- name- Name.
- toParent- Parent group.
- Returns:
- Model of the created group.
 
 - 
createGroupGroupModel createGroup(RealmModel realm, String id, String name, GroupModel toParent) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderCreates a new group with the given name, id, name and parent to the given realm.- Specified by:
- createGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- id- Id, will be generated if- null.
- name- Name.
- toParent- Parent group, or- nullif the group is top level group
- Returns:
- Model of the created group
 
 - 
addTopLevelGroupvoid addTopLevelGroup(RealmModel realm, GroupModel subGroup) Deprecated.Use the corresponding method fromGroupProvider.Description copied from interface:GroupProviderRemoves parent group for the given group in the given realm.- Specified by:
- addTopLevelGroupin interface- GroupProvider
- Parameters:
- realm- Realm.
- subGroup- Group.
 
 
- 
 
-