You are here

public function BakeryUserHooks::logout in Bakery Single Sign-On System 8.2

File

src/BakeryUserHooks.php, line 50

Class

BakeryUserHooks

Namespace

Drupal\bakery

Code

public function logout(AccountInterface $account) {
  try {
    $cookie = $this->kitchen
      ->taste(Kitchen::CHOCOLATE_CHIP);

    // Only delete the SSO cookie if the name is the same in case there was an
    // existing session that's being logged out and SSO cookie is new session.
    if ($account
      ->id() && $cookie && $cookie['name'] === $account
      ->getAccountName()) {
      $this->kitchen
        ->eat(Kitchen::CHOCOLATE_CHIP);
    }
  } catch (MissingKeyException $exception) {

    // Let normal Drupal user processes do their thing until site is configured.
  }
}