You are here

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

Check and validate account SSO cookie for request.

Return value

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

File

./bakery.inc, line 138

Class

Bakery

Code

public function validateSsoCookie() {
  $type = $this->SsoCookieName;
  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 SSO ', $data);
    return $data;
  } catch (BakeryException $e) {
    $this
      ->log('Validation exception:', $e
      ->getMessage());
    return FALSE;
  }
}