mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Ticket #362: Using FORBIDDEN for GuacamoleSecurityException.
This commit is contained in:
@@ -105,7 +105,7 @@ public class ConnectionRESTService {
|
||||
// Return the converted connection directory
|
||||
return connectionService.convertConnectionList(connectionDirectory);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -142,7 +142,7 @@ public class ConnectionRESTService {
|
||||
|
||||
return new APIConnection(connection);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -176,7 +176,7 @@ public class ConnectionRESTService {
|
||||
// Delete the connection
|
||||
connectionDirectory.remove(connectionID);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -229,7 +229,7 @@ public class ConnectionRESTService {
|
||||
// Return the new connection identifier
|
||||
return connection.getIdentifier();
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -268,7 +268,7 @@ public class ConnectionRESTService {
|
||||
// Update the connection
|
||||
connectionDirectory.update(new APIConnectionWrapper(connection));
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -308,7 +308,7 @@ public class ConnectionRESTService {
|
||||
// Move the connection
|
||||
connectionDirectory.move(connectionID, parentConnectionGroup.getConnectionDirectory());
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
|
@@ -104,7 +104,7 @@ public class ConnectionGroupRESTService {
|
||||
// return the converted connection group list
|
||||
return connectionGroupService.convertConnectionGroupList(connectionGroupDirectory);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -142,7 +142,7 @@ public class ConnectionGroupRESTService {
|
||||
// Return the connectiion group
|
||||
return new APIConnectionGroup(connectionGroup);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -176,7 +176,7 @@ public class ConnectionGroupRESTService {
|
||||
// Delete the connection group
|
||||
connectionGroupDirectory.remove(connectionGroupID);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -229,7 +229,7 @@ public class ConnectionGroupRESTService {
|
||||
// Return the new connection group identifier
|
||||
return connectionGroup.getIdentifier();
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -268,7 +268,7 @@ public class ConnectionGroupRESTService {
|
||||
// Update the connection group
|
||||
connectionGroupDirectory.update(new APIConnectionGroupWrapper(connectionGroup));
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -308,7 +308,7 @@ public class ConnectionGroupRESTService {
|
||||
// Move the connection group
|
||||
connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory());
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
|
@@ -89,7 +89,7 @@ public class PermissionRESTService {
|
||||
return permissionService.convertPermissionList(user.getPermissions());
|
||||
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -122,7 +122,7 @@ public class PermissionRESTService {
|
||||
// Add the new permission
|
||||
user.addPermission(permission.toPermission());
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -155,7 +155,7 @@ public class PermissionRESTService {
|
||||
// Remove the permission
|
||||
user.removePermission(permission.toPermission());
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
|
@@ -86,7 +86,7 @@ public class UserRESTService {
|
||||
// Convert and return the user directory listing
|
||||
return userService.convertUserList(userDirectory);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Response.Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -119,7 +119,7 @@ public class UserRESTService {
|
||||
// Return the user
|
||||
return new APIUser(user);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Response.Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -147,7 +147,7 @@ public class UserRESTService {
|
||||
|
||||
return user.getUsername();
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Response.Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -187,7 +187,7 @@ public class UserRESTService {
|
||||
*/
|
||||
userDirectory.update(new APIUserWrapper(user, existingUser.getPermissions()));
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Response.Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
@@ -220,7 +220,7 @@ public class UserRESTService {
|
||||
// Delete the user
|
||||
userDirectory.remove(userID);
|
||||
} catch(GuacamoleSecurityException e) {
|
||||
throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
throw new HTTPException(Response.Status.FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Permission denied.");
|
||||
} catch(GuacamoleClientException e) {
|
||||
throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request.");
|
||||
} catch(GuacamoleException e) {
|
||||
|
Reference in New Issue
Block a user