org.keycloak.services.resources.admin

## Class RealmAdminResource

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

-     public class RealmAdminResource
      extends Object

  Base resource class for the admin REST api of one realm
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RealmAuth` | `auth`
    `protected static org.jboss.logging.Logger` | `logger`
    `protected ProviderSession` | `providers`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`
    `protected javax.ws.rs.core.UriInfo` | `uriInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RealmAdminResource(RealmAuth auth, RealmModel realm, TokenManager tokenManager)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearAudit()` Delete all audit events.
    `void` | `deleteRealm()` Delete this realm.
    `void` | `deleteSession(String sessionId)` Remove a specific user session.
    `ApplicationsResource` | `getApplications()` Base path for managing applications under this realm.
    `Map<String,Integer>` | `getApplicationSessionStats()` Returns a JSON map.
    `List<Event>` | `getAudit(String client, String event, String user, String ipAddress, Integer firstResult, Integer maxResults)` Query audit events.
    `OAuthClientsResource` | `getOAuthClients()` base path for managing oauth clients in this realm
    `RealmRepresentation` | `getRealm()` Get the top-level representation of the realm.
    `RealmAuditRepresentation` | `getRealmAudit()` View the audit provider and how it is configured.
    `RoleContainerResource` | `getRoleContainerResource()` base path for managing realm-level roles of this realm
    `Map<String,SessionStats>` | `getSessionStats()` Any application that has an admin URL will be asked directly how many sessions they have active and what users are involved with those sessions.
    `void` | `logoutAll()` Removes all user sessions.
    `void` | `pushRevocation()` Push the realm's revocation policy to any application that has an admin url associated with it.
    `RoleByIdResource` | `rolesById()` Path for managing all realm-level or application-level roles defined in this realm by it's id.
    `javax.ws.rs.core.Response` | `updateRealm(RealmRepresentation rep)` Update the top-level information of this realm.
    `void` | `updateRealmAudit(RealmAuditRepresentation rep)` Change the audit provider and/or it's configuration
    `UsersResource` | `users()` Base path for managing users in this realm.

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

    - #### auth

          protected RealmAuth auth

    - #### realm

          protected RealmModel realm

    - #### session

          @Context
          protected KeycloakSession session

    - #### providers

          @Context
          protected ProviderSession providers

    - #### uriInfo

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

  - ### Constructor Detail

    - #### RealmAdminResource

          public RealmAdminResource(RealmAuth auth,
                            RealmModel realm,
                            TokenManager tokenManager)

  - ### Method Detail

    - #### getApplications

          @Path(value="applications")
          public ApplicationsResource getApplications()

      Base path for managing applications under this realm.
      Returns:

    - #### getOAuthClients

          @Path(value="oauth-clients")
          public OAuthClientsResource getOAuthClients()

      base path for managing oauth clients in this realm
      Returns:

    - #### getRoleContainerResource

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

      base path for managing realm-level roles of this realm
      Returns:

    - #### getRealm

          @GET
          @Produces(value="application/json")
          public RealmRepresentation getRealm()

      Get the top-level representation of the realm. It will not include nested information like User, Application, or OAuth Client representations.
      Returns:

    - #### updateRealm

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

      Update the top-level information of this realm. Any user, roles, application, or oauth client information in the representation will be ignored. This will only update top-level attributes of the realm.
      Parameters:
        `rep` -
      Returns:

    - #### deleteRealm

          @DELETE
          public void deleteRealm()

      Delete this realm.

    - #### users

          @Path(value="users")
          public UsersResource users()

      Base path for managing users in this realm.
      Returns:

    - #### rolesById

          @Path(value="roles-by-id")
          public RoleByIdResource rolesById()

      Path for managing all realm-level or application-level roles defined in this realm by it's id.
      Returns:

    - #### pushRevocation

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

      Push the realm's revocation policy to any application that has an admin url associated with it.

    - #### logoutAll

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

      Removes all user sessions. Any application that has an admin url will also be told to invalidate any sessions they have.

    - #### deleteSession

          @Path(value="sessions/{session}")
          @DELETE
          public void deleteSession(@PathParam(value="session")
                                       String sessionId)

      Remove a specific user session. Any application that has an admin url will also be told to invalidate this particular session.
      Parameters:
        `sessionId` -

    - #### getApplicationSessionStats

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

      Returns a JSON map. The key is the application name, the value is the number of sessions that currently are active with that application. Only application's that actually have a session associated with them will be in this map.
      Returns:

    - #### getSessionStats

          @Path(value="session-stats")
          @GET
          @Produces(value="application/json")
          public Map<String,SessionStats> getSessionStats()

      Any application that has an admin URL will be asked directly how many sessions they have active and what users are involved with those sessions.
      Returns:

    - #### getRealmAudit

          @GET
          @Path(value="audit")
          @Produces(value="application/json")
          public RealmAuditRepresentation getRealmAudit()

      View the audit provider and how it is configured.
      Returns:

    - #### updateRealmAudit

          @PUT
          @Path(value="audit")
          @Consumes(value="application/json")
          public void updateRealmAudit(RealmAuditRepresentation rep)

      Change the audit provider and/or it's configuration
      Parameters:
        `rep` -

    - #### getAudit

          @Path(value="audit/events")
          @GET
          @Produces(value="application/json")
          public List<Event> getAudit(@QueryParam(value="client")
                                               String client,
                                               @QueryParam(value="event")
                                               String event,
                                               @QueryParam(value="user")
                                               String user,
                                               @QueryParam(value="ipAddress")
                                               String ipAddress,
                                               @QueryParam(value="first")
                                               Integer firstResult,
                                               @QueryParam(value="max")
                                               Integer maxResults)

      Query audit events. Returns all events, or will query based on URL query parameters listed here
      Parameters:
        `client` - app or oauth client name
        `event` - event type
        `user` - user id
        `ipAddress` -
        `firstResult` -
        `maxResults` -
      Returns:

    - #### clearAudit

          @Path(value="audit/events")
          @DELETE
          public void clearAudit()

      Delete all audit events.

Copyright © 2014. All Rights Reserved.