org.keycloak.models

## Interface ClientProvider

- All Superinterfaces:
    ClientLookupProvider, Provider
  All Known Subinterfaces:
    CacheRealmProvider, RealmProvider
  All Known Implementing Classes:
    ClientStorageManager, JpaRealmProvider, MapClientProvider, MapRealmProvider, RealmCacheSession

      public interface ClientProvider
      extends ClientLookupProvider, Provider

  Provider of the client records.
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `default 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.
    `void` | `addClientScopes(RealmModel realm, ClientModel client, Set<ClientScopeModel> clientScopes, boolean defaultScope)` Assign clientScopes to the client.
    `default List<ClientModel>` | `getAlwaysDisplayInConsoleClients(RealmModel realm)` Deprecated. use the stream variant instead
    `Stream<ClientModel>` | `getAlwaysDisplayInConsoleClientsStream(RealmModel realm)` Returns a stream of clients that are expected to always show up in account console.
    `default List<ClientModel>` | `getClients(RealmModel realm)` Deprecated. use the stream variant instead Effectively the same as the call `getClients(realm, null, null)`.
    `default List<ClientModel>` | `getClients(RealmModel realm, Integer firstResult, Integer maxResults)` Deprecated. use the stream variant instead
    `long` | `getClientsCount(RealmModel realm)` Returns number of clients in the given realm
    `default 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.
    `boolean` | `removeClient(RealmModel realm, String id)` Removes given client from the given realm.
    `default boolean` | `removeClient(String id, RealmModel realm)` Deprecated. Use `removeClient(RealmModel, String)` instead.
    `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, getClientByClientId, getClientById, getClientById, getClientScopes, searchClientsByClientId, searchClientsByClientIdStream`

    - ### Methods inherited from interface org.keycloak.provider.Provider

      `close`

- - ### Method Detail

    - #### getClients

          @Deprecated
          default List<ClientModel> getClients(RealmModel realm,
                                                           Integer firstResult,
                                                           Integer maxResults)

      Deprecated. use the stream variant instead
      Returns the clients of the given realm.
      Parameters:
        `realm` - Realm.
        `firstResult` - First result to return. Ignored if negative or `null`.
        `maxResults` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        List of the clients. Never returns `null`.

    - #### getClientsStream

          Stream<ClientModel> getClientsStream(RealmModel realm,
                                               Integer firstResult,
                                               Integer maxResults)

      Returns the clients of the given realm as a stream.
      Parameters:
        `realm` - Realm.
        `firstResult` - First result to return. Ignored if negative or `null`.
        `maxResults` - Maximum number of results to return. Ignored if negative or `null`.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### getClients

          @Deprecated
          default List<ClientModel> getClients(RealmModel realm)

      Deprecated. use the stream variant instead Effectively the same as the call `getClients(realm, null, null)`.
      Returns all the clients of the given realm.
      Parameters:
        `realm` - Realm.
      Returns:
        List of the clients. Never returns `null`.

    - #### getClientsStream

          default Stream<ClientModel> getClientsStream(RealmModel realm)

      Returns all the clients of the given realm as a stream. Effectively the same as the call `getClientsStream(realm, null, null)`.
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### addClient

          default ClientModel addClient(RealmModel realm,
                                        String clientId)

      Adds a client with given `clientId` 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 to `client_id` in OIDC or `entityID` in SAML.
      Returns:
        Model of the created client.

    - #### addClient

          ClientModel addClient(RealmModel realm,
                                String id,
                                String clientId)

      Adds a client with given internal ID and `clientId` to the given realm.
      Parameters:
        `realm` - Realm owning this client.
        `id` - Internal ID of the client or `null` if one is to be created by the underlying store
        `clientId` - String that identifies the client to the external parties. Maps to `client_id` in OIDC or `entityID` in SAML.
      Returns:
        Model of the created client.
      Throws:
        `IllegalArgumentException` - If `id` does not conform the format understood by the underlying store.

    - #### getClientsCount

          long getClientsCount(RealmModel realm)

      Returns number of clients in the given realm
      Parameters:
        `realm` - Realm.
      Returns:
        Number of the clients in the given realm.

    - #### getAlwaysDisplayInConsoleClients

          @Deprecated
          default List<ClientModel> getAlwaysDisplayInConsoleClients(RealmModel realm)

      Deprecated. use the stream variant instead
      Returns a list of clients that are expected to always show up in account console.
      Parameters:
        `realm` - Realm owning the clients.
      Returns:
        List of the clients. Never returns `null`.

    - #### getAlwaysDisplayInConsoleClientsStream

          Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)

      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

          default boolean removeClient(String id,
                                       RealmModel realm)

      Deprecated. Use `removeClient(RealmModel, String)` instead.
      Removes given client from the given realm.
      Parameters:
        `id` - Internal ID of the client
        `realm` - Realm.
      Returns:
        `true` if the client existed and has been removed, `false` otherwise.

    - #### removeClient

          boolean removeClient(RealmModel realm,
                               String id)

      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

          void removeClients(RealmModel realm)

      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 assigned
        `defaultScope` - if true the scopes are assigned as default, or optional in case of false

    - #### removeClientScope

          void removeClientScope(RealmModel realm,
                                 ClientModel client,
                                 ClientScopeModel clientScope)

      Unassign clientScope from the client.
      Parameters:
        `realm` - Realm.
        `client` - Client.
        `clientScope` - to be unassigned

Copyright © 2021 JBoss by Red Hat. All rights reserved.