org.keycloak.models.jpa

## Class ClientAdapter

- java.lang.Object
- - org.keycloak.models.jpa.ClientAdapter

- All Implemented Interfaces:
    ClientModel, JpaModel<ClientEntity>, ProtocolMapperContainerModel, RoleContainerModel, ScopeContainerModel

      public class ClientAdapter
      extends Object
      implements ClientModel, JpaModel<ClientEntity>

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

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

      `RoleContainerModel.RoleRemovedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.persistence.EntityManager` | `em`
    `protected ClientEntity` | `entity`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`

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

      `PRIVATE_KEY, PUBLIC_KEY, X509CERTIFICATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientAdapter(RealmModel realm, javax.persistence.EntityManager em, KeycloakSession session, ClientEntity entity)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefaultRole(String name)`
    `ProtocolMapperModel` | `addProtocolMapper(ProtocolMapperModel model)`
    `void` | `addRedirectUri(String redirectUri)`
    `RoleModel` | `addRole(String name)`
    `RoleModel` | `addRole(String id, String name)`
    `void` | `addScopeMapping(RoleModel role)`
    `void` | `addWebOrigin(String webOrigin)`
    `static boolean` | `contains(String str, String[] array)`
    `void` | `deleteScopeMapping(RoleModel role)`
    `protected ProtocolMapperModel` | `entityToModel(ProtocolMapperEntity entity)`
    `boolean` | `equals(Object o)`
    `String` | `getAttribute(String name)`
    `Map<String,String>` | `getAttributes()`
    `String` | `getBaseUrl()`
    `String` | `getClientAuthenticatorType()`
    `String` | `getClientId()`
    `ClientTemplateModel` | `getClientTemplate()`
    `List<String>` | `getDefaultRoles()`
    `String` | `getDescription()`
    `ClientEntity` | `getEntity()`
    `String` | `getId()`
    `String` | `getManagementUrl()`
    `String` | `getName()`
    `int` | `getNodeReRegistrationTimeout()`
    `int` | `getNotBefore()` Time in seconds since epoc
    `String` | `getProtocol()`
    `ProtocolMapperModel` | `getProtocolMapperById(String id)`
    `ProtocolMapperModel` | `getProtocolMapperByName(String protocol, String name)`
    `protected ProtocolMapperEntity` | `getProtocolMapperEntity(String id)`
    `protected ProtocolMapperEntity` | `getProtocolMapperEntityByName(String protocol, String name)`
    `Set<ProtocolMapperModel>` | `getProtocolMappers()`
    `RealmModel` | `getRealm()`
    `protected javax.persistence.TypedQuery<ScopeMappingEntity>` | `getRealmScopeMappingQuery(RoleModel role)`
    `Set<RoleModel>` | `getRealmScopeMappings()`
    `Set<String>` | `getRedirectUris()`
    `Map<String,Integer>` | `getRegisteredNodes()`
    `String` | `getRegistrationToken()`
    `RoleModel` | `getRole(String name)`
    `Set<RoleModel>` | `getRoles()`
    `String` | `getRootUrl()`
    `Set<RoleModel>` | `getScopeMappings()`
    `String` | `getSecret()`
    `Set<String>` | `getWebOrigins()`
    `int` | `hashCode()`
    `boolean` | `hasScope(RoleModel role)`
    `boolean` | `isBearerOnly()`
    `boolean` | `isConsentRequired()`
    `boolean` | `isDirectAccessGrantsEnabled()`
    `boolean` | `isEnabled()`
    `boolean` | `isFrontchannelLogout()`
    `boolean` | `isFullScopeAllowed()`
    `boolean` | `isImplicitFlowEnabled()`
    `boolean` | `isPublicClient()`
    `boolean` | `isServiceAccountsEnabled()`
    `boolean` | `isStandardFlowEnabled()`
    `boolean` | `isSurrogateAuthRequired()`
    `void` | `registerNode(String nodeHost, int registrationTime)` Register node or just update the 'lastReRegistration' time if this node is already registered
    `void` | `removeAttribute(String name)`
    `void` | `removeDefaultRoles(String... defaultRoles)`
    `void` | `removeProtocolMapper(ProtocolMapperModel mapping)`
    `void` | `removeRedirectUri(String redirectUri)`
    `boolean` | `removeRole(RoleModel roleModel)`
    `void` | `removeWebOrigin(String webOrigin)`
    `void` | `setAttribute(String name, String value)`
    `void` | `setBaseUrl(String url)`
    `void` | `setBearerOnly(boolean only)`
    `void` | `setClientAuthenticatorType(String clientAuthenticatorType)`
    `void` | `setClientId(String clientId)`
    `void` | `setClientTemplate(ClientTemplateModel template)`
    `void` | `setConsentRequired(boolean consentRequired)`
    `void` | `setDescription(String description)`
    `void` | `setDirectAccessGrantsEnabled(boolean directAccessGrantsEnabled)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setFrontchannelLogout(boolean flag)`
    `void` | `setFullScopeAllowed(boolean value)`
    `void` | `setImplicitFlowEnabled(boolean implicitFlowEnabled)`
    `void` | `setManagementUrl(String url)`
    `void` | `setName(String name)`
    `void` | `setNodeReRegistrationTimeout(int timeout)`
    `void` | `setNotBefore(int notBefore)`
    `void` | `setProtocol(String protocol)`
    `void` | `setPublicClient(boolean flag)`
    `void` | `setRedirectUris(Set<String> redirectUris)`
    `void` | `setRegistrationToken(String registrationToken)`
    `void` | `setRootUrl(String url)`
    `void` | `setSecret(String secret)`
    `void` | `setServiceAccountsEnabled(boolean serviceAccountsEnabled)`
    `void` | `setStandardFlowEnabled(boolean standardFlowEnabled)`
    `void` | `setSurrogateAuthRequired(boolean surrogateAuthRequired)`
    `void` | `setUseTemplateConfig(boolean flag)`
    `void` | `setUseTemplateMappers(boolean flag)`
    `void` | `setUseTemplateScope(boolean flag)`
    `void` | `setWebOrigins(Set<String> webOrigins)`
    `String` | `toString()`
    `void` | `unregisterNode(String nodeHost)`
    `void` | `updateClient()`
    `void` | `updateDefaultRoles(String... defaultRoles)`
    `void` | `updateProtocolMapper(ProtocolMapperModel mapping)`
    `boolean` | `useTemplateConfig()`
    `boolean` | `useTemplateMappers()`
    `boolean` | `useTemplateScope()`
    `boolean` | `validateSecret(String secret)`

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

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

- - ### Field Detail

    - #### session

          protected KeycloakSession session

    - #### realm

          protected RealmModel realm

    - #### em

          protected javax.persistence.EntityManager em

    - #### entity

          protected ClientEntity entity

  - ### Constructor Detail

    - #### ClientAdapter

          public ClientAdapter(RealmModel realm,
                               javax.persistence.EntityManager em,
                               KeycloakSession session,
                               ClientEntity entity)

  - ### Method Detail

    - #### getEntity

          public ClientEntity getEntity()

      Specified by:
        `getEntity` in interface `JpaModel<ClientEntity>`

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `ClientModel`
      Specified by:
        `getId` in interface `RoleContainerModel`

    - #### getRealm

          public RealmModel getRealm()

      Specified by:
        `getRealm` in interface `ClientModel`

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `ClientModel`

    - #### setName

          public void setName(String name)

      Specified by:
        `setName` in interface `ClientModel`

    - #### getDescription

          public String getDescription()

      Specified by:
        `getDescription` in interface `ClientModel`

    - #### setDescription

          public void setDescription(String description)

      Specified by:
        `setDescription` in interface `ClientModel`

    - #### isEnabled

          public boolean isEnabled()

      Specified by:
        `isEnabled` in interface `ClientModel`

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Specified by:
        `setEnabled` in interface `ClientModel`

    - #### isPublicClient

          public boolean isPublicClient()

      Specified by:
        `isPublicClient` in interface `ClientModel`

    - #### setPublicClient

          public void setPublicClient(boolean flag)

      Specified by:
        `setPublicClient` in interface `ClientModel`

    - #### isFrontchannelLogout

          public boolean isFrontchannelLogout()

      Specified by:
        `isFrontchannelLogout` in interface `ClientModel`

    - #### setFrontchannelLogout

          public void setFrontchannelLogout(boolean flag)

      Specified by:
        `setFrontchannelLogout` in interface `ClientModel`

    - #### isFullScopeAllowed

          public boolean isFullScopeAllowed()

      Specified by:
        `isFullScopeAllowed` in interface `ScopeContainerModel`

    - #### setFullScopeAllowed

          public void setFullScopeAllowed(boolean value)

      Specified by:
        `setFullScopeAllowed` in interface `ScopeContainerModel`

    - #### getWebOrigins

          public Set<String> getWebOrigins()

      Specified by:
        `getWebOrigins` in interface `ClientModel`

    - #### setWebOrigins

          public void setWebOrigins(Set<String> webOrigins)

      Specified by:
        `setWebOrigins` in interface `ClientModel`

    - #### addWebOrigin

          public void addWebOrigin(String webOrigin)

      Specified by:
        `addWebOrigin` in interface `ClientModel`

    - #### removeWebOrigin

          public void removeWebOrigin(String webOrigin)

      Specified by:
        `removeWebOrigin` in interface `ClientModel`

    - #### getRedirectUris

          public Set<String> getRedirectUris()

      Specified by:
        `getRedirectUris` in interface `ClientModel`

    - #### setRedirectUris

          public void setRedirectUris(Set<String> redirectUris)

      Specified by:
        `setRedirectUris` in interface `ClientModel`

    - #### addRedirectUri

          public void addRedirectUri(String redirectUri)

      Specified by:
        `addRedirectUri` in interface `ClientModel`

    - #### removeRedirectUri

          public void removeRedirectUri(String redirectUri)

      Specified by:
        `removeRedirectUri` in interface `ClientModel`

    - #### getClientAuthenticatorType

          public String getClientAuthenticatorType()

      Specified by:
        `getClientAuthenticatorType` in interface `ClientModel`

    - #### setClientAuthenticatorType

          public void setClientAuthenticatorType(String clientAuthenticatorType)

      Specified by:
        `setClientAuthenticatorType` in interface `ClientModel`

    - #### getSecret

          public String getSecret()

      Specified by:
        `getSecret` in interface `ClientModel`

    - #### setSecret

          public void setSecret(String secret)

      Specified by:
        `setSecret` in interface `ClientModel`

    - #### getRegistrationToken

          public String getRegistrationToken()

      Specified by:
        `getRegistrationToken` in interface `ClientModel`

    - #### setRegistrationToken

          public void setRegistrationToken(String registrationToken)

      Specified by:
        `setRegistrationToken` in interface `ClientModel`

    - #### validateSecret

          public boolean validateSecret(String secret)

      Specified by:
        `validateSecret` in interface `ClientModel`

    - #### getNotBefore

          public int getNotBefore()

      Description copied from interface: `ClientModel`
      Time in seconds since epoc
      Specified by:
        `getNotBefore` in interface `ClientModel`
      Returns:

    - #### setNotBefore

          public void setNotBefore(int notBefore)

      Specified by:
        `setNotBefore` in interface `ClientModel`

    - #### getRealmScopeMappings

          public Set<RoleModel> getRealmScopeMappings()

      Specified by:
        `getRealmScopeMappings` in interface `ScopeContainerModel`

    - #### getScopeMappings

          public Set<RoleModel> getScopeMappings()

      Specified by:
        `getScopeMappings` in interface `ScopeContainerModel`

    - #### addScopeMapping

          public void addScopeMapping(RoleModel role)

      Specified by:
        `addScopeMapping` in interface `ScopeContainerModel`

    - #### deleteScopeMapping

          public void deleteScopeMapping(RoleModel role)

      Specified by:
        `deleteScopeMapping` in interface `ScopeContainerModel`

    - #### getRealmScopeMappingQuery

          protected javax.persistence.TypedQuery<ScopeMappingEntity> getRealmScopeMappingQuery(RoleModel role)

    - #### getProtocol

          public String getProtocol()

      Specified by:
        `getProtocol` in interface `ClientModel`

    - #### setProtocol

          public void setProtocol(String protocol)

      Specified by:
        `setProtocol` in interface `ClientModel`

    - #### setAttribute

          public void setAttribute(String name,
                                   String value)

      Specified by:
        `setAttribute` in interface `ClientModel`

    - #### removeAttribute

          public void removeAttribute(String name)

      Specified by:
        `removeAttribute` in interface `ClientModel`

    - #### getAttribute

          public String getAttribute(String name)

      Specified by:
        `getAttribute` in interface `ClientModel`

    - #### getAttributes

          public Map<String,String> getAttributes()

      Specified by:
        `getAttributes` in interface `ClientModel`

    - #### getClientTemplate

          public ClientTemplateModel getClientTemplate()

      Specified by:
        `getClientTemplate` in interface `ClientModel`

    - #### setClientTemplate

          public void setClientTemplate(ClientTemplateModel template)

      Specified by:
        `setClientTemplate` in interface `ClientModel`

    - #### useTemplateScope

          public boolean useTemplateScope()

      Specified by:
        `useTemplateScope` in interface `ClientModel`

    - #### setUseTemplateScope

          public void setUseTemplateScope(boolean flag)

      Specified by:
        `setUseTemplateScope` in interface `ClientModel`

    - #### useTemplateMappers

          public boolean useTemplateMappers()

      Specified by:
        `useTemplateMappers` in interface `ClientModel`

    - #### setUseTemplateMappers

          public void setUseTemplateMappers(boolean flag)

      Specified by:
        `setUseTemplateMappers` in interface `ClientModel`

    - #### useTemplateConfig

          public boolean useTemplateConfig()

      Specified by:
        `useTemplateConfig` in interface `ClientModel`

    - #### setUseTemplateConfig

          public void setUseTemplateConfig(boolean flag)

      Specified by:
        `setUseTemplateConfig` in interface `ClientModel`

    - #### contains

          public static boolean contains(String str,
                                         String[] array)

    - #### getProtocolMappers

          public Set<ProtocolMapperModel> getProtocolMappers()

      Specified by:
        `getProtocolMappers` in interface `ProtocolMapperContainerModel`

    - #### addProtocolMapper

          public ProtocolMapperModel addProtocolMapper(ProtocolMapperModel model)

      Specified by:
        `addProtocolMapper` in interface `ProtocolMapperContainerModel`

    - #### getProtocolMapperEntity

          protected ProtocolMapperEntity getProtocolMapperEntity(String id)

    - #### getProtocolMapperEntityByName

          protected ProtocolMapperEntity getProtocolMapperEntityByName(String protocol,
                                                                       String name)

    - #### removeProtocolMapper

          public void removeProtocolMapper(ProtocolMapperModel mapping)

      Specified by:
        `removeProtocolMapper` in interface `ProtocolMapperContainerModel`

    - #### updateProtocolMapper

          public void updateProtocolMapper(ProtocolMapperModel mapping)

      Specified by:
        `updateProtocolMapper` in interface `ProtocolMapperContainerModel`

    - #### getProtocolMapperById

          public ProtocolMapperModel getProtocolMapperById(String id)

      Specified by:
        `getProtocolMapperById` in interface `ProtocolMapperContainerModel`

    - #### getProtocolMapperByName

          public ProtocolMapperModel getProtocolMapperByName(String protocol,
                                                             String name)

      Specified by:
        `getProtocolMapperByName` in interface `ProtocolMapperContainerModel`

    - #### entityToModel

          protected ProtocolMapperModel entityToModel(ProtocolMapperEntity entity)

    - #### updateClient

          public void updateClient()

      Specified by:
        `updateClient` in interface `ClientModel`

    - #### getClientId

          public String getClientId()

      Specified by:
        `getClientId` in interface `ClientModel`

    - #### setClientId

          public void setClientId(String clientId)

      Specified by:
        `setClientId` in interface `ClientModel`

    - #### isSurrogateAuthRequired

          public boolean isSurrogateAuthRequired()

      Specified by:
        `isSurrogateAuthRequired` in interface `ClientModel`

    - #### setSurrogateAuthRequired

          public void setSurrogateAuthRequired(boolean surrogateAuthRequired)

      Specified by:
        `setSurrogateAuthRequired` in interface `ClientModel`

    - #### getManagementUrl

          public String getManagementUrl()

      Specified by:
        `getManagementUrl` in interface `ClientModel`

    - #### setManagementUrl

          public void setManagementUrl(String url)

      Specified by:
        `setManagementUrl` in interface `ClientModel`

    - #### getRootUrl

          public String getRootUrl()

      Specified by:
        `getRootUrl` in interface `ClientModel`

    - #### setRootUrl

          public void setRootUrl(String url)

      Specified by:
        `setRootUrl` in interface `ClientModel`

    - #### getBaseUrl

          public String getBaseUrl()

      Specified by:
        `getBaseUrl` in interface `ClientModel`

    - #### setBaseUrl

          public void setBaseUrl(String url)

      Specified by:
        `setBaseUrl` in interface `ClientModel`

    - #### isBearerOnly

          public boolean isBearerOnly()

      Specified by:
        `isBearerOnly` in interface `ClientModel`

    - #### setBearerOnly

          public void setBearerOnly(boolean only)

      Specified by:
        `setBearerOnly` in interface `ClientModel`

    - #### isConsentRequired

          public boolean isConsentRequired()

      Specified by:
        `isConsentRequired` in interface `ClientModel`

    - #### setConsentRequired

          public void setConsentRequired(boolean consentRequired)

      Specified by:
        `setConsentRequired` in interface `ClientModel`

    - #### isStandardFlowEnabled

          public boolean isStandardFlowEnabled()

      Specified by:
        `isStandardFlowEnabled` in interface `ClientModel`

    - #### setStandardFlowEnabled

          public void setStandardFlowEnabled(boolean standardFlowEnabled)

      Specified by:
        `setStandardFlowEnabled` in interface `ClientModel`

    - #### isImplicitFlowEnabled

          public boolean isImplicitFlowEnabled()

      Specified by:
        `isImplicitFlowEnabled` in interface `ClientModel`

    - #### setImplicitFlowEnabled

          public void setImplicitFlowEnabled(boolean implicitFlowEnabled)

      Specified by:
        `setImplicitFlowEnabled` in interface `ClientModel`

    - #### isDirectAccessGrantsEnabled

          public boolean isDirectAccessGrantsEnabled()

      Specified by:
        `isDirectAccessGrantsEnabled` in interface `ClientModel`

    - #### setDirectAccessGrantsEnabled

          public void setDirectAccessGrantsEnabled(boolean directAccessGrantsEnabled)

      Specified by:
        `setDirectAccessGrantsEnabled` in interface `ClientModel`

    - #### isServiceAccountsEnabled

          public boolean isServiceAccountsEnabled()

      Specified by:
        `isServiceAccountsEnabled` in interface `ClientModel`

    - #### setServiceAccountsEnabled

          public void setServiceAccountsEnabled(boolean serviceAccountsEnabled)

      Specified by:
        `setServiceAccountsEnabled` in interface `ClientModel`

    - #### 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 roleModel)

      Specified by:
        `removeRole` in interface `RoleContainerModel`

    - #### getRoles

          public Set<RoleModel> getRoles()

      Specified by:
        `getRoles` in interface `RoleContainerModel`

    - #### hasScope

          public boolean hasScope(RoleModel role)

      Specified by:
        `hasScope` in interface `ScopeContainerModel`

    - #### getDefaultRoles

          public List<String> getDefaultRoles()

      Specified by:
        `getDefaultRoles` in interface `RoleContainerModel`

    - #### addDefaultRole

          public void addDefaultRole(String name)

      Specified by:
        `addDefaultRole` in interface `RoleContainerModel`

    - #### updateDefaultRoles

          public void updateDefaultRoles(String... defaultRoles)

      Specified by:
        `updateDefaultRoles` in interface `RoleContainerModel`

    - #### removeDefaultRoles

          public void removeDefaultRoles(String... defaultRoles)

      Specified by:
        `removeDefaultRoles` in interface `RoleContainerModel`

    - #### getNodeReRegistrationTimeout

          public int getNodeReRegistrationTimeout()

      Specified by:
        `getNodeReRegistrationTimeout` in interface `ClientModel`

    - #### setNodeReRegistrationTimeout

          public void setNodeReRegistrationTimeout(int timeout)

      Specified by:
        `setNodeReRegistrationTimeout` in interface `ClientModel`

    - #### getRegisteredNodes

          public Map<String,Integer> getRegisteredNodes()

      Specified by:
        `getRegisteredNodes` in interface `ClientModel`

    - #### registerNode

          public void registerNode(String nodeHost,
                                   int registrationTime)

      Description copied from interface: `ClientModel`
      Register node or just update the 'lastReRegistration' time if this node is already registered
      Specified by:
        `registerNode` in interface `ClientModel`

    - #### unregisterNode

          public void unregisterNode(String nodeHost)

      Specified by:
        `unregisterNode` in interface `ClientModel`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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