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