org.keycloak.models.map.client

## Class AbstractClientModel<E extends AbstractEntity>

- java.lang.Object
- - org.keycloak.models.map.client.AbstractClientModel<E>

- All Implemented Interfaces:
    ClientModel, ClientScopeModel, OrderedModel, ProtocolMapperContainerModel, RoleContainerModel, ScopeContainerModel
  Direct Known Subclasses:
    MapClientAdapter

      public abstract class AbstractClientModel<E extends AbstractEntity>
      extends Object
      implements ClientModel

  Author:
    hmlnarik

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.ClientModel

      `ClientModel.ClientCreationEvent, ClientModel.ClientProtocolUpdatedEvent, ClientModel.ClientRemovedEvent, ClientModel.ClientUpdatedEvent, ClientModel.SearchableFields`

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.ClientScopeModel

      `ClientScopeModel.ClientScopeRemovedEvent`

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.OrderedModel

      `OrderedModel.OrderedModelComparator<OM extends OrderedModel>`

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.RoleContainerModel

      `RoleContainerModel.RoleRemovedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected E` | `entity`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`

    - ### Fields inherited from interface org.keycloak.models.ClientModel

      `PRIVATE_KEY, PUBLIC_KEY, X509CERTIFICATE`

    - ### Fields inherited from interface org.keycloak.models.ClientScopeModel

      `CONSENT_SCREEN_TEXT, DISPLAY_ON_CONSENT_SCREEN, GUI_ORDER, INCLUDE_IN_TOKEN_SCOPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractClientModel(KeycloakSession session, RealmModel realm, E entity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClientScope(ClientScopeModel clientScope, boolean defaultScope)` Add clientScope with this client.
    `void` | `addClientScopes(Set<ClientScopeModel> clientScopes, boolean defaultScope)` Add clientScopes with this client.
    `RoleModel` | `addRole(String name)`
    `RoleModel` | `addRole(String id, String name)`
    `boolean` | `equals(Object o)`
    `Map<String,ClientScopeModel>` | `getClientScopes(boolean defaultScope)` Return all default scopes (if 'defaultScope' is true) or all optional scopes (if 'defaultScope' is false) linked with this client
    `Stream<RoleModel>` | `getRealmScopeMappingsStream()` From the scope mappings returned by `ScopeContainerModel.getScopeMappingsStream()` returns only those that belong to the realm that owns this scope container.
    `RoleModel` | `getRole(String name)`
    `Stream<RoleModel>` | `getRolesStream()` Returns available roles as a stream.
    `Stream<RoleModel>` | `getRolesStream(Integer firstResult, Integer maxResults)` Returns available roles as a stream.
    `int` | `hashCode()`
    `void` | `removeClientScope(ClientScopeModel clientScope)`
    `boolean` | `removeRole(RoleModel role)`
    `Stream<RoleModel>` | `searchForRolesStream(String search, Integer first, Integer max)` Searches roles by the given name.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.keycloak.models.ClientModel

      `addRedirectUri, addWebOrigin, getAttribute, getAttributes, getAuthenticationFlowBindingOverride, getAuthenticationFlowBindingOverrides, getBaseUrl, getClientAuthenticatorType, getClientId, getConsentScreenText, getDescription, getDynamicClientScope, getId, getManagementUrl, getName, getNodeReRegistrationTimeout, getNotBefore, getProtocol, getRealm, getRedirectUris, getRegisteredNodes, getRegistrationToken, getRootUrl, getSecret, getWebOrigins, isAlwaysDisplayInConsole, isBearerOnly, isConsentRequired, isDirectAccessGrantsEnabled, isDisplayOnConsentScreen, isEnabled, isFrontchannelLogout, isFullScopeAllowed, isImplicitFlowEnabled, isPublicClient, isServiceAccountsEnabled, isStandardFlowEnabled, isSurrogateAuthRequired, registerNode, removeAttribute, removeAuthenticationFlowBindingOverride, removeRedirectUri, removeWebOrigin, setAlwaysDisplayInConsole, setAttribute, setAuthenticationFlowBindingOverride, setBaseUrl, setBearerOnly, setClientAuthenticatorType, setClientId, setConsentRequired, setDescription, setDirectAccessGrantsEnabled, setEnabled, setFrontchannelLogout, setFullScopeAllowed, setImplicitFlowEnabled, setManagementUrl, setName, setNodeReRegistrationTimeout, setNotBefore, setProtocol, setPublicClient, setRedirectUris, setRegistrationToken, setRootUrl, setSecret, setServiceAccountsEnabled, setStandardFlowEnabled, setSurrogateAuthRequired, setWebOrigins, unregisterNode, updateClient, validateSecret`

    - ### Methods inherited from interface org.keycloak.models.ClientScopeModel

      `getGuiOrder, isIncludeInTokenScope, setConsentScreenText, setDisplayOnConsentScreen, setGuiOrder, setIncludeInTokenScope`

    - ### Methods inherited from interface org.keycloak.models.ProtocolMapperContainerModel

      `addProtocolMapper, getProtocolMapperById, getProtocolMapperByName, getProtocolMappers, getProtocolMappersStream, removeProtocolMapper, updateProtocolMapper`

    - ### Methods inherited from interface org.keycloak.models.ScopeContainerModel

      `addScopeMapping, deleteScopeMapping, getRealmScopeMappings, getScopeMappings, getScopeMappingsStream, hasScope`

    - ### Methods inherited from interface org.keycloak.models.RoleContainerModel

      `addDefaultRole, getDefaultRoles, getDefaultRolesStream, getRoles, getRoles, removeDefaultRoles, searchForRoles, updateDefaultRoles`

- - ### Field Detail

    - #### session

          protected final KeycloakSession session

    - #### realm

          protected final RealmModel realm

    - #### entity

          protected final E extends AbstractEntity entity

  - ### Constructor Detail

    - #### AbstractClientModel

          public AbstractClientModel(KeycloakSession session,
                                     RealmModel realm,
                                     E entity)

  - ### Method Detail

    - #### addClientScopes

          public void addClientScopes(Set<ClientScopeModel> clientScopes,
                                      boolean defaultScope)

      Description copied from interface: `ClientModel`
      Add clientScopes with this client. Add as default scopes (if parameter 'defaultScope' is true) or optional scopes (if parameter 'defaultScope' is false)
      Specified by:
        `addClientScopes` in interface `ClientModel`

    - #### addClientScope

          public void addClientScope(ClientScopeModel clientScope,
                                     boolean defaultScope)

      Description copied from interface: `ClientModel`
      Add clientScope with this client. Add it as default scope (if parameter 'defaultScope' is true) or optional scope (if parameter 'defaultScope' is false)
      Specified by:
        `addClientScope` in interface `ClientModel`

    - #### removeClientScope

          public void removeClientScope(ClientScopeModel clientScope)

      Specified by:
        `removeClientScope` in interface `ClientModel`

    - #### getClientScopes

          public Map<String,ClientScopeModel> getClientScopes(boolean defaultScope)

      Description copied from interface: `ClientModel`
      Return all default scopes (if 'defaultScope' is true) or all optional scopes (if 'defaultScope' is false) linked with this client
      Specified by:
        `getClientScopes` in interface `ClientModel`
      Returns:
        map where key is the name of the clientScope, value is particular clientScope. Returns empty map if no scopes linked (never returns null).

    - #### getRealmScopeMappingsStream

          public Stream<RoleModel> getRealmScopeMappingsStream()

      Description copied from interface: `ScopeContainerModel`
      From the scope mappings returned by `ScopeContainerModel.getScopeMappingsStream()` returns only those that belong to the realm that owns this scope container.
      Specified by:
        `getRealmScopeMappingsStream` in interface `ScopeContainerModel`
      Returns:
        stream of `RoleModel`. Never returns `null`.

    - #### getRole

          public RoleModel getRole(String name)

      Specified by:
        `getRole` in interface `RoleContainerModel`

    - #### addRole

          public RoleModel addRole(String name)

      Specified by:
        `addRole` in interface `RoleContainerModel`

    - #### addRole

          public RoleModel addRole(String id,
                                   String name)

      Specified by:
        `addRole` in interface `RoleContainerModel`

    - #### removeRole

          public boolean removeRole(RoleModel role)

      Specified by:
        `removeRole` in interface `RoleContainerModel`

    - #### getRolesStream

          public Stream<RoleModel> getRolesStream()

      Description copied from interface: `RoleContainerModel`
      Returns available roles as a stream.
      Specified by:
        `getRolesStream` in interface `RoleContainerModel`
      Returns:
        Stream of `RoleModel`. Never returns `null`.

    - #### getRolesStream

          public Stream<RoleModel> getRolesStream(Integer firstResult,
                                                  Integer maxResults)

      Description copied from interface: `RoleContainerModel`
      Returns available roles as a stream.
      Specified by:
        `getRolesStream` in interface `RoleContainerModel`
      Parameters:
        `firstResult` - `Integer` Index of the first desired role. Ignored if negative or `null`.
        `maxResults` - `Integer` Maximum number of returned roles. Ignored if negative or `null`.
      Returns:
        Stream of `RoleModel`. Never returns `null`.

    - #### searchForRolesStream

          public Stream<RoleModel> searchForRolesStream(String search,
                                                        Integer first,
                                                        Integer max)

      Description copied from interface: `RoleContainerModel`
      Searches roles by the given name. Returns all roles that match the given filter.
      Specified by:
        `searchForRolesStream` in interface `RoleContainerModel`
      Parameters:
        `search` - `String` Name of the role to be used as a filter.
        `first` - `Integer` Index of the first desired role. Ignored if negative or `null`.
        `max` - `Integer` Maximum number of returned roles. Ignored if negative or `null`.
      Returns:
        Stream of `RoleModel`. Never returns `null`.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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