Package org.keycloak.models.map.client
Class MapClientProvider
java.lang.Object
org.keycloak.models.map.client.MapClientProvider
- All Implemented Interfaces:
ClientProvider
,Provider
,ClientLookupProvider
-
Constructor Summary
ConstructorDescriptionMapClientProvider
(KeycloakSession session, MapStorage<MapClientEntity, ClientModel> clientStore, ConcurrentMap<String, ConcurrentMap<String, Long>> clientRegisteredNodesStore) -
Method Summary
Modifier and TypeMethodDescriptionaddClient
(RealmModel realm, String id, String clientId) Adds a client with given internal ID andclientId
to the given realm.void
addClientScopes
(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) Assign clientScopes to the client.void
close()
Returns a map of (rootUrl, {validRedirectUris}) for all enabled clients.Returns a stream of clients that are expected to always show up in account console.getClientByClientId
(RealmModel realm, String clientId) Exact search for a client by its public client identifier.getClientById
(RealmModel realm, String id) Exact search for a client by its internal ID.getClientScopes
(RealmModel realm, ClientModel client, boolean defaultScopes) Return all default scopes (ifdefaultScope
istrue
) or all optional scopes (ifdefaultScope
isfalse
) linked with the clientlong
getClientsCount
(RealmModel realm) Returns number of clients in the given realmgetClientsStream
(RealmModel realm) Returns all the clients of the given realm as a stream.getClientsStream
(RealmModel realm, Integer firstResult, Integer maxResults) Returns the clients of the given realm as a stream.void
preRemove
(RealmModel realm) 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.searchClientsByAttributes
(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) searchClientsByClientIdStream
(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) Case-insensitive search for clients that contain the given string in their public client identifier.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.ClientProvider
addClient
-
Constructor Details
-
MapClientProvider
public MapClientProvider(KeycloakSession session, MapStorage<MapClientEntity, ClientModel> clientStore, ConcurrentMap<String, ConcurrentMap<String, Long>> clientRegisteredNodesStore)
-
-
Method Details
-
getClientsStream
public Stream<ClientModel> getClientsStream(RealmModel realm, Integer firstResult, Integer maxResults) Description copied from interface:ClientProvider
Returns the clients of the given realm as a stream.- Specified by:
getClientsStream
in interfaceClientProvider
- Parameters:
realm
- Realm.firstResult
- First result to return. Ignored if negative ornull
.maxResults
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- Stream of the clients. Never returns
null
.
-
getClientsStream
Description copied from interface:ClientProvider
Returns all the clients of the given realm as a stream. Effectively the same as the callgetClientsStream(realm, null, null)
.- Specified by:
getClientsStream
in interfaceClientProvider
- Parameters:
realm
- Realm.- Returns:
- Stream of the clients. Never returns
null
.
-
addClient
Description copied from interface:ClientProvider
Adds a client with given internal ID andclientId
to the given realm.- Specified by:
addClient
in interfaceClientProvider
- Parameters:
realm
- Realm owning this client.id
- Internal ID of the client ornull
if one is to be created by the underlying storeclientId
- String that identifies the client to the external parties. Maps toclient_id
in OIDC orentityID
in SAML.- Returns:
- Model of the created client.
-
getAlwaysDisplayInConsoleClientsStream
Description copied from interface:ClientProvider
Returns a stream of clients that are expected to always show up in account console.- Specified by:
getAlwaysDisplayInConsoleClientsStream
in interfaceClientProvider
- Parameters:
realm
- Realm owning the clients.- Returns:
- Stream of the clients. Never returns
null
.
-
removeClients
Description copied from interface:ClientProvider
Removes all clients from the given realm.- Specified by:
removeClients
in interfaceClientProvider
- Parameters:
realm
- Realm.
-
removeClient
Description copied from interface:ClientProvider
Removes given client from the given realm.- Specified by:
removeClient
in interfaceClientProvider
- Parameters:
realm
- Realm.id
- Internal ID of the client- Returns:
true
if the client existed and has been removed,false
otherwise.
-
getClientsCount
Description copied from interface:ClientProvider
Returns number of clients in the given realm- Specified by:
getClientsCount
in interfaceClientProvider
- Parameters:
realm
- Realm.- Returns:
- Number of the clients in the given realm.
-
getClientById
Description copied from interface:ClientLookupProvider
Exact search for a client by its internal ID.- Specified by:
getClientById
in interfaceClientLookupProvider
- Parameters:
realm
- Realm to limit the search.id
- Internal ID- Returns:
- Model of the client, or
null
if no client is found.
-
getClientByClientId
Description copied from interface:ClientLookupProvider
Exact search for a client by its public client identifier.- Specified by:
getClientByClientId
in interfaceClientLookupProvider
- Parameters:
realm
- Realm to limit the search for clients.clientId
- String that identifies the client to the external parties. Maps toclient_id
in OIDC orentityID
in SAML.- Returns:
- Model of the client, or
null
if no client is found.
-
searchClientsByClientIdStream
public Stream<ClientModel> searchClientsByClientIdStream(RealmModel realm, String clientId, Integer firstResult, Integer maxResults) Description copied from interface:ClientLookupProvider
Case-insensitive search for clients that contain the given string in their public client identifier.- Specified by:
searchClientsByClientIdStream
in interfaceClientLookupProvider
- Parameters:
realm
- Realm to limit the search for clients.clientId
- Searched substring of the public client identifier (client_id
in OIDC orentityID
in SAML.)firstResult
- First result to return. Ignored if negative ornull
.maxResults
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- Stream of ClientModel or an empty stream if no client is found. Never returns
null
.
-
searchClientsByAttributes
public Stream<ClientModel> searchClientsByAttributes(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) - Specified by:
searchClientsByAttributes
in interfaceClientLookupProvider
-
addClientScopes
public void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) Description copied from interface:ClientProvider
Assign clientScopes to the client. Add as default scopes (if parameter 'defaultScope' is true) or optional scopes (if parameter 'defaultScope' is false)- Specified by:
addClientScopes
in interfaceClientProvider
- Parameters:
realm
- Realm.client
- Client.clientScopes
- to be assigneddefaultScope
- if true the scopes are assigned as default, or optional in case of false
-
removeClientScope
Description copied from interface:ClientProvider
Unassign clientScope from the client.- Specified by:
removeClientScope
in interfaceClientProvider
- Parameters:
realm
- Realm.client
- Client.clientScope
- to be unassigned
-
getClientScopes
public Map<String,ClientScopeModel> getClientScopes(RealmModel realm, ClientModel client, boolean defaultScopes) Description copied from interface:ClientLookupProvider
Return all default scopes (ifdefaultScope
istrue
) or all optional scopes (ifdefaultScope
isfalse
) linked with the client- Specified by:
getClientScopes
in interfaceClientLookupProvider
- Parameters:
realm
- Realmclient
- ClientdefaultScopes
- if true default scopes, if false optional scopes, are returned- Returns:
- map where key is the name of the clientScope, value is particular clientScope. Returns empty map if no scopes linked (never returns null).
-
getAllRedirectUrisOfEnabledClients
Description copied from interface:ClientProvider
Returns a map of (rootUrl, {validRedirectUris}) for all enabled clients.- Specified by:
getAllRedirectUrisOfEnabledClients
in interfaceClientProvider
- Returns:
-
preRemove
-
preRemove
-
close
public void close()
-