org.keycloak.services.resources.admin

## Class ApplicationResource

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

-     public class ApplicationResource
      extends Object

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ApplicationModel` | `application`
    `protected KeycloakApplication` | `keycloak`
    `protected static org.jboss.logging.Logger` | `logger`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`
    `protected javax.ws.rs.core.UriInfo` | `uriInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApplicationResource(RealmModel realm, RealmAuth auth, ApplicationModel applicationModel, KeycloakSession session)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deleteAllowedOrigins(Set<String> allowedOrigins)` Remove set of allowed origins from current allowed origins list.
    `void` | `deleteApplication()` Delete this application.
    `Set<String>` | `getAllowedOrigins()` Returns set of allowed origin.
    `ApplicationRepresentation` | `getApplication()` Get representation of the application.
    `Map<String,Integer>` | `getApplicationSessionCount()` Number of user sessions associated with this application { "count": number }
    `ClientAttributeCertificateResource` | `getCertficateResource(String attributePrefix)`
    `ClaimResource` | `getClaimResource()` base path for managing allowed application claims
    `CredentialRepresentation` | `getClientSecret()` Get the secret of this application
    `String` | `getInstallation()` Return keycloak.json file for this application to be used to configure the adapter of that application.
    `String` | `getJBossInstallation()` Return XML that can be included in the JBoss/Wildfly Keycloak subsystem to configure the adapter of that application.
    `protected KeycloakApplication` | `getKeycloakApplication()`
    `RoleContainerResource` | `getRoleContainerResource()`
    `ScopeMappedResource` | `getScopeMappedResource()` Base path for managing the scope mappings for this application
    `List<UserSessionRepresentation>` | `getUserSessions(Integer firstResult, Integer maxResults)` Return a list of user sessions associated with this application
    `void` | `logout(String username)` If the application has an admin URL, invalidate the sessions for a particular user directly.
    `GlobalRequestResult` | `logoutAll()` If the application has an admin URL, invalidate all sessions associated with that application directly.
    `GlobalRequestResult` | `pushRevocation()` If the application has an admin URL, push the application's revocation policy to it.
    `CredentialRepresentation` | `regenerateSecret()` Generates a new secret for this application
    `void` | `registerNode(Map<String,String> formParams)` Manually register cluster node to this application - usually it's not needed to call this directly as adapter should handle by sending registration request to Keycloak
    `GlobalRequestResult` | `testNodesAvailable()` Test if registered cluster nodes are available by sending 'ping' request to all of them
    `void` | `unregisterNode(String node)` Unregister cluster node from this application
    `javax.ws.rs.core.Response` | `update(ApplicationRepresentation rep)` Update the application.
    `void` | `updateAllowedOrigins(Set<String> allowedOrigins)` Change the set of allowed origins.

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

    - #### application

          protected ApplicationModel application

    - #### session

          protected KeycloakSession session

    - #### uriInfo

          @Context
          protected javax.ws.rs.core.UriInfo uriInfo

    - #### keycloak

          @Context
          protected KeycloakApplication keycloak

  - ### Constructor Detail

    - #### ApplicationResource

          public ApplicationResource(RealmModel realm,
                             RealmAuth auth,
                             ApplicationModel applicationModel,
                             KeycloakSession session)

  - ### Method Detail

    - #### getKeycloakApplication

          protected KeycloakApplication getKeycloakApplication()

    - #### getClaimResource

          @Path(value="claims")
          public ClaimResource getClaimResource()

      base path for managing allowed application claims
      Returns:

    - #### update

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

      Update the application.
      Parameters:
        `rep` -
      Returns:

    - #### getApplication

          @GET
          @Produces(value="application/json")
          public ApplicationRepresentation getApplication()

      Get representation of the application.
      Returns:

    - #### getCertficateResource

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

      Parameters:
        `attributePrefix` -
      Returns:

    - #### getInstallation

          @GET
          @Path(value="installation/json")
          @Produces(value="application/json")
          public String getInstallation()
                                 throws IOException

      Return keycloak.json file for this application to be used to configure the adapter of that application.
      Returns:
      Throws:
        `IOException`

    - #### getJBossInstallation

          @GET
          @Path(value="installation/jboss")
          @Produces(value="text/plain")
          public String getJBossInstallation()
                                      throws IOException

      Return XML that can be included in the JBoss/Wildfly Keycloak subsystem to configure the adapter of that application.
      Returns:
      Throws:
        `IOException`

    - #### deleteApplication

          @DELETE
          public void deleteApplication()

      Delete this application.

    - #### regenerateSecret

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

      Generates a new secret for this application
      Returns:

    - #### getClientSecret

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

      Get the secret of this application
      Returns:

    - #### getScopeMappedResource

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

      Base path for managing the scope mappings for this application
      Returns:

    - #### getRoleContainerResource

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

    - #### getAllowedOrigins

          @Path(value="allowed-origins")
          @GET
          @Produces(value="application/json")
          public Set<String> getAllowedOrigins()

      Returns set of allowed origin. This is used for CORS requests. Access tokens will have their allowedOrigins claim set to this value for tokens created for this application.
      Returns:

    - #### updateAllowedOrigins

          @Path(value="allowed-origins")
          @PUT
          @Consumes(value="application/json")
          public void updateAllowedOrigins(Set<String> allowedOrigins)

      Change the set of allowed origins. This is used for CORS requests. Access tokens will have their allowedOrigins claim set to this value for tokens created for this application.
      Parameters:
        `allowedOrigins` -

    - #### deleteAllowedOrigins

          @Path(value="allowed-origins")
          @DELETE
          @Consumes(value="application/json")
          public void deleteAllowedOrigins(Set<String> allowedOrigins)

      Remove set of allowed origins from current allowed origins list. This is used for CORS requests. Access tokens will have their allowedOrigins claim set to this value for tokens created for this application.
      Parameters:
        `allowedOrigins` -

    - #### pushRevocation

          @Path(value="push-revocation")
          @POST
          public GlobalRequestResult pushRevocation()

      If the application has an admin URL, push the application's revocation policy to it.

    - #### getApplicationSessionCount

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

      Number of user sessions associated with this application { "count": number }
      Returns:

    - #### getUserSessions

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

      Return a list of user sessions associated with this application
      Returns:

    - #### logoutAll

          @Path(value="logout-all")
          @POST
          public GlobalRequestResult logoutAll()

      If the application has an admin URL, invalidate all sessions associated with that application directly.

    - #### logout

          @Path(value="logout-user/{username}")
          @POST
          public void logout(@PathParam(value="username")
                              String username)

      If the application has an admin URL, invalidate the sessions for a particular user directly.

    - #### registerNode

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

      Manually register cluster node to this application - 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 cluster node from this application
      Parameters:
        `node` -

    - #### testNodesAvailable

          @Path(value="test-nodes-available")
          @GET
          public GlobalRequestResult testNodesAvailable()

      Test if registered cluster nodes are available by sending 'ping' request to all of them
      Returns:

Copyright © 2015. All Rights Reserved.