Skip to content

Commit 7608b8a

Browse files
author
pp7en
committed
GUACAMOLE-1949: Add Javadoc for getUserId method
1 parent d11b6dd commit 7608b8a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

extensions/guacamole-auth-nextcloud/src/main/java/org/apache/guacamole/auth/nextcloud/NextcloudJwtAuthenticationProvider.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,21 @@ private boolean isUserAllowed(String uid) throws GuacamoleException {
291291
return confService.getAllowedUser().contains(uid);
292292
}
293293

294+
/**
295+
* Decodes a Base64 encoded JSON payload and extracts the uid
296+
*
297+
* <p>This method takes a Base64 encoded string as input, decodes it to a JSON string,
298+
* parses the JSON to extract the user ID from the "userdata" object.
299+
*
300+
* @param payload
301+
* The Base64 encoded JSON string containing user data.
302+
*
303+
* @return
304+
* The user ID extracted from the decoded JSON payload.
305+
*
306+
* @throws JsonProcessingException
307+
* If there is an error processing the JSON payload.
308+
*/
294309
private String getUserId(String payload) throws JsonProcessingException {
295310
byte[] decodedBytes = Base64.getDecoder().decode(payload);
296311
String decodedPayload = new String(decodedBytes, StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)