use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RoleContainerResource method getClientRoleComposites.
/**
* Get client-level roles for the client that are in the role's composite
*
* @param roleName role's name (not id!)
* @param clientUuid
* @return
*/
@Path("{role-name}/composites/clients/{clientUuid}")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<RoleRepresentation> getClientRoleComposites(@PathParam("role-name") final String roleName, @PathParam("clientUuid") final String clientUuid) {
auth.roles().requireView(roleContainer);
RoleModel role = roleContainer.getRole(roleName);
if (role == null) {
throw new NotFoundException("Could not find role");
}
ClientModel clientModel = realm.getClientById(clientUuid);
if (clientModel == null) {
throw new NotFoundException("Could not find client");
}
return getClientRoleComposites(clientModel, role);
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RoleContainerResource method getRole.
/**
* Get a role by name
*
* @param roleName role's name (not id!)
* @return
*/
@Path("{role-name}")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public RoleRepresentation getRole(@PathParam("role-name") final String roleName) {
auth.roles().requireView(roleContainer);
RoleModel roleModel = roleContainer.getRole(roleName);
if (roleModel == null) {
throw new NotFoundException("Could not find role");
}
return getRole(roleModel);
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class RoleContainerResource method getUsersInRole.
/**
* Returns a stream of users that have the specified role name.
*
* @param roleName the role name.
* @param firstResult first result to return. Ignored if negative or {@code null}.
* @param maxResults maximum number of results to return. Ignored if negative or {@code null}.
* @return a non-empty {@code Stream} of users.
*/
@Path("{role-name}/users")
@GET
@Produces(MediaType.APPLICATION_JSON)
@NoCache
public Stream<UserRepresentation> getUsersInRole(@PathParam("role-name") final String roleName, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults) {
auth.roles().requireView(roleContainer);
firstResult = firstResult != null ? firstResult : 0;
maxResults = maxResults != null ? maxResults : Constants.DEFAULT_MAX_RESULTS;
RoleModel role = roleContainer.getRole(roleName);
if (role == null) {
throw new NotFoundException("Could not find role");
}
return session.users().getRoleMembersStream(realm, role, firstResult, maxResults).map(user -> ModelToRepresentation.toRepresentation(session, realm, user));
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method getManagementPermissions.
/**
* Return object stating whether client Authorization permissions have been initialized or not and a reference
*
* @return
*/
@Path("management/permissions")
@GET
@Produces(MediaType.APPLICATION_JSON)
@NoCache
public ManagementPermissionReference getManagementPermissions() {
this.auth.realm().requireViewIdentityProviders();
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
if (!permissions.idps().isPermissionsEnabled(identityProviderModel)) {
return new ManagementPermissionReference();
}
return toMgmtRef(identityProviderModel, permissions);
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method delete.
/**
* Delete a mapper for the identity provider
*
* @param id Mapper id
*/
@DELETE
@NoCache
@Path("mappers/{id}")
public void delete(@PathParam("id") String id) {
this.auth.realm().requireManageIdentityProviders();
if (identityProviderModel == null) {
throw new javax.ws.rs.NotFoundException();
}
IdentityProviderMapperModel model = realm.getIdentityProviderMapperById(id);
if (model == null)
throw new NotFoundException("Model not found");
realm.removeIdentityProviderMapper(model);
adminEvent.operation(OperationType.DELETE).resource(ResourceType.IDENTITY_PROVIDER_MAPPER).resourcePath(session.getContext().getUri()).success();
}
Aggregations