Class RoleContainerResource
java.lang.Object
org.keycloak.services.resources.admin.RoleResource
org.keycloak.services.resources.admin.RoleContainerResource
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRoleContainerResource
(KeycloakSession session, jakarta.ws.rs.core.UriInfo uriInfo, RealmModel realm, AdminPermissionEvaluator auth, RoleContainerModel roleContainer, AdminEventBuilder adminEvent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComposites
(String roleName, List<RoleRepresentation> roles) Add a composite to the rolejakarta.ws.rs.core.Response
Create a new role for the realm or clientvoid
deleteComposites
(String roleName, List<RoleRepresentation> roles) Remove roles from the role's compositevoid
deleteRole
(String roleName) Delete a role by namegetClientRoleComposites
(String roleName, String clientUuid) Get client-level roles for the client that are in the role's compositegetGroupsInRole
(String roleName, Integer firstResult, Integer maxResults, boolean briefRepresentation) Returns a stream of groups that have the specified role namegetManagementPermissions
(String roleName) Return object stating whether role Authorization permissions have been initialized or not and a referencegetRealmRoleComposites
(String roleName) Get realm-level roles of the role's compositeGet a role by namegetRoleComposites
(String roleName) Get composites of the roleGet all roles for the realm or clientgetUsersInRole
(String roleName, Boolean briefRepresentation, Integer firstResult, Integer maxResults) Returns a stream of users that have the specified role name.setManagementPermissionsEnabled
(String roleName, ManagementPermissionReference ref) Return object stating whether role Authorization permissions have been initialized or not and a referencejakarta.ws.rs.core.Response
updateRole
(String roleName, RoleRepresentation rep) Update a role by nameMethods inherited from class org.keycloak.services.resources.admin.RoleResource
addComposites, deleteComposites, deleteRole, getClientRoleComposites, getRealmRoleComposites, getRole, updateRole
-
Field Details
-
auth
-
roleContainer
-
-
Constructor Details
-
RoleContainerResource
public RoleContainerResource(KeycloakSession session, jakarta.ws.rs.core.UriInfo uriInfo, RealmModel realm, AdminPermissionEvaluator auth, RoleContainerModel roleContainer, AdminEventBuilder adminEvent)
-
-
Method Details
-
getRoles
@GET @Produces("application/json") public Stream<RoleRepresentation> getRoles(@QueryParam("search") @DefaultValue("") String search, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults, @QueryParam("briefRepresentation") @DefaultValue("true") boolean briefRepresentation) Get all roles for the realm or client- Returns:
-
createRole
@POST @Consumes("application/json") public jakarta.ws.rs.core.Response createRole(RoleRepresentation rep) Create a new role for the realm or client- Parameters:
rep
-- Returns:
-
getRole
@Path("{role-name}") @GET @Produces("application/json") public RoleRepresentation getRole(@PathParam("role-name") String roleName) Get a role by name- Parameters:
roleName
- role's name (not id!)- Returns:
-
deleteRole
Delete a role by name- Parameters:
roleName
- role's name (not id!)
-
updateRole
@Path("{role-name}") @PUT @Consumes("application/json") public jakarta.ws.rs.core.Response updateRole(@PathParam("role-name") String roleName, RoleRepresentation rep) Update a role by name- Parameters:
roleName
- role's name (not id!)rep
-- Returns:
-
addComposites
@Path("{role-name}/composites") @POST @Consumes("application/json") public void addComposites(@PathParam("role-name") String roleName, List<RoleRepresentation> roles) Add a composite to the role- Parameters:
roleName
- role's name (not id!)roles
-
-
getRoleComposites
@Path("{role-name}/composites") @GET @Produces("application/json") public Stream<RoleRepresentation> getRoleComposites(@PathParam("role-name") String roleName) Get composites of the role- Parameters:
roleName
- role's name (not id!)- Returns:
-
getRealmRoleComposites
@Path("{role-name}/composites/realm") @GET @Produces("application/json") public Stream<RoleRepresentation> getRealmRoleComposites(@PathParam("role-name") String roleName) Get realm-level roles of the role's composite- Parameters:
roleName
- role's name (not id!)- Returns:
-
getClientRoleComposites
@Path("{role-name}/composites/clients/{client-uuid}") @GET @Produces("application/json") public Stream<RoleRepresentation> getClientRoleComposites(@PathParam("role-name") String roleName, @PathParam("client-uuid") String clientUuid) Get client-level roles for the client that are in the role's composite- Parameters:
roleName
- role's name (not id!)clientUuid
-- Returns:
-
deleteComposites
@Path("{role-name}/composites") @DELETE @Consumes("application/json") public void deleteComposites(@PathParam("role-name") String roleName, List<RoleRepresentation> roles) Remove roles from the role's composite- Parameters:
roleName
- role's name (not id!)roles
- roles to remove
-
getManagementPermissions
@Path("{role-name}/management/permissions") @GET @Produces("application/json") public ManagementPermissionReference getManagementPermissions(@PathParam("role-name") String roleName) Return object stating whether role Authorization permissions have been initialized or not and a reference- Parameters:
roleName
-- Returns:
-
setManagementPermissionsEnabled
@Path("{role-name}/management/permissions") @PUT @Produces("application/json") @Consumes("application/json") public ManagementPermissionReference setManagementPermissionsEnabled(@PathParam("role-name") String roleName, ManagementPermissionReference ref) Return object stating whether role Authorization permissions have been initialized or not and a reference- Parameters:
roleName
-- Returns:
- initialized manage permissions reference
-
getUsersInRole
@Path("{role-name}/users") @GET @Produces("application/json") public Stream<UserRepresentation> getUsersInRole(@PathParam("role-name") String roleName, @QueryParam("briefRepresentation") Boolean briefRepresentation, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults) Returns a stream of users that have the specified role name.- Parameters:
roleName
- the role name.firstResult
- first result to return. Ignored if negative ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.briefRepresentation
- Boolean which defines whether brief representations are returned (default: false)- Returns:
- a non-empty
Stream
of users.
-
getGroupsInRole
@Path("{role-name}/groups") @GET @Produces("application/json") public Stream<GroupRepresentation> getGroupsInRole(@PathParam("role-name") String roleName, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults, @QueryParam("briefRepresentation") @DefaultValue("true") boolean briefRepresentation) Returns a stream of groups that have the specified role name- Parameters:
roleName
- the role name.firstResult
- first result to return. Ignored if negative ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.briefRepresentation
- if false, return a full representation of theGroupRepresentation
objects.- Returns:
- a non-empty
Stream
of groups.
-