Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../includes/Google/Auth
File: LoginTicket.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright 2011 Google Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* Licensed under the Apache License, Version 2.0 (the "License");
[4] Fix | Delete
* you may not use this file except in compliance with the License.
[5] Fix | Delete
* You may obtain a copy of the License at
[6] Fix | Delete
*
[7] Fix | Delete
* http://www.apache.org/licenses/LICENSE-2.0
[8] Fix | Delete
*
[9] Fix | Delete
* Unless required by applicable law or agreed to in writing, software
[10] Fix | Delete
* distributed under the License is distributed on an "AS IS" BASIS,
[11] Fix | Delete
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
[12] Fix | Delete
* See the License for the specific language governing permissions and
[13] Fix | Delete
* limitations under the License.
[14] Fix | Delete
*/
[15] Fix | Delete
[16] Fix | Delete
if (!class_exists('UDP_Google_Client')) {
[17] Fix | Delete
require_once dirname(__FILE__) . '/../autoload.php';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Class to hold information about an authenticated login.
[22] Fix | Delete
*
[23] Fix | Delete
* @author Brian Eaton <beaton@google.com>
[24] Fix | Delete
*/
[25] Fix | Delete
class Google_Auth_LoginTicket
[26] Fix | Delete
{
[27] Fix | Delete
const USER_ATTR = "sub";
[28] Fix | Delete
[29] Fix | Delete
// Information from id token envelope.
[30] Fix | Delete
private $envelope;
[31] Fix | Delete
[32] Fix | Delete
// Information from id token payload.
[33] Fix | Delete
private $payload;
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Creates a user based on the supplied token.
[37] Fix | Delete
*
[38] Fix | Delete
* @param string $envelope Header from a verified authentication token.
[39] Fix | Delete
* @param string $payload Information from a verified authentication token.
[40] Fix | Delete
*/
[41] Fix | Delete
public function __construct($envelope, $payload)
[42] Fix | Delete
{
[43] Fix | Delete
$this->envelope = $envelope;
[44] Fix | Delete
$this->payload = $payload;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Returns the numeric identifier for the user.
[49] Fix | Delete
* @throws Google_Auth_Exception
[50] Fix | Delete
* @return
[51] Fix | Delete
*/
[52] Fix | Delete
public function getUserId()
[53] Fix | Delete
{
[54] Fix | Delete
if (array_key_exists(self::USER_ATTR, $this->payload)) {
[55] Fix | Delete
return $this->payload[self::USER_ATTR];
[56] Fix | Delete
}
[57] Fix | Delete
throw new Google_Auth_Exception("No user_id in token");
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Returns attributes from the login ticket. This can contain
[62] Fix | Delete
* various information about the user session.
[63] Fix | Delete
* @return array
[64] Fix | Delete
*/
[65] Fix | Delete
public function getAttributes()
[66] Fix | Delete
{
[67] Fix | Delete
return array("envelope" => $this->envelope, "payload" => $this->payload);
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function