org.keycloak.services.resources.admin

## Class ClientResource

- java.lang.Object
- - org.keycloak.services.resources.admin.ClientResource

-     public class ClientResource
      extends Object

  Base resource class for managing one particular client of a realm.
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientModel` | `client`
    `protected ClientConnection` | `clientConnection`
    `protected static org.jboss.logging.Logger` | `logger`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientResource(RealmModel realm, AdminPermissionEvaluator auth, ClientModel clientModel, KeycloakSession session, AdminEventBuilder adminEvent)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefaultClientScope(String clientScopeId)`
    `void` | `addOptionalClientScope(String clientScopeId)`
    `AuthorizationService` | `authorization()`
    `ClientScopeEvaluateResource` | `clientScopeEvaluateResource()`
    `void` | `deleteClient()` Delete the client
    `Map<String,Long>` | `getApplicationSessionCount()` Get application session count Returns a number of user sessions associated with this client { "count": number }
    `ClientAttributeCertificateResource` | `getCertficateResource(String attributePrefix)` Get representation of certificate resource
    `ClientRepresentation` | `getClient()` Get representation of the client
    `CredentialRepresentation` | `getClientSecret()` Get the client secret
    `List<ClientScopeRepresentation>` | `getDefaultClientScopes()` Get default client scopes.
    `javax.ws.rs.core.Response` | `getInstallationProvider(String providerId)`
    `ManagementPermissionReference` | `getManagementPermissions()` Return object stating whether client Authorization permissions have been initialized or not and a reference
    `Map<String,Long>` | `getOfflineSessionCount()` Get application offline session count Returns a number of offline user sessions associated with this client { "count": number }
    `Stream<UserSessionRepresentation>` | `getOfflineUserSessions(Integer firstResult, Integer maxResults)` Get offline sessions for client Returns a list of offline user sessions associated with this client
    `List<ClientScopeRepresentation>` | `getOptionalClientScopes()` Get optional client scopes.
    `ProtocolMappersResource` | `getProtocolMappers()`
    `RoleContainerResource` | `getRoleContainerResource()`
    `ScopeMappedResource` | `getScopeMappedResource()` Base path for managing the scope mappings for the client
    `UserRepresentation` | `getServiceAccountUser()` Get a user dedicated to the service account
    `Stream<UserSessionRepresentation>` | `getUserSessions(Integer firstResult, Integer maxResults)` Get user sessions for client Returns a list of user sessions associated with this client
    `GlobalRequestResult` | `pushRevocation()` Push the client's revocation policy to its admin URL If the client has an admin URL, push revocation policy to it.
    `ClientRepresentation` | `regenerateRegistrationAccessToken()` Generate a new registration access token for the client
    `CredentialRepresentation` | `regenerateSecret()` Generate a new secret for the client
    `void` | `registerNode(Map<String,String> formParams)` Register a cluster node with the client Manually register cluster node to this client - usually it's not needed to call this directly as adapter should handle by sending registration request to Keycloak
    `void` | `removeDefaultClientScope(String clientScopeId)`
    `void` | `removeOptionalClientScope(String clientScopeId)`
    `ManagementPermissionReference` | `setManagementPermissionsEnabled(ManagementPermissionReference ref)` Return object stating whether client Authorization permissions have been initialized or not and a reference
    `GlobalRequestResult` | `testNodesAvailable()` Test if registered cluster nodes are available Tests availability by sending 'ping' request to all cluster nodes.
    `static ManagementPermissionReference` | `toMgmtRef(ClientModel client, AdminPermissionManagement permissions)`
    `void` | `unregisterNode(String node)` Unregister a cluster node from the client
    `javax.ws.rs.core.Response` | `update(ClientRepresentation rep)` Update the client

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

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

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

    - #### realm

          protected RealmModel realm

    - #### client

          protected ClientModel client

    - #### session

          protected KeycloakSession session

    - #### clientConnection

          @Context
          protected ClientConnection clientConnection

  - ### Constructor Detail

    - #### ClientResource

          public ClientResource(RealmModel realm,
                                AdminPermissionEvaluator auth,
                                ClientModel clientModel,
                                KeycloakSession session,
                                AdminEventBuilder adminEvent)

  - ### Method Detail

    - #### getProtocolMappers

          @Path(value="protocol-mappers")
          public ProtocolMappersResource getProtocolMappers()

    - #### update

          @PUT
           @Consumes(value="application/json")
          public javax.ws.rs.core.Response update(ClientRepresentation rep)

      Update the client
      Parameters:
        `rep` -
      Returns:

    - #### getClient

          @GET
           @Produces(value="application/json")
          public ClientRepresentation getClient()

      Get representation of the client
      Returns:

    - #### getCertficateResource

          @Path(value="certificates/{attr}")
          public ClientAttributeCertificateResource getCertficateResource(@PathParam(value="attr")
                                                                                                             String attributePrefix)

      Get representation of certificate resource
      Parameters:
        `attributePrefix` -
      Returns:

    - #### getInstallationProvider

          @GET
           @Path(value="installation/providers/{providerId}")
          public javax.ws.rs.core.Response getInstallationProvider(@PathParam(value="providerId")
                                                                                                                            String providerId)

    - #### deleteClient

          @DELETE
          public void deleteClient()

      Delete the client

    - #### regenerateSecret

          @Path(value="client-secret")
           @POST
           @Produces(value="application/json")
           @Consumes(value="application/json")
          public CredentialRepresentation regenerateSecret()

      Generate a new secret for the client
      Returns:

    - #### regenerateRegistrationAccessToken

          @Path(value="registration-access-token")
           @POST
           @Produces(value="application/json")
           @Consumes(value="application/json")
          public ClientRepresentation regenerateRegistrationAccessToken()

      Generate a new registration access token for the client
      Returns:

    - #### getClientSecret

          @Path(value="client-secret")
           @GET
           @Produces(value="application/json")
          public CredentialRepresentation getClientSecret()

      Get the client secret
      Returns:

    - #### getScopeMappedResource

          @Path(value="scope-mappings")
          public ScopeMappedResource getScopeMappedResource()

      Base path for managing the scope mappings for the client
      Returns:

    - #### getRoleContainerResource

          @Path(value="roles")
          public RoleContainerResource getRoleContainerResource()

    - #### getDefaultClientScopes

          @GET
           @Produces(value="application/json")
           @Path(value="default-client-scopes")
          public List<ClientScopeRepresentation> getDefaultClientScopes()

      Get default client scopes. Only name and ids are returned.
      Returns:

    - #### addDefaultClientScope

          @PUT
           @Path(value="default-client-scopes/{clientScopeId}")
          public void addDefaultClientScope(@PathParam(value="clientScopeId")
                                                                                                       String clientScopeId)

    - #### removeDefaultClientScope

          @DELETE
           @Path(value="default-client-scopes/{clientScopeId}")
          public void removeDefaultClientScope(@PathParam(value="clientScopeId")
                                                                                                             String clientScopeId)

    - #### getOptionalClientScopes

          @GET
           @Produces(value="application/json")
           @Path(value="optional-client-scopes")
          public List<ClientScopeRepresentation> getOptionalClientScopes()

      Get optional client scopes. Only name and ids are returned.
      Returns:

    - #### addOptionalClientScope

          @PUT
           @Path(value="optional-client-scopes/{clientScopeId}")
          public void addOptionalClientScope(@PathParam(value="clientScopeId")
                                                                                                         String clientScopeId)

    - #### removeOptionalClientScope

          @DELETE
           @Path(value="optional-client-scopes/{clientScopeId}")
          public void removeOptionalClientScope(@PathParam(value="clientScopeId")
                                                                                                               String clientScopeId)

    - #### clientScopeEvaluateResource

          @Path(value="evaluate-scopes")
          public ClientScopeEvaluateResource clientScopeEvaluateResource()

    - #### getServiceAccountUser

          @Path(value="service-account-user")
           @GET
           @Produces(value="application/json")
          public UserRepresentation getServiceAccountUser()

      Get a user dedicated to the service account
      Returns:

    - #### pushRevocation

          @Path(value="push-revocation")
           @POST
           @Produces(value="application/json")
          public GlobalRequestResult pushRevocation()

      Push the client's revocation policy to its admin URL If the client has an admin URL, push revocation policy to it.

    - #### getApplicationSessionCount

          @Path(value="session-count")
           @GET
           @Produces(value="application/json")
          public Map<String,Long> getApplicationSessionCount()

      Get application session count Returns a number of user sessions associated with this client { "count": number }
      Returns:

    - #### getUserSessions

          @Path(value="user-sessions")
           @GET
           @Produces(value="application/json")
          public Stream<UserSessionRepresentation> getUserSessions(@QueryParam(value="first")
                                                                                                                                           Integer firstResult,
                                                                                                                                           @QueryParam(value="max")
                                                                                                                                           Integer maxResults)

      Get user sessions for client Returns a list of user sessions associated with this client
      Parameters:
        `firstResult` - Paging offset
        `maxResults` - Maximum results size (defaults to 100)
      Returns:

    - #### getOfflineSessionCount

          @Path(value="offline-session-count")
           @GET
           @Produces(value="application/json")
          public Map<String,Long> getOfflineSessionCount()

      Get application offline session count Returns a number of offline user sessions associated with this client { "count": number }
      Returns:

    - #### getOfflineUserSessions

          @Path(value="offline-sessions")
           @GET
           @Produces(value="application/json")
          public Stream<UserSessionRepresentation> getOfflineUserSessions(@QueryParam(value="first")
                                                                                                                                                     Integer firstResult,
                                                                                                                                                     @QueryParam(value="max")
                                                                                                                                                     Integer maxResults)

      Get offline sessions for client Returns a list of offline user sessions associated with this client
      Parameters:
        `firstResult` - Paging offset
        `maxResults` - Maximum results size (defaults to 100)
      Returns:

    - #### registerNode

          @Path(value="nodes")
           @POST
           @Consumes(value="application/json")
          public void registerNode(Map<String,String> formParams)

      Register a cluster node with the client Manually register cluster node to this client - usually it's not needed to call this directly as adapter should handle by sending registration request to Keycloak
      Parameters:
        `formParams` -

    - #### unregisterNode

          @Path(value="nodes/{node}")
           @DELETE
          public void unregisterNode(@PathParam(value="node")
                                                                          String node)

      Unregister a cluster node from the client
      Parameters:
        `node` -

    - #### testNodesAvailable

          @Path(value="test-nodes-available")
           @GET
           @Produces(value="application/json")
          public GlobalRequestResult testNodesAvailable()

      Test if registered cluster nodes are available Tests availability by sending 'ping' request to all cluster nodes.
      Returns:

    - #### authorization

          @Path(value="/authz")
          public AuthorizationService authorization()

    - #### getManagementPermissions

          @Path(value="management/permissions")
           @GET
           @Produces(value="application/json")
          public ManagementPermissionReference getManagementPermissions()

      Return object stating whether client Authorization permissions have been initialized or not and a reference
      Returns:

    - #### toMgmtRef

          public static ManagementPermissionReference toMgmtRef(ClientModel client,
                                                                AdminPermissionManagement permissions)

    - #### setManagementPermissionsEnabled

          @Path(value="management/permissions")
           @PUT
           @Produces(value="application/json")
           @Consumes(value="application/json")
          public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref)

      Return object stating whether client Authorization permissions have been initialized or not and a reference
      Returns:
        initialized manage permissions reference

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