/**
  * Executed when the session was successfully authenticated.
  *
  * @param AuthResult $authResult The successful authentication result.
  * @param bool $rememberMe Whether the authenticated session should be remembered after
  *                         the browser is closed or not.
  */
 protected function processSuccessfulSession(AuthResult $authResult, $rememberMe)
 {
     $storage = new Storage($authResult->getIdentity());
     /**
      * @deprecated Create a custom SessionInitializer instead.
      */
     Piwik::postEvent('Login.authenticate.successful', array($authResult->getIdentity(), $authResult->getTokenAuth()));
     $cookie = $this->getAuthCookie($rememberMe);
     $cookie->set('login', $authResult->getIdentity());
     $cookie->set('token_auth', $this->getHashTokenAuth($authResult->getIdentity(), $authResult->getTokenAuth()));
     if ($storage->isActive()) {
         $cookie->set('auth_code', $this->getHashTokenAuth($authResult->getIdentity(), $storage->getSecret()));
     }
     $cookie->setSecure(ProxyHttp::isHttps());
     $cookie->setHttpOnly(true);
     $cookie->save();
 }
Пример #2
0
 /**
  * Executed when the session was successfully authenticated.
  *
  * @param AuthResult $authResult The successful authentication result.
  * @param bool $rememberMe Whether the authenticated session should be remembered after
  *                         the browser is closed or not.
  */
 protected function processSuccessfulSession(AuthResult $authResult, $rememberMe)
 {
     $cookie = $this->getAuthCookie($rememberMe);
     $cookie->set('login', $authResult->getIdentity());
     $cookie->set('token_auth', $this->getHashTokenAuth($authResult->getIdentity(), $authResult->getTokenAuth()));
     $cookie->setSecure(ProxyHttp::isHttps());
     $cookie->setHttpOnly(true);
     $cookie->save();
 }
Пример #3
0
 private function checkGordonAuthResult(AuthResult $result)
 {
     $this->assertEquals(AuthResult::SUCCESS_SUPERUSER_AUTH_CODE, $result->getCode());
     $this->assertEquals(self::TEST_SUPERUSER, $result->getIdentity());
     $this->assertEquals(self::$gordonUserDetails['token_auth'], $result->getTokenAuth());
 }
Пример #4
0
 private function assertUserLogin(AuthResult $authResult, $login = '******', $tokenLength = 32)
 {
     $this->assertEquals(AuthResult::SUCCESS, $authResult->getCode());
     $this->assertEquals($login, $authResult->getIdentity());
     $this->assertEquals($tokenLength, strlen($authResult->getTokenAuth()));
 }