コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
 /**
  *
  */
 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();
 }
コード例 #3
0
 public function filter()
 {
     if ($this->gatekeeper->isGuest()) {
         return $this->gatekeeper->basicAuth();
     }
 }