org.keycloak.models.map.client

## Class MapClientProvider

- java.lang.Object
- - org.keycloak.models.map.client.MapClientProvider

- All Implemented Interfaces:
    ClientProvider, Provider, ClientLookupProvider

      public class MapClientProvider
      extends Object
      implements ClientProvider

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapClientProvider(KeycloakSession session, MapStorage<UUID,MapClientEntity> clientStore, ConcurrentMap<UUID,ConcurrentMap<String,Integer>> clientRegisteredNodesStore)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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` | `close()`
    `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.
    `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.
    `boolean` | `removeClient(RealmModel realm, String id)` Removes given client from the given realm.
    `void` | `removeClients(RealmModel realm)` Removes all clients from the given realm.
    `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.

    - ### 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, getAlwaysDisplayInConsoleClients, getClients, getClients, removeClient`

    - ### Methods inherited from interface org.keycloak.storage.client.ClientLookupProvider

      `getClientByClientId, getClientById, searchClientsByClientId`

- - ### Constructor Detail

    - #### MapClientProvider

          public MapClientProvider(KeycloakSession session,
                                   MapStorage<UUID,MapClientEntity> clientStore,
                                   ConcurrentMap<UUID,ConcurrentMap<String,Integer>> clientRegisteredNodesStore)

  - ### Method Detail

    - #### 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 interface `ClientProvider`
      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`.

    - #### getClientsStream

          public Stream<ClientModel> getClientsStream(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns all the clients of the given realm as a stream. Effectively the same as the call `getClientsStream(realm, null, null)`.
      Specified by:
        `getClientsStream` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### addClient

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

      Description copied from interface: `ClientProvider`
      Adds a client with given internal ID and `clientId` to the given realm.
      Specified by:
        `addClient` in interface `ClientProvider`
      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.

    - #### getAlwaysDisplayInConsoleClientsStream

          public Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns a stream of clients that are expected to always show up in account console.
      Specified by:
        `getAlwaysDisplayInConsoleClientsStream` in interface `ClientProvider`
      Parameters:
        `realm` - Realm owning the clients.
      Returns:
        Stream of the clients. Never returns `null`.

    - #### removeClients

          public void removeClients(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Removes all clients from the given realm.
      Specified by:
        `removeClients` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.

    - #### removeClient

          public boolean removeClient(RealmModel realm,
                                      String id)

      Description copied from interface: `ClientProvider`
      Removes given client from the given realm.
      Specified by:
        `removeClient` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
        `id` - Internal ID of the client
      Returns:
        `true` if the client existed and has been removed, `false` otherwise.

    - #### getClientsCount

          public long getClientsCount(RealmModel realm)

      Description copied from interface: `ClientProvider`
      Returns number of clients in the given realm
      Specified by:
        `getClientsCount` in interface `ClientProvider`
      Parameters:
        `realm` - Realm.
      Returns:
        Number of the clients in the given realm.

    - #### getClientById

          public ClientModel getClientById(RealmModel realm,
                                           String id)

      Description copied from interface: `ClientLookupProvider`
      Exact search for a client by its internal ID.
      Specified by:
        `getClientById` in interface `ClientLookupProvider`
      Parameters:
        `realm` - Realm to limit the search.
        `id` - Internal ID
      Returns:
        Model of the client, or `null` if no client is found.

    - #### getClientByClientId

          public ClientModel getClientByClientId(RealmModel realm,
                                                 String clientId)

      Description copied from interface: `ClientLookupProvider`
      Exact search for a client by its public client identifier.
      Specified by:
        `getClientByClientId` in interface `ClientLookupProvider`
      Parameters:
        `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.
      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 interface `ClientLookupProvider`
      Parameters:
        `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`.
      Returns:
        Stream of ClientModel or an empty stream if no client is found.

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

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