3require_once(dirname(dirname(__FILE__)) .
'/extlibinc/base_facebook.php');
39 if (!empty(
$config[
'sharedSession'])) {
45 array(
'state',
'code',
'access_token',
'user_id');
54 $this->sharedSessionID =
$data[
'id'];
61 $this->sharedSessionID = md5(uniqid(mt_rand(),
true));
64 'domain' => $base_domain,
65 'id' => $this->sharedSessionID,
68 $_COOKIE[$cookie_name] = $cookie_value;
69 if (!headers_sent()) {
71 setcookie($cookie_name, $cookie_value,
$expire,
'/',
'.'.$base_domain);
75 'Shared session ID cookie could not be set! You must ensure you '.
76 'create the Facebook instance before headers have been sent. This '.
77 'will cause authentication issues after the first request.'
90 if (!in_array(
$key, self::$kSupportedKeys)) {
96 $this->ssp_state[$session_var_name] = $value;
100 if (!in_array(
$key, self::$kSupportedKeys)) {
106 return isset($this->ssp_state[$session_var_name]) ?
107 $this->ssp_state[$session_var_name] : $default;
111 if (!in_array(
$key, self::$kSupportedKeys)) {
117 if (isset($this->ssp_state[$session_var_name])) {
118 unset($this->ssp_state[$session_var_name]);
123 foreach (self::$kSupportedKeys as
$key) {
126 if ($this->sharedSessionID) {
135 setcookie($cookie_name,
'', 1,
'/',
'.'.$base_domain);
139 return self::FBSS_COOKIE_NAME .
'_' . $this->
getAppId();
143 $parts = array(
'authfacebook:authdata:fb', $this->
getAppId(),
$key);
144 if ($this->sharedSessionID) {
145 array_unshift($parts, $this->sharedSessionID);
147 return implode(
'_', $parts);
151 if ($this->state ===
null) {
Provides access to the Facebook Platform.
parseSignedRequest($signed_request)
Parses a signed_request and validates the signature.
getAppId()
Get the Application ID.
makeSignedRequest($data)
Makes a signed_request blob using the given data.
getBaseDomain()
Get the base domain used for the cookie.
An exception for terminatinating execution or to throw for unit testing.
static getStateId(&$state, $rawId=false)
Retrieve the ID of a state array.
Extends the BaseFacebook class with the intent of using PHP sessions to store user ids and access tok...
establishCSRFTokenState()
Lays down a CSRF state token for this process.
getSharedSessionCookieName()
__construct(array $config, &$ssp_state)
Identical to the parent constructor, except that we start a PHP session to store the user ID and acce...
clearPersistentData($key)
Clear the data with $key from the persistent storage.
constructSessionVariableName($key)
getPersistentData($key, $default=false)
Get the data for $key, persisted by BaseFacebook::setPersistentData()
setPersistentData($key, $value)
Provides the implementations of the inherited abstract methods.
deleteSharedSessionCookie()
clearAllPersistentData()
Clear all data from the persistent storage.