/** * Get a group by any identifier. * * @param string|int $identifier An identifier for the group, ID or name. * @return GroupInterface|boolean The requested group, or false. */ protected function getGroupByAnything($identifier) { $groupProvider = $this->gatekeeper->getGroupProvider(); if (is_numeric($identifier)) { $group = $groupProvider->getById($identifier); if ($group !== false) { return $group; } } return $groupProvider->getByName($identifier); }
/** * */ public function testLogout() { $session = $this->getSession(); $session->shouldReceive('regenerateId')->once(); $session->shouldReceive('regenerateToken')->once(); $session->shouldReceive('remove')->once()->with('gatekeeper_auth_key'); $response = $this->getResponse(); $response->shouldReceive('deleteCookie')->once()->with('gatekeeper_auth_key', $this->getCookieOptions()); $gatekeeper = new Gatekeeper($this->getRequest(), $response, $session, $this->getUserProvider(), $this->getGroupProvider()); $gatekeeper->logout(); }
public function filter() { if ($this->gatekeeper->isGuest()) { return $this->gatekeeper->basicAuth(); } }