code: public AuthenticatedUser authenticateUser(Credentials credentials)
              throws GuacamoleException {
  
          // Pull HTTP header from request if present
          HttpServletRequest request = credentials.getRequest();
          if (request != null) {
  
              // Get the username from the header configured in guacamole.properties
              String username = request.getHeader(confService.getHttpAuthHeader());
  
              if (username != null) {
                  AuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
                  authenticatedUser.init(username, credentials);
                  return authenticatedUser;
              }
  
          }
  
          // Authentication not provided via header, yet, so we request it.
          throw new GuacamoleInvalidCredentialsException("Invalid login.", CredentialsInfo.USERNAME_PASSWORD);
  
      }
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.