Google_Auth_LoginTicket

Class to hold information about an authenticated login.

Defined (1)

The class is defined in the following location(s).

/lib/Google/Auth/LoginTicket.php  
  1. class Google_Auth_LoginTicket 
  2. const USER_ATTR = "sub"; 
  3.  
  4. // Information from id token envelope. 
  5. private $envelope; 
  6.  
  7. // Information from id token payload. 
  8. private $payload; 
  9.  
  10. /** 
  11. * Creates a user based on the supplied token. 
  12. * @param string $envelope Header from a verified authentication token. 
  13. * @param string $payload Information from a verified authentication token. 
  14. */ 
  15. public function __construct($envelope, $payload) 
  16. $this->envelope = $envelope; 
  17. $this->payload = $payload; 
  18.  
  19. /** 
  20. * Returns the numeric identifier for the user. 
  21. * @throws Google_Auth_Exception 
  22. * @return 
  23. */ 
  24. public function getUserId() 
  25. if (array_key_exists(self::USER_ATTR, $this->payload)) { 
  26. return $this->payload[self::USER_ATTR]; 
  27. throw new Google_Auth_Exception("No user_id in token"); 
  28.  
  29. /** 
  30. * Returns attributes from the login ticket. This can contain 
  31. * various information about the user session. 
  32. * @return array 
  33. */ 
  34. public function getAttributes() 
  35. return array("envelope" => $this->envelope, "payload" => $this->payload);