You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2019/06/20 23:09:05 UTC

[GitHub] [guacamole-client] mike-jumper commented on a change in pull request #303: GUACAMOLE-579: Get user attributes from CAS ticket

mike-jumper 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_r296044782
 
 

 ##########
 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:
   If the key is known to be a `String`, this is really just calling `someString.toString()`, which is superfluous. If `Entry<String, Object>` is correct, then this should be changed to `attr.getKey()`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services