code: public String validateTicket(String ticket, Credentials credentials) throws GuacamoleException {
  
          // Retrieve the configured CAS URL, establish a ticket validator,
          // and then attempt to validate the supplied ticket.  If that succeeds,
          // grab the principal returned by the validator.
          URI casServerUrl = confService.getAuthorizationEndpoint();
          Cas20ProxyTicketValidator validator = new Cas20ProxyTicketValidator(casServerUrl.toString());
          validator.setAcceptAnyProxy(true);
          validator.setEncoding("UTF-8");
          try {
              URI confRedirectURI = confService.getRedirectURI();
              Assertion a = validator.validate(ticket, confRedirectURI.toString());
              AttributePrincipal principal =  a.getPrincipal();
  
              // 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");
              if (credObj != null) {
                  String clearPass = decryptPassword(credObj.toString());
                  if (clearPass != null && !clearPass.isEmpty())
                      credentials.setPassword(clearPass);
              }
  
              return username;
  
          } 
          catch (TicketValidationException e) {
              throw new GuacamoleException("Ticket validation failed.", e);
          }
          catch (Throwable t) {
              logger.error("Error validating ticket with CAS server: {}", t.getMessage());
              throw new GuacamoleInvalidCredentialsException("CAS login failed.", CredentialsInfo.USERNAME_PASSWORD);
          }
  
      }
docs: Validates and parses the given ID ticket, returning the username
  provided by the CAS server in the ticket.  If the
  ticket is invalid an exception is thrown.
  
  @param ticket
  The ID ticket to validate and parse.
  
  @param credentials
  The Credentials object to store retrieved username and
  password values in.
  
  @return
  The username derived from the ticket.
  
  @throws GuacamoleException
  If the ID ticket is not valid or guacamole.properties could
  not be parsed.