Package org.keycloak.models
Interface ClientProvider
- All Superinterfaces:
ClientLookupProvider
,Provider
- All Known Subinterfaces:
CacheRealmProvider
- All Known Implementing Classes:
ClientStorageManager
,JpaRealmProvider
,RealmCacheSession
Provider of the client records.
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Method Summary
Modifier and TypeMethodDescriptiondefault ClientModel
addClient
(RealmModel realm, String clientId) Adds a client with givenclientId
to the given realm.addClient
(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
addClientScopeToAllClients
(RealmModel realm, ClientScopeModel clientScope, boolean defaultClientScope) Add specified client scope to all non bearer-only clients in the realm, which have same protocol as specified client scope.Deprecated.Do not use, this is only to support a deprecated logout endpoint and will vanish with it's removalReturns a stream of clients that are expected to always show up in account console.long
getClientsCount
(RealmModel realm) Returns number of clients in the given realmdefault Stream<ClientModel>
getClientsStream
(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.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.Methods inherited from interface org.keycloak.storage.client.ClientLookupProvider
getClientByClientId, getClientById, getClientScopes, searchClientsByAttributes, searchClientsByAuthenticationFlowBindingOverrides, searchClientsByClientIdStream
-
Method Details
-
getClientsStream
Returns the clients of the given realm as a stream.- 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
Returns all the clients of the given realm as a stream. Effectively the same as the callgetClientsStream(realm, null, null)
.- Parameters:
realm
- Realm.- Returns:
- Stream of the clients. Never returns
null
.
-
addClient
Adds a client with givenclientId
to the given realm. The internal ID of the client will be created automatically.- Parameters:
realm
- Realm owning this client.clientId
- String that identifies the client to the external parties. Maps toclient_id
in OIDC orentityID
in SAML.- Returns:
- Model of the created client.
-
addClient
Adds a client with given internal ID andclientId
to the given realm.- 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.
- Throws:
IllegalArgumentException
- Ifid
does not conform the format understood by the underlying store.
-
getClientsCount
Returns number of clients in the given realm- Parameters:
realm
- Realm.- Returns:
- Number of the clients in the given realm.
-
getAlwaysDisplayInConsoleClientsStream
Returns a stream of clients that are expected to always show up in account console.- Parameters:
realm
- Realm owning the clients.- Returns:
- Stream of the clients. Never returns
null
.
-
removeClient
Removes given client from the given realm.- Parameters:
realm
- Realm.id
- Internal ID of the client- Returns:
true
if the client existed and has been removed,false
otherwise.
-
removeClients
Removes all clients from the given realm.- Parameters:
realm
- Realm.
-
addClientScopes
void addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope) Assign clientScopes to the client. Add as default scopes (if parameter 'defaultScope' is true) or optional scopes (if parameter 'defaultScope' is false)- Parameters:
realm
- Realm.client
- Client.clientScopes
- to be assigneddefaultScope
- if true the scopes are assigned as default, or optional in case of false
-
removeClientScope
Unassign clientScope from the client.- Parameters:
realm
- Realm.client
- Client.clientScope
- to be unassigned
-
addClientScopeToAllClients
void addClientScopeToAllClients(RealmModel realm, ClientScopeModel clientScope, boolean defaultClientScope) Add specified client scope to all non bearer-only clients in the realm, which have same protocol as specified client scope. Method may be used just for new client scopes, which are not yet assigned to any clients as if specified clientScope is already assigned to some client, there might be issues related to duplicate entries.- Parameters:
realm
- RealmclientScope
- client scope from the specified realm, which would be added to all clientsdefaultClientScope
- If true, then it will be added as "default" client scope. If false, then it will be added as "optional" client scope
-
getAllRedirectUrisOfEnabledClients
Deprecated.Do not use, this is only to support a deprecated logout endpoint and will vanish with it's removalReturns a map of (rootUrl, {validRedirectUris}) for all enabled clients.- Parameters:
realm
-- Returns:
-