use of org.keycloak.services.ForbiddenException in project keycloak by keycloak.
the class UsersResource method user.
/**
* Get representation of the user
*
* @param id User id
* @return
*/
@Path("{id}")
public UserResource user(@PathParam("id") final String id) {
UserModel user = session.users().getUserById(realm, id);
if (user == null) {
// we do this to make sure somebody can't phish ids
if (auth.users().canQuery())
throw new NotFoundException("User not found");
else
throw new ForbiddenException();
}
UserResource resource = new UserResource(realm, user, auth, adminEvent);
ResteasyProviderFactory.getInstance().injectProperties(resource);
// resourceContext.initResource(users);
return resource;
}
use of org.keycloak.services.ForbiddenException in project keycloak by keycloak.
the class AbstractClientRegistrationProvider method delete.
public void delete(String clientId) {
event.event(EventType.CLIENT_DELETE).client(clientId);
ClientModel client = session.getContext().getRealm().getClientByClientId(clientId);
auth.requireDelete(client);
if (new ClientManager(new RealmManager(session)).removeClient(session.getContext().getRealm(), client)) {
event.client(client.getClientId()).success();
} else {
throw new ForbiddenException();
}
}
Aggregations