mike-jumper commented on a change in pull request #564:
URL: https://github.com/apache/guacamole-client/pull/564#discussion_r485255690
##########
File path:
extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/token/TokenValidationService.java
##########
@@ -132,9 +124,89 @@ public String processUsername(String token) throws
GuacamoleException {
logger.debug("Malformed claim within received JWT.", e);
}
+ return claims;
Review comment:
Please correct the indentation here. The Guacamole source uses 4 spaces
for each level and no tabs.
##########
File path:
extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/token/TokenValidationService.java
##########
@@ -132,9 +108,79 @@ public String processUsername(String token) throws
GuacamoleException {
logger.debug("Malformed claim within received JWT.", e);
}
+
+ return claims;
+ }
+
+ /**
+ * Validates and parses the given ID token, returning the username
contained
+ * therein, as defined by the username claim type given in
+ * guacamole.properties. If the username claim type is missing or the ID
+ * token is invalid, null is returned.
+ *
+ * @param token
+ * The ID token to validate and parse.
+ *
+ * @return
+ * The username contained within the given ID token, or null if the ID
+ * token is not valid or the username claim type is missing,
+ *
+ * @throws GuacamoleException
+ * If guacamole.properties could not be parsed.
+ */
+ public String processUsername(String token) throws GuacamoleException {
+ String usernameClaim = confService.getUsernameClaimType();
+
+ JwtClaims claims = validateToken(token);
Review comment:
Any reason to not just pass the `JwtClaims` in for `processUsername()`
and `processGroups()` rather than repeatedly processing the token?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]