KEYCLOAK-1792
This commit is contained in:
parent
0cfb03be03
commit
a1cfc0a0ff
11 changed files with 24 additions and 24 deletions
|
@ -101,7 +101,7 @@ public class AdminRoot {
|
|||
protected RealmModel locateRealm(String name, RealmManager realmManager) {
|
||||
RealmModel realm = realmManager.getRealmByName(name);
|
||||
if (realm == null) {
|
||||
throw new NotFoundException("Realm " + name + " not found");
|
||||
throw new NotFoundException("Realm not found. Did you type in a bad URL?");
|
||||
}
|
||||
return realm;
|
||||
}
|
||||
|
|
|
@ -782,7 +782,7 @@ public class AuthenticationManagementResource {
|
|||
public RequiredActionProviderRepresentation getRequiredAction(@PathParam("alias") String alias) {
|
||||
RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias);
|
||||
if (model == null) {
|
||||
throw new NotFoundException("Failed to find required action: " + alias);
|
||||
throw new NotFoundException("Failed to find required action");
|
||||
}
|
||||
return toRepresentation(model);
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ public class AuthenticationManagementResource {
|
|||
this.auth.requireManage();
|
||||
RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias);
|
||||
if (model == null) {
|
||||
throw new NotFoundException("Failed to find required action: " + alias);
|
||||
throw new NotFoundException("Failed to find required action");
|
||||
}
|
||||
RequiredActionProviderModel update = new RequiredActionProviderModel();
|
||||
update.setId(model.getId());
|
||||
|
@ -814,7 +814,7 @@ public class AuthenticationManagementResource {
|
|||
this.auth.requireManage();
|
||||
RequiredActionProviderModel model = realm.getRequiredActionProviderByAlias(alias);
|
||||
if (model == null) {
|
||||
throw new NotFoundException("Failed to find required action: " + alias);
|
||||
throw new NotFoundException("Failed to find required action.");
|
||||
}
|
||||
realm.removeRequiredActionProvider(model);
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ public class ClientResource {
|
|||
|
||||
Integer time = client.getRegisteredNodes().get(node);
|
||||
if (time == null) {
|
||||
throw new NotFoundException("Client does not have a node " + node);
|
||||
throw new NotFoundException("Client does not have node ");
|
||||
}
|
||||
client.unregisterNode(node);
|
||||
adminEvent.operation(OperationType.DELETE).resourcePath(uriInfo).success();
|
||||
|
|
|
@ -112,7 +112,7 @@ public class ClientsResource {
|
|||
public ClientResource getClient(final @PathParam("id") String id) {
|
||||
ClientModel clientModel = realm.getClientById(id);
|
||||
if (clientModel == null) {
|
||||
throw new NotFoundException("Could not find client: " + id);
|
||||
throw new NotFoundException("Could not find client");
|
||||
}
|
||||
|
||||
session.getContext().setClient(clientModel);
|
||||
|
|
|
@ -155,7 +155,7 @@ public class IdentityProvidersResource {
|
|||
}
|
||||
|
||||
if (identityProviderModel == null) {
|
||||
throw new NotFoundException("Could not find identity provider: " + alias);
|
||||
throw new NotFoundException("Could not find identity provider");
|
||||
}
|
||||
|
||||
IdentityProviderResource identityProviderResource = new IdentityProviderResource(this.auth, realm, session, identityProviderModel, adminEvent);
|
||||
|
|
|
@ -208,7 +208,7 @@ public class RealmsAdminResource {
|
|||
@PathParam("realm") final String name) {
|
||||
RealmManager realmManager = new RealmManager(session);
|
||||
RealmModel realm = realmManager.getRealmByName(name);
|
||||
if (realm == null) throw new NotFoundException("{realm} = " + name);
|
||||
if (realm == null) throw new NotFoundException("Realm not found.");
|
||||
|
||||
if (!auth.getRealm().equals(realmManager.getKeycloakAdminstrationRealm())
|
||||
&& !auth.getRealm().equals(realm)) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class RoleByIdResource extends RoleResource {
|
|||
protected RoleModel getRoleModel(String id) {
|
||||
RoleModel roleModel = realm.getRoleById(id);
|
||||
if (roleModel == null) {
|
||||
throw new NotFoundException("Could not find role with id: " + id);
|
||||
throw new NotFoundException("Could not find role with id");
|
||||
}
|
||||
|
||||
RealmAuth.Resource r = null;
|
||||
|
@ -183,7 +183,7 @@ public class RoleByIdResource extends RoleResource {
|
|||
auth.requireView();
|
||||
ClientModel clientModel = realm.getClientById(client);
|
||||
if (clientModel == null) {
|
||||
throw new NotFoundException("Could not find client: " + client);
|
||||
throw new NotFoundException("Could not find client");
|
||||
}
|
||||
return getClientRoleComposites(clientModel, role);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class RoleByIdResource extends RoleResource {
|
|||
auth.requireView();
|
||||
ClientModel clientModel = realm.getClientById(client);
|
||||
if (clientModel == null) {
|
||||
throw new NotFoundException("Could not find client: " + client);
|
||||
throw new NotFoundException("Could not find client");
|
||||
|
||||
}
|
||||
return getClientRoleComposites(clientModel, roleModel);
|
||||
|
|
|
@ -107,7 +107,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel roleModel = roleContainer.getRole(roleName);
|
||||
if (roleModel == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
|
||||
return getRole(roleModel);
|
||||
|
@ -127,7 +127,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
RoleRepresentation rep = getRole(roleName);
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
deleteRole(role);
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
try {
|
||||
updateRole(rep, role);
|
||||
|
@ -177,7 +177,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
addComposites(adminEvent, uriInfo, roles, role);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
return getRoleComposites(role);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
return getRealmRoleComposites(role);
|
||||
}
|
||||
|
@ -240,11 +240,11 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
ClientModel clientModel = realm.getClientById(client);
|
||||
if (client == null) {
|
||||
throw new NotFoundException("Could not find client: " + client);
|
||||
throw new NotFoundException("Could not find client");
|
||||
|
||||
}
|
||||
return getClientRoleComposites(clientModel, role);
|
||||
|
@ -267,7 +267,7 @@ public class RoleContainerResource extends RoleResource {
|
|||
|
||||
RoleModel role = roleContainer.getRole(roleName);
|
||||
if (role == null) {
|
||||
throw new NotFoundException("Could not find role: " + roleName);
|
||||
throw new NotFoundException("Could not find role");
|
||||
}
|
||||
deleteComposites(roles, role);
|
||||
adminEvent.operation(OperationType.DELETE).resourcePath(uriInfo).success();
|
||||
|
|
|
@ -44,7 +44,7 @@ public abstract class RoleResource {
|
|||
for (RoleRepresentation rep : roles) {
|
||||
RoleModel composite = realm.getRoleById(rep.getId());
|
||||
if (composite == null) {
|
||||
throw new NotFoundException("Could not find composite role: " + rep.getName());
|
||||
throw new NotFoundException("Could not find composite role");
|
||||
}
|
||||
role.addCompositeRole(composite);
|
||||
|
||||
|
@ -88,7 +88,7 @@ public abstract class RoleResource {
|
|||
for (RoleRepresentation rep : roles) {
|
||||
RoleModel composite = realm.getRoleById(rep.getId());
|
||||
if (composite == null) {
|
||||
throw new NotFoundException("Could not find composite role: " + rep.getName());
|
||||
throw new NotFoundException("Could not find composite role");
|
||||
}
|
||||
role.removeCompositeRole(composite);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public class UserFederationProvidersResource {
|
|||
|
||||
UserFederationProviderModel model = KeycloakModelUtils.findUserFederationProviderById(id, realm);
|
||||
if (model == null) {
|
||||
throw new NotFoundException("Could not find federation provider with id: " + id);
|
||||
throw new NotFoundException("Could not find federation provider");
|
||||
}
|
||||
|
||||
UserFederationProviderResource instanceResource = new UserFederationProviderResource(session, realm, this.auth, model, adminEvent);
|
||||
|
|
|
@ -456,7 +456,7 @@ public class UsersResource {
|
|||
// Logout clientSessions for this user and client
|
||||
AuthenticationManager.backchannelUserFromClient(session, realm, user, client, uriInfo, headers);
|
||||
} else {
|
||||
throw new NotFoundException("Consent not found for user " + id + " and client " + clientId);
|
||||
throw new NotFoundException("Consent not found");
|
||||
}
|
||||
adminEvent.operation(OperationType.ACTION).resourcePath(uriInfo).success();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue