Search in sources :

Example 1 with ResourceAdminManager

use of org.keycloak.services.managers.ResourceAdminManager in project keycloak by keycloak.

the class RealmAdminResource method pushRevocation.

/**
 * Push the realm's revocation policy to any client that has an admin url associated with it.
 */
@Path("push-revocation")
@POST
public GlobalRequestResult pushRevocation() {
    auth.realm().requireManageRealm();
    GlobalRequestResult result = new ResourceAdminManager(session).pushRealmRevocationPolicy(realm);
    adminEvent.operation(OperationType.ACTION).resourcePath(session.getContext().getUri()).representation(result).success();
    return result;
}
Also used : ResourceAdminManager(org.keycloak.services.managers.ResourceAdminManager) GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 2 with ResourceAdminManager

use of org.keycloak.services.managers.ResourceAdminManager in project keycloak by keycloak.

the class RealmAdminResource method logoutAll.

/**
 * Removes all user sessions.  Any client that has an admin url will also be told to invalidate any sessions
 * they have.
 */
@Path("logout-all")
@POST
@Produces(MediaType.APPLICATION_JSON)
public GlobalRequestResult logoutAll() {
    auth.users().requireManage();
    session.sessions().removeUserSessions(realm);
    GlobalRequestResult result = new ResourceAdminManager(session).logoutAll(realm);
    adminEvent.operation(OperationType.ACTION).resourcePath(session.getContext().getUri()).representation(result).success();
    return result;
}
Also used : ResourceAdminManager(org.keycloak.services.managers.ResourceAdminManager) GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 3 with ResourceAdminManager

use of org.keycloak.services.managers.ResourceAdminManager in project keycloak by keycloak.

the class ClientResource method pushRevocation.

/**
 * Push the client's revocation policy to its admin URL
 *
 * If the client has an admin URL, push revocation policy to it.
 */
@Path("push-revocation")
@POST
@Produces(MediaType.APPLICATION_JSON)
public GlobalRequestResult pushRevocation() {
    auth.clients().requireConfigure(client);
    adminEvent.operation(OperationType.ACTION).resourcePath(session.getContext().getUri()).resource(ResourceType.CLIENT).success();
    return new ResourceAdminManager(session).pushClientRevocationPolicy(realm, client);
}
Also used : ResourceAdminManager(org.keycloak.services.managers.ResourceAdminManager) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 4 with ResourceAdminManager

use of org.keycloak.services.managers.ResourceAdminManager in project keycloak by keycloak.

the class ClientResource method testNodesAvailable.

/**
 * Test if registered cluster nodes are available
 *
 * Tests availability by sending 'ping' request to all cluster nodes.
 *
 * @return
 */
@Path("test-nodes-available")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public GlobalRequestResult testNodesAvailable() {
    auth.clients().requireConfigure(client);
    logger.debug("Test availability of cluster nodes");
    GlobalRequestResult result = new ResourceAdminManager(session).testNodesAvailability(realm, client);
    adminEvent.operation(OperationType.ACTION).resource(ResourceType.CLUSTER_NODE).resourcePath(session.getContext().getUri()).representation(result).success();
    return result;
}
Also used : ResourceAdminManager(org.keycloak.services.managers.ResourceAdminManager) GlobalRequestResult(org.keycloak.representations.adapters.action.GlobalRequestResult) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Aggregations

Path (javax.ws.rs.Path)4 ResourceAdminManager (org.keycloak.services.managers.ResourceAdminManager)4 POST (javax.ws.rs.POST)3 Produces (javax.ws.rs.Produces)3 GlobalRequestResult (org.keycloak.representations.adapters.action.GlobalRequestResult)3 GET (javax.ws.rs.GET)1 NoCache (org.jboss.resteasy.annotations.cache.NoCache)1