code: public AuthenticatedUser authenticateUser(Credentials credentials)
              throws GuacamoleException {
  
          // Pull CAS ticket from request if present
          HttpServletRequest request = credentials.getRequest();
          if (request != null) {
              String ticket = request.getParameter(CASTicketField.PARAMETER_NAME);
              if (ticket != null) {
                  String username = ticketService.validateTicket(ticket, credentials);
                  if (username != null) {
                      AuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
                      authenticatedUser.init(username, credentials);
                      return authenticatedUser;
                  }
              }
          }
  
          // Request CAS ticket
          throw new GuacamoleInvalidCredentialsException("Invalid login.",
              new CredentialsInfo(Arrays.asList(new Field[] {
  
                  // CAS-specific ticket (will automatically redirect the user
                  // to the authorization page via JavaScript)
                  new CASTicketField(
                      confService.getAuthorizationEndpoint(),
                      confService.getRedirectURI()
                  )
  
              }))
          );
  
      }
docs: Returns an AuthenticatedUser representing the user authenticated by the
  given credentials.
  
  @param credentials
  The credentials to use for authentication.
  
  @return
  An AuthenticatedUser representing the user authenticated by the
  given credentials.
  
  @throws GuacamoleException
  If an error occurs while authenticating the user, or if access is
  denied.