necouchman commented on a change in pull request #303: GUACAMOLE-579: Get user
attributes from CAS ticket
URL: https://github.com/apache/guacamole-client/pull/303#discussion_r296061806
##########
File path:
extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/ticket/TicketValidationService.java
##########
@@ -88,33 +92,39 @@ public String validateTicket(String ticket, Credentials
credentials) throws Guac
validator.setAcceptAnyProxy(true);
validator.setEncoding("UTF-8");
try {
+ Map<String, String> tokens = new HashMap<>();
String confRedirectURI = confService.getRedirectURI();
Assertion a = validator.validate(ticket, confRedirectURI);
AttributePrincipal principal = a.getPrincipal();
+ Map<String, Object> ticketAttrs = principal.getAttributes();
// Retrieve username and set the credentials.
String username = principal.getName();
if (username != null)
credentials.setUsername(username);
// Retrieve password, attempt decryption, and set credentials.
- Object credObj = principal.getAttributes().get("credential");
+ Object credObj = ticketAttrs.remove("credential");
if (credObj != null) {
String clearPass = decryptPassword(credObj.toString());
if (clearPass != null && !clearPass.isEmpty())
credentials.setPassword(clearPass);
}
+
+ // Convert remaining attributes that have values to Strings
+ for (Entry attr : ticketAttrs.entrySet()) {
+ String tokenName =
CASTokenName.fromAttribute(attr.getKey().toString());
Review comment:
Changed.
----------------------------------------------------------------
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]
With regards,
Apache Git Services