You are here

public function Bakery::validateSubCookie in Bakery Single Sign-On System 7.3

Check and validate cookie used in login or registration from sub-site.

Return value

mixed FALSE if cookie is not valid, NULL if not set, or array if valid cookie.

File

./bakery.inc, line 163

Class

Bakery

Code

public function validateSubCookie() {
  $type = $this->subCookieName;
  if (!isset($_COOKIE[$type]) || !$this->key || !$this->domain) {

    // No cookie is set or site is misconfigured. Return NULL so existing
    // cookie is not deleted.
    return NULL;
  }
  try {
    $data = $this
      ->validateData($_COOKIE[$type], $type);
    $this
      ->debug('in validate Sub', $data);
    return $data;
  } catch (BakeryException $e) {
    $this
      ->log('Validation exception:', $e
      ->getMessage());
    return FALSE;
  }
}