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 ClientConnection` | `connection`
    `protected javax.ws.rs.core.HttpHeaders` | `headers`
    `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.
    `List<Map<String,String>>` | `getApplicationByIdSessionStats()` Returns a JSON map.
    `Object` | `getApplicationImporter(String formatId)` Base path for importing applications under this realm.
    `ApplicationsResource` | `getApplications()` Base path for managing applications under this realm.
    `ApplicationsByIdResource` | `getApplicationsById()` Base path for managing applications under this realm.
    `Map<String,Integer>` | `getApplicationSessionStats()` Deprecated.
    `List<Event>` | `getEvents(String client, String user, String dateFrom, String dateTo, String ipAddress, Integer firstResult, Integer maxResults)` Query events.
    `IdentityProvidersResource` | `getIdentityProviderResource()`
    `OAuthClientsResource` | `getOAuthClients()` base path for managing oauth clients in this realm uses name of client
    `OAuthClientsByIdResource` | `getOAuthClientsById()` base path for managing oauth clients in this realm uses ids
    `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
    `GlobalRequestResult` | `logoutAll()` Removes all user sessions.
    `GlobalRequestResult` | `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

    - #### connection

          @Context
          protected ClientConnection connection

    - #### headers

          @Context
          protected javax.ws.rs.core.HttpHeaders headers

  - ### Constructor Detail

    - #### RealmAdminResource

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

  - ### Method Detail

    - #### getApplicationImporter

          @Path(value="application-importers/{formatId}")
          public Object getApplicationImporter(@PathParam(value="formatId")
                                           String formatId)

      Base path for importing applications under this realm.
      Returns:

    - #### getApplications

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

      Base path for managing applications under this realm.
      Returns:

    - #### getApplicationsById

          @Path(value="applications-by-id")
          public ApplicationsByIdResource getApplicationsById()

      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 uses name of client
      Returns:

    - #### getOAuthClientsById

          @Path(value="oauth-clients-by-id")
          public OAuthClientsByIdResource getOAuthClientsById()

      base path for managing oauth clients in this realm uses ids
      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 GlobalRequestResult 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 GlobalRequestResult 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")
          @Deprecated
          public Map<String,Integer> getApplicationSessionStats()

      Deprecated.
      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:

    - #### getApplicationByIdSessionStats

          @Path(value="application-by-id-session-stats")
          @GET
          @Produces(value="application/json")
          public List<Map<String,String>> getApplicationByIdSessionStats()

      Returns a JSON map. The key is the application id, 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:

    - #### 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="user")
                                                String user,
                                                @QueryParam(value="dateFrom")
                                                String dateFrom,
                                                @QueryParam(value="dateTo")
                                                String dateTo,
                                                @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
        `types` - 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)

    - #### getIdentityProviderResource

          @Path(value="identity-provider")
          public IdentityProvidersResource getIdentityProviderResource()

Copyright © 2015. All rights reserved.