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 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` | `clearEvents()` Delete all 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>` | `getEvents(String client, String type, String user, String ipAddress, Integer firstResult, Integer maxResults)` Query events.
    `OAuthClientsResource` | `getOAuthClients()` base path for managing oauth clients in this realm
    `RealmRepresentation` | `getRealm()` Get the top-level representation of the realm.
    `RealmEventsConfigRepresentation` | `getRealmEventsConfig()` View the events 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` | `testLDAPConnection(String action, String connectionUrl, String bindDn, String bindCredential)`
    `javax.ws.rs.core.Response` | `updateRealm(RealmRepresentation rep)` Update the top-level information of this realm.
    `void` | `updateRealmEventsConfig(RealmEventsConfigRepresentation rep)` Change the events provider and/or it's configuration
    `UserFederationResource` | `userFederation()`
    `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

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

    - #### userFederation

          @Path(value="user-federation")
          public UserFederationResource userFederation()

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

    - #### getRealmEventsConfig

          @GET
          @Path(value="events/config")
          @Produces(value="application/json")
          public RealmEventsConfigRepresentation getRealmEventsConfig()

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

    - #### updateRealmEventsConfig

          @PUT
          @Path(value="events/config")
          @Consumes(value="application/json")
          public void updateRealmEventsConfig(RealmEventsConfigRepresentation rep)

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

    - #### getEvents

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

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

    - #### clearEvents

          @Path(value="events")
          @DELETE
          public void clearEvents()

      Delete all events.

    - #### testLDAPConnection

          @Path(value="testLDAPConnection")
          @GET
          public javax.ws.rs.core.Response testLDAPConnection(@QueryParam(value="action")
                                                              String action,
                                                              @QueryParam(value="connectionUrl")
                                                              String connectionUrl,
                                                              @QueryParam(value="bindDn")
                                                              String bindDn,
                                                              @QueryParam(value="bindCredential")
                                                              String bindCredential)

Copyright © 2014. All Rights Reserved.