Skip to content

Commit

Permalink
GUACAMOLE-1949: Add Javadoc for getUserId method
Browse files Browse the repository at this point in the history
  • Loading branch information
pp7en committed Jun 17, 2024
1 parent d11b6dd commit 7608b8a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,21 @@ private boolean isUserAllowed(String uid) throws GuacamoleException {
return confService.getAllowedUser().contains(uid);
}

/**
* Decodes a Base64 encoded JSON payload and extracts the uid
*
* <p>This method takes a Base64 encoded string as input, decodes it to a JSON string,
* parses the JSON to extract the user ID from the "userdata" object.
*
* @param payload
* The Base64 encoded JSON string containing user data.
*
* @return
* The user ID extracted from the decoded JSON payload.
*
* @throws JsonProcessingException
* If there is an error processing the JSON payload.
*/
private String getUserId(String payload) throws JsonProcessingException {
byte[] decodedBytes = Base64.getDecoder().decode(payload);
String decodedPayload = new String(decodedBytes, StandardCharsets.UTF_8);
Expand Down

0 comments on commit 7608b8a

Please sign in to comment.