public class MapClientProvider<K> extends Object implements ClientProvider
Constructor and Description |
---|
MapClientProvider(KeycloakSession session,
MapStorage<K,MapClientEntity<K>,ClientModel> clientStore,
ConcurrentMap<K,ConcurrentMap<String,Integer>> clientRegisteredNodesStore) |
Modifier and Type | Method and Description |
---|---|
ClientModel |
addClient(RealmModel realm,
String id,
String clientId)
Adds a client with given internal ID and
clientId to the given realm. |
void |
addClientScopes(RealmModel realm,
ClientModel client,
Set<ClientScopeModel> clientScopes,
boolean defaultScope)
Assign clientScopes to the client.
|
void |
close() |
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.
|
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 |
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.
|
void |
preRemove(RealmModel realm,
RoleModel role) |
boolean |
removeClient(RealmModel realm,
String id)
Removes given client from the given realm.
|
void |
removeClients(RealmModel realm)
Removes all clients from the given realm.
|
void |
removeClientScope(RealmModel realm,
ClientModel client,
ClientScopeModel clientScope)
Unassign clientScope from the client.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClient, getAlwaysDisplayInConsoleClients, getClients, getClients, removeClient
getClientByClientId, getClientById, searchClientsByClientId
public MapClientProvider(KeycloakSession session, MapStorage<K,MapClientEntity<K>,ClientModel> clientStore, ConcurrentMap<K,ConcurrentMap<String,Integer>> clientRegisteredNodesStore)
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 ClientModel addClient(RealmModel realm, String id, String clientId)
ClientProvider
clientId
to the given realm.addClient
in interface ClientProvider
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> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)
ClientProvider
getAlwaysDisplayInConsoleClientsStream
in interface ClientProvider
realm
- Realm owning the clients.null
.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 long getClientsCount(RealmModel realm)
ClientProvider
getClientsCount
in interface ClientProvider
realm
- Realm.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.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 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 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 Map<ClientModel,Set<String>> getAllRedirectUrisOfEnabledClients(RealmModel realm)
ClientProvider
getAllRedirectUrisOfEnabledClients
in interface ClientProvider
public void preRemove(RealmModel realm, RoleModel role)
Copyright © 2021 JBoss by Red Hat. All rights reserved.