public class RealmCacheSession extends Object implements CacheRealmProvider
Modifier and Type | Field and Description |
---|---|
protected RealmCacheManager |
cache |
protected boolean |
clearAll |
protected ClientProvider |
clientDelegate |
protected ClientScopeProvider |
clientScopeDelegate |
protected GroupProvider |
groupDelegate |
protected Set<InvalidationEvent> |
invalidationEvents |
protected Set<String> |
invalidations |
protected Set<String> |
listInvalidations |
protected static org.jboss.logging.Logger |
logger |
protected Map<String,ClientModel> |
managedApplications |
protected Map<String,ClientScopeAdapter> |
managedClientScopes |
protected Map<String,GroupAdapter> |
managedGroups |
protected Map<String,RealmAdapter> |
managedRealms |
protected Map<String,RoleAdapter> |
managedRoles |
static String |
REALM_CLIENTS_QUERY_SUFFIX |
protected RealmProvider |
realmDelegate |
protected RoleProvider |
roleDelegate |
static String |
ROLES_QUERY_SUFFIX |
protected KeycloakSession |
session |
protected boolean |
setRollbackOnly |
protected long |
startupRevision |
protected boolean |
transactionActive |
Constructor and Description |
---|
RealmCacheSession(RealmCacheManager cache,
KeycloakSession session) |
Modifier and Type | Method and Description |
---|---|
ClientModel |
addClient(RealmModel realm,
String clientId)
Adds a client with given
clientId to the given realm. |
ClientModel |
addClient(RealmModel realm,
String id,
String clientId)
Adds a client with given internal ID and
clientId to the given realm. |
RoleModel |
addClientRole(ClientModel client,
String name)
Adds a client role with given
name to the given client. |
RoleModel |
addClientRole(ClientModel client,
String id,
String name)
Adds a client role with given internal ID and
name to the given client. |
ClientScopeModel |
addClientScope(RealmModel realm,
String name)
Creates new client scope with given
name to the given realm. |
ClientScopeModel |
addClientScope(RealmModel realm,
String id,
String name)
Creates new client scope with given internal ID and
name to the given realm. |
void |
addClientScopes(RealmModel realm,
ClientModel client,
Set<ClientScopeModel> clientScopes,
boolean defaultScope)
Assign clientScopes to the client.
|
RoleModel |
addRealmRole(RealmModel realm,
String name)
Adds a realm role with given
name to the given realm. |
RoleModel |
addRealmRole(RealmModel realm,
String id,
String name)
Adds a realm role with given internal ID and
name to the given realm. |
void |
addTopLevelGroup(RealmModel realm,
GroupModel subGroup)
Removes parent group for the given group in the given realm.
|
protected ClientModel |
cacheClient(RealmModel realm,
ClientModel delegate,
Long revision) |
void |
clear() |
void |
close() |
ClientInitialAccessModel |
createClientInitialAccessModel(RealmModel realm,
int expiration,
int count) |
GroupModel |
createGroup(RealmModel realm,
String id,
String name,
GroupModel toParent)
Creates a new group with the given name, id, name and parent to the given realm.
|
RealmModel |
createRealm(String name)
Creates new realm with the given name.
|
RealmModel |
createRealm(String id,
String name)
Created new realm with given ID and name.
|
boolean |
deleteLocalizationText(RealmModel realm,
String locale,
String key) |
boolean |
deleteLocalizationTextsByLocale(RealmModel realm,
String locale) |
void |
evictRealmOnRemoval(RealmModel realm) |
Map<ClientModel,Set<String>> |
getAllRedirectUrisOfEnabledClients(RealmModel realm)
Returns a map of (rootUrl, {validRedirectUris}) for all enabled clients.
|
Stream<ClientModel> |
getAlwaysDisplayInConsoleClientsStream(RealmModel realm)
Returns a stream of clients that are expected to always show up in account console.
|
ClientModel |
getClientByClientId(RealmModel realm,
String clientId)
Exact search for a client by its public client identifier.
|
ClientModel |
getClientById(RealmModel realm,
String id)
Exact search for a client by its internal ID.
|
ClientProvider |
getClientDelegate() |
ClientInitialAccessModel |
getClientInitialAccessModel(RealmModel realm,
String id) |
RoleModel |
getClientRole(ClientModel client,
String name)
Exact search for a client role by given name.
|
Stream<RoleModel> |
getClientRolesStream(ClientModel client)
Returns all the client roles of the given client.
|
Stream<RoleModel> |
getClientRolesStream(ClientModel client,
Integer first,
Integer max)
Returns the client roles of the given client.
|
ClientScopeModel |
getClientScopeById(RealmModel realm,
String id)
Exact search for a client scope by its internal ID..
|
ClientScopeProvider |
getClientScopeDelegate() |
Map<String,ClientScopeModel> |
getClientScopes(RealmModel realm,
ClientModel client,
boolean defaultScopes)
Return all default scopes (if
defaultScope is true ) or all optional scopes (if defaultScope is false ) linked with the client |
Stream<ClientScopeModel> |
getClientScopesStream(RealmModel realm)
Returns all the client scopes of the given realm as a stream.
|
long |
getClientsCount(RealmModel realm)
Returns number of clients in the given realm
|
Stream<ClientModel> |
getClientsStream(RealmModel realm)
Returns all the clients of the given realm as a stream.
|
Stream<ClientModel> |
getClientsStream(RealmModel realm,
Integer firstResult,
Integer maxResults)
Returns the clients of the given realm as a stream.
|
GroupModel |
getGroupById(RealmModel realm,
String id)
Returns a group from the given realm with the corresponding id
|
GroupProvider |
getGroupDelegate() |
Stream<GroupModel> |
getGroupsByRoleStream(RealmModel realm,
RoleModel role,
Integer firstResult,
Integer maxResults)
Returns groups with the given role in the given realm.
|
Long |
getGroupsCount(RealmModel realm,
Boolean onlyTopGroups)
Returns a number of groups/top level groups (i.e.
|
Long |
getGroupsCount(RealmModel realm,
Stream<String> ids,
String search)
Returns a number of groups that contains the search string in the name
|
Long |
getGroupsCountByNameContaining(RealmModel realm,
String search)
Returns number of groups with the given string in name for the given realm.
|
Stream<GroupModel> |
getGroupsStream(RealmModel realm)
Returns groups for the given realm.
|
Stream<GroupModel> |
getGroupsStream(RealmModel realm,
Stream<String> ids,
String search,
Integer first,
Integer max)
Returns a paginated stream of groups with given ids and given search value in group names.
|
String |
getLocalizationTextsById(RealmModel realm,
String locale,
String key) |
RealmModel |
getRealm(String id)
Exact search for a realm by its internal ID.
|
RealmModel |
getRealmByName(String name)
Exact search for a realm by its name.
|
RealmProvider |
getRealmDelegate() |
RoleModel |
getRealmRole(RealmModel realm,
String name)
Exact search for a role by given name.
|
Stream<RoleModel> |
getRealmRolesStream(RealmModel realm)
Returns all the realm roles of the given realm as a stream.
|
Stream<RoleModel> |
getRealmRolesStream(RealmModel realm,
Integer first,
Integer max)
Returns the realm roles of the given realm as a stream.
|
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.
|
RoleModel |
getRoleById(RealmModel realm,
String id)
Exact search for a role by its internal ID..
|
RoleProvider |
getRoleDelegate() |
long |
getStartupRevision() |
Stream<GroupModel> |
getTopLevelGroupsStream(RealmModel realm)
Returns all top level groups (i.e.
|
Stream<GroupModel> |
getTopLevelGroupsStream(RealmModel realm,
Integer first,
Integer max)
Returns top level groups (i.e.
|
boolean |
isInvalid(String id) |
Stream<ClientInitialAccessModel> |
listClientInitialAccessStream(RealmModel realm)
Returns client's initial access as a stream.
|
void |
moveGroup(RealmModel realm,
GroupModel group,
GroupModel toParent)
This 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.
|
void |
registerClientInvalidation(String id,
String clientId,
String realmId) |
void |
registerClientScopeInvalidation(String id,
String realmId) |
void |
registerGroupInvalidation(String id) |
void |
registerRealmInvalidation(String id,
String name) |
void |
registerRoleInvalidation(String id,
String roleName,
String roleContainerId) |
boolean |
removeClient(RealmModel realm,
String id)
Removes given client from the given realm.
|
void |
removeClientInitialAccessModel(RealmModel realm,
String id) |
void |
removeClients(RealmModel realm)
Removes all clients from the given realm.
|
void |
removeClientScope(RealmModel realm,
ClientModel client,
ClientScopeModel clientScope)
Unassign clientScope from the client.
|
boolean |
removeClientScope(RealmModel realm,
String id)
Removes client scope from the given realm.
|
void |
removeClientScopes(RealmModel realm)
Removes all client scopes from the given realm.
|
void |
removeExpiredClientInitialAccess()
Removes all expired client initial accesses from all realms.
|
boolean |
removeGroup(RealmModel realm,
GroupModel group)
Removes the given group for the given realm.
|
boolean |
removeRealm(String id)
Removes realm with the given id.
|
boolean |
removeRole(RoleModel role)
Removes given realm role from the given realm.
|
void |
removeRoles(ClientModel client)
Removes all roles from the given client.
|
void |
removeRoles(RealmModel realm)
Removes all roles from the given realm.
|
protected void |
runInvalidations() |
void |
saveLocalizationText(RealmModel realm,
String locale,
String key,
String text) |
void |
saveLocalizationTexts(RealmModel realm,
String locale,
Map<String,String> localizationTexts) |
Stream<ClientModel> |
searchClientsByAttributes(RealmModel realm,
Map<String,String> attributes,
Integer firstResult,
Integer maxResults) |
Stream<ClientModel> |
searchClientsByClientIdStream(RealmModel realm,
String clientId,
Integer firstResult,
Integer maxResults)
Case-insensitive search for clients that contain the given string in their public client identifier.
|
Stream<RoleModel> |
searchForClientRolesStream(ClientModel client,
String search,
Integer first,
Integer max)
Case-insensitive search for client roles that contain the given string in their name or description.
|
Stream<GroupModel> |
searchForGroupByNameStream(RealmModel realm,
String search,
Integer first,
Integer max)
Returns the group hierarchy with the given string in name for the given realm.
|
Stream<RoleModel> |
searchForRolesStream(RealmModel realm,
String search,
Integer first,
Integer max)
Case-insensitive search for roles that contain the given string in their name or description.
|
boolean |
updateLocalizationText(RealmModel realm,
String locale,
String key,
String text) |
protected ClientModel |
validateCache(RealmModel realm,
CachedClient cached) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClientRole, addClientRole, createGroup, createGroup, createGroup, decreaseRemainingCount, getAlwaysDisplayInConsoleClients, getClientByClientId, getClientById, getClientRole, getClientRoles, getClientRoles, getClients, getClients, getClientScopeById, getGroupById, getGroups, getGroupsByRole, getRealmRoles, getRealmRoles, getRealms, getRealmsWithProviderType, getRoleById, getTopLevelGroups, getTopLevelGroups, listClientInitialAccess, removeClient, removeRole, searchClientsByClientId, searchForClientRoles, searchForGroupByName, searchForRoles
getGroupsStream, getGroupsStream
protected static final org.jboss.logging.Logger logger
public static final String REALM_CLIENTS_QUERY_SUFFIX
public static final String ROLES_QUERY_SUFFIX
protected RealmCacheManager cache
protected KeycloakSession session
protected RealmProvider realmDelegate
protected ClientProvider clientDelegate
protected ClientScopeProvider clientScopeDelegate
protected GroupProvider groupDelegate
protected RoleProvider roleDelegate
protected boolean transactionActive
protected boolean setRollbackOnly
protected Map<String,RealmAdapter> managedRealms
protected Map<String,ClientModel> managedApplications
protected Map<String,ClientScopeAdapter> managedClientScopes
protected Map<String,RoleAdapter> managedRoles
protected Map<String,GroupAdapter> managedGroups
protected Set<InvalidationEvent> invalidationEvents
protected boolean clearAll
protected final long startupRevision
public RealmCacheSession(RealmCacheManager cache, KeycloakSession session)
public long getStartupRevision()
public boolean isInvalid(String id)
public void clear()
clear
in interface CacheRealmProvider
public RealmProvider getRealmDelegate()
getRealmDelegate
in interface CacheRealmProvider
public ClientProvider getClientDelegate()
public ClientScopeProvider getClientScopeDelegate()
public RoleProvider getRoleDelegate()
public GroupProvider getGroupDelegate()
public void registerRealmInvalidation(String id, String name)
registerRealmInvalidation
in interface CacheRealmProvider
public void registerClientInvalidation(String id, String clientId, String realmId)
registerClientInvalidation
in interface CacheRealmProvider
public void registerClientScopeInvalidation(String id, String realmId)
registerClientScopeInvalidation
in interface CacheRealmProvider
public void registerRoleInvalidation(String id, String roleName, String roleContainerId)
registerRoleInvalidation
in interface CacheRealmProvider
public void registerGroupInvalidation(String id)
registerGroupInvalidation
in interface CacheRealmProvider
protected void runInvalidations()
public RealmModel createRealm(String name)
RealmProvider
createRealm
in interface RealmProvider
name
- String name of the realmpublic RealmModel createRealm(String id, String name)
RealmProvider
createRealm
in interface RealmProvider
id
- Internal ID of the realm or null
if one is to be created by the underlying storename
- String name of the realmpublic RealmModel getRealm(String id)
RealmProvider
getRealm
in interface RealmProvider
id
- Internal ID of the realm.public RealmModel getRealmByName(String name)
RealmProvider
getRealmByName
in interface RealmProvider
name
- String name of the realmpublic Stream<RealmModel> getRealmsWithProviderTypeStream(Class<?> type)
RealmProvider
getRealmsWithProviderTypeStream
in interface RealmProvider
type
- Class<?>
Type of the provider.RealmModel
. Never returns null
.public Stream<RealmModel> getRealmsStream()
RealmProvider
getRealmsStream
in interface RealmProvider
RealmModel
. Never returns null
.public boolean removeRealm(String id)
RealmProvider
removeRealm
in interface RealmProvider
id
- of realm.true
if the realm was successfully removed.public void evictRealmOnRemoval(RealmModel realm)
public ClientModel addClient(RealmModel realm, String clientId)
ClientProvider
clientId
to the given realm.
The internal ID of the client will be created automatically.addClient
in interface ClientProvider
addClient
in interface RealmProvider
realm
- Realm owning this client.clientId
- String that identifies the client to the external parties.
Maps to client_id
in OIDC or entityID
in SAML.public ClientModel addClient(RealmModel realm, String id, String clientId)
ClientProvider
clientId
to the given realm.addClient
in interface ClientProvider
addClient
in interface RealmProvider
realm
- Realm owning this client.id
- Internal ID of the client or null
if one is to be created by the underlying storeclientId
- String that identifies the client to the external parties.
Maps to client_id
in OIDC or entityID
in SAML.public Stream<ClientModel> getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults)
ClientProvider
getClientsStream
in interface ClientProvider
realm
- Realm.firstResult
- First result to return. Ignored if negative or null
.maxResults
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<ClientModel> getClientsStream(RealmModel realm)
ClientProvider
getClientsStream(realm, null, null)
.getClientsStream
in interface ClientProvider
realm
- Realm.null
.public Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)
ClientProvider
getAlwaysDisplayInConsoleClientsStream
in interface ClientProvider
realm
- Realm owning the clients.null
.public Map<ClientModel,Set<String>> getAllRedirectUrisOfEnabledClients(RealmModel realm)
ClientProvider
getAllRedirectUrisOfEnabledClients
in interface ClientProvider
public void removeClients(RealmModel realm)
ClientProvider
removeClients
in interface ClientProvider
realm
- Realm.public boolean removeClient(RealmModel realm, String id)
ClientProvider
removeClient
in interface ClientProvider
realm
- Realm.id
- Internal ID of the clienttrue
if the client existed and has been removed, false
otherwise.public RoleModel addRealmRole(RealmModel realm, String name)
RoleProvider
name
to the given realm.
The internal ID of the role will be created automatically.addRealmRole
in interface RealmProvider
addRealmRole
in interface RoleProvider
realm
- Realm owning this role.name
- String name of the role.public RoleModel addRealmRole(RealmModel realm, String id, String name)
RoleProvider
name
to the given realm.addRealmRole
in interface RealmProvider
addRealmRole
in interface RoleProvider
realm
- Realm owning this role.id
- Internal ID of the role or null
if one is to be created by the underlying storename
- String name of the role.public Stream<RoleModel> getRealmRolesStream(RealmModel realm)
RoleProvider
getRealmRolesStream(realm, null, null)
.getRealmRolesStream
in interface RoleProvider
realm
- Realm.null
.public Stream<RoleModel> getClientRolesStream(ClientModel client)
RoleProvider
getClientRoles(client, null, null)
.getClientRolesStream
in interface RoleProvider
client
- Client.null
.public Stream<RoleModel> getRealmRolesStream(RealmModel realm, Integer first, Integer max)
RoleProvider
getRealmRolesStream
in interface RoleProvider
realm
- Realm.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<RoleModel> getClientRolesStream(ClientModel client, Integer first, Integer max)
RoleProvider
getClientRolesStream
in interface RoleProvider
client
- Client.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<RoleModel> searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max)
RoleLookupProvider
searchForClientRolesStream
in interface RoleLookupProvider
client
- Client.search
- String to search by role's name or description.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<RoleModel> searchForRolesStream(RealmModel realm, String search, Integer first, Integer max)
RoleLookupProvider
searchForRolesStream
in interface RoleLookupProvider
realm
- Realm.search
- Searched substring of the role's name or description.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public RoleModel addClientRole(ClientModel client, String name)
RoleProvider
name
to the given client.
The internal ID of the role will be created automatically.addClientRole
in interface RoleProvider
client
- Client owning this role.name
- String name of the role.public RoleModel addClientRole(ClientModel client, String id, String name)
RoleProvider
name
to the given client.addClientRole
in interface RoleProvider
client
- Client owning this role.id
- Internal ID of the client role or null
if one is to be created by the underlying store.name
- String name of the role.public RoleModel getRealmRole(RealmModel realm, String name)
RoleLookupProvider
getRealmRole
in interface RealmProvider
getRealmRole
in interface RoleLookupProvider
realm
- Realm.name
- String name of the role.null
if no role is found.public RoleModel getClientRole(ClientModel client, String name)
RoleLookupProvider
getClientRole
in interface RoleLookupProvider
client
- Client.name
- String name of the role.null
if no role is found.public boolean removeRole(RoleModel role)
RoleProvider
removeRole
in interface RoleProvider
role
- Role to be removed.true
if the role existed and has been removed, false
otherwise.public void removeRoles(RealmModel realm)
RoleProvider
removeRoles
in interface RoleProvider
realm
- Realm.public void removeRoles(ClientModel client)
RoleProvider
removeRoles
in interface RoleProvider
client
- Client.public RoleModel getRoleById(RealmModel realm, String id)
RoleLookupProvider
getRoleById
in interface RoleLookupProvider
realm
- Realm.id
- Internal ID of the role.public GroupModel getGroupById(RealmModel realm, String id)
GroupLookupProvider
getGroupById
in interface RealmProvider
getGroupById
in interface GroupLookupProvider
realm
- Realm.id
- Id.public void moveGroup(RealmModel realm, GroupModel group, GroupModel toParent)
GroupProvider
moveGroup
in interface GroupProvider
moveGroup
in interface RealmProvider
realm
- Realm owning this group.group
- Group to update.toParent
- New parent group, or null
if we are moving the group to top level group.public Stream<GroupModel> getGroupsStream(RealmModel realm)
GroupProvider
getGroupsStream
in interface GroupProvider
realm
- Realm.public Stream<GroupModel> getGroupsStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max)
GroupProvider
getGroupsStream
in interface GroupProvider
realm
- Realm.ids
- Stream of ids.search
- Case insensitive string which will be searched for. Ignored if null.first
- Index of the first result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public Long getGroupsCount(RealmModel realm, Stream<String> ids, String search)
GroupProvider
getGroupsCount
in interface GroupProvider
realm
- Realm.ids
- List of ids.search
- Case insensitive string which will be searched for. Ignored if null.public Long getGroupsCount(RealmModel realm, Boolean onlyTopGroups)
GroupProvider
getGroupsCount
in interface GroupProvider
getGroupsCount
in interface RealmProvider
realm
- Realm.onlyTopGroups
- When true the function returns a count of top level groups only.public long getClientsCount(RealmModel realm)
ClientProvider
getClientsCount
in interface ClientProvider
getClientsCount
in interface RealmProvider
realm
- Realm.public Long getGroupsCountByNameContaining(RealmModel realm, String search)
GroupProvider
getGroupsCountByNameContaining
in interface GroupProvider
getGroupsCountByNameContaining
in interface RealmProvider
realm
- Realm.search
- Case insensitive string which will be searched for.public Stream<GroupModel> getGroupsByRoleStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)
GroupProvider
getGroupsByRoleStream
in interface GroupProvider
realm
- Realm.role
- Role.firstResult
- First result to return. Ignored if negative or null
.maxResults
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm)
GroupProvider
getTopLevelGroupsStream
in interface GroupProvider
realm
- Realm.null
.public Stream<GroupModel> getTopLevelGroupsStream(RealmModel realm, Integer first, Integer max)
GroupProvider
getTopLevelGroupsStream
in interface GroupProvider
realm
- Realm.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<GroupModel> searchForGroupByNameStream(RealmModel realm, String search, Integer first, Integer max)
GroupLookupProvider
searchForGroupByNameStream
in interface GroupLookupProvider
realm
- Realm.search
- Case sensitive searched string.first
- First result to return. Ignored if negative or null
.max
- Maximum number of results to return. Ignored if negative or null
.null
.public boolean removeGroup(RealmModel realm, GroupModel group)
GroupProvider
removeGroup
in interface GroupProvider
removeGroup
in interface RealmProvider
realm
- Realm.group
- Group.public GroupModel createGroup(RealmModel realm, String id, String name, GroupModel toParent)
GroupProvider
createGroup
in interface GroupProvider
createGroup
in interface RealmProvider
realm
- Realm.id
- Id, will be generated if null
.name
- Name.toParent
- Parent group, or null
if the group is top level grouppublic void addTopLevelGroup(RealmModel realm, GroupModel subGroup)
GroupProvider
addTopLevelGroup
in interface GroupProvider
addTopLevelGroup
in interface RealmProvider
realm
- Realm.subGroup
- Group.public ClientModel getClientById(RealmModel realm, String id)
ClientLookupProvider
getClientById
in interface ClientLookupProvider
realm
- Realm to limit the search.id
- Internal IDnull
if no client is found.protected ClientModel cacheClient(RealmModel realm, ClientModel delegate, Long revision)
protected ClientModel validateCache(RealmModel realm, CachedClient cached)
public Stream<ClientModel> searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults)
ClientLookupProvider
searchClientsByClientIdStream
in interface ClientLookupProvider
realm
- Realm to limit the search for clients.clientId
- Searched substring of the public client
identifier (client_id
in OIDC or entityID
in SAML.)firstResult
- First result to return. Ignored if negative or null
.maxResults
- Maximum number of results to return. Ignored if negative or null
.null
.public Stream<ClientModel> searchClientsByAttributes(RealmModel realm, Map<String,String> attributes, Integer firstResult, Integer maxResults)
searchClientsByAttributes
in interface ClientLookupProvider
public ClientModel getClientByClientId(RealmModel realm, String clientId)
ClientLookupProvider
getClientByClientId
in interface ClientLookupProvider
realm
- Realm to limit the search for clients.clientId
- String that identifies the client to the external parties.
Maps to client_id
in OIDC or entityID
in SAML.null
if no client is found.public ClientScopeModel getClientScopeById(RealmModel realm, String id)
ClientScopeLookupProvider
getClientScopeById
in interface RealmProvider
getClientScopeById
in interface ClientScopeLookupProvider
realm
- Realm.id
- Internal ID of the role.public Stream<ClientScopeModel> getClientScopesStream(RealmModel realm)
ClientScopeProvider
getClientScopesStream
in interface ClientScopeProvider
realm
- Realm.null
.public ClientScopeModel addClientScope(RealmModel realm, String name)
ClientScopeProvider
name
to the given realm.
Spaces in name
will be replaced by underscore so that scope name
can be used as value of scope parameter. The internal ID will be created automatically.addClientScope
in interface ClientScopeProvider
realm
- Realm owning this client scope.name
- String name of the client scope.public ClientScopeModel addClientScope(RealmModel realm, String id, String name)
ClientScopeProvider
name
to the given realm.
Spaces in name
will be replaced by underscore so that scope name
can be used as value of scope parameter.addClientScope
in interface ClientScopeProvider
realm
- Realm owning this client scope.id
- Internal ID of the client scope or null
if one is to be created by the underlying storename
- String name of the client scope.public boolean removeClientScope(RealmModel realm, String id)
ClientScopeProvider
removeClientScope
in interface ClientScopeProvider
realm
- Realm.id
- Internal ID of the client scopetrue
if the client scope existed and has been removed, false
otherwise.public void removeClientScopes(RealmModel realm)
ClientScopeProvider
removeClientScopes
in interface ClientScopeProvider
realm
- Realm.public void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope)
ClientProvider
addClientScopes
in interface ClientProvider
realm
- Realm.client
- Client.clientScopes
- to be assigneddefaultScope
- if true the scopes are assigned as default, or optional in case of falsepublic void removeClientScope(RealmModel realm, ClientModel client, ClientScopeModel clientScope)
ClientProvider
removeClientScope
in interface ClientProvider
realm
- Realm.client
- Client.clientScope
- to be unassignedpublic Map<String,ClientScopeModel> getClientScopes(RealmModel realm, ClientModel client, boolean defaultScopes)
ClientLookupProvider
defaultScope
is true
) or all optional scopes (if defaultScope
is false
) linked with the clientgetClientScopes
in interface ClientLookupProvider
realm
- Realmclient
- ClientdefaultScopes
- if true default scopes, if false optional scopes, are returnedpublic ClientInitialAccessModel createClientInitialAccessModel(RealmModel realm, int expiration, int count)
createClientInitialAccessModel
in interface RealmProvider
public ClientInitialAccessModel getClientInitialAccessModel(RealmModel realm, String id)
getClientInitialAccessModel
in interface RealmProvider
public void removeClientInitialAccessModel(RealmModel realm, String id)
removeClientInitialAccessModel
in interface RealmProvider
public Stream<ClientInitialAccessModel> listClientInitialAccessStream(RealmModel realm)
RealmProvider
listClientInitialAccessStream
in interface RealmProvider
realm
- RealmModel
The realm where to list client's initial access.ClientInitialAccessModel
. Never returns null
.public void removeExpiredClientInitialAccess()
RealmProvider
removeExpiredClientInitialAccess
in interface RealmProvider
public void saveLocalizationText(RealmModel realm, String locale, String key, String text)
saveLocalizationText
in interface RealmProvider
public void saveLocalizationTexts(RealmModel realm, String locale, Map<String,String> localizationTexts)
saveLocalizationTexts
in interface RealmProvider
public boolean updateLocalizationText(RealmModel realm, String locale, String key, String text)
updateLocalizationText
in interface RealmProvider
public boolean deleteLocalizationTextsByLocale(RealmModel realm, String locale)
deleteLocalizationTextsByLocale
in interface RealmProvider
public boolean deleteLocalizationText(RealmModel realm, String locale, String key)
deleteLocalizationText
in interface RealmProvider
public String getLocalizationTextsById(RealmModel realm, String locale, String key)
getLocalizationTextsById
in interface RealmProvider
Copyright © 2021 JBoss by Red Hat. All rights reserved.