public function SaveUserIdentity(UserIdentity $identity)
 {
     $identity->encryptedPassword = $this->identityCheckStrategy->GetEncryptedPassword($identity->password);
     $this->sessionWrapper->setValue(self::KEY_SESSION_IDENTITY, $identity);
     if ($identity->persistent) {
         setcookie(self::KEY_REMEMBER_ME, $this->rememberMeGenerator->encode($identity), time() + self::REMEMBER_ME_LIFETIME);
     }
 }
 /**
  * @param string $plainPassword
  * @param int $expire
  */
 private function SetPasswordCookieEncrypted($plainPassword, $expire)
 {
     setcookie(self::passwordCookie, $this->identityCheckStrategy->GetEncryptedPassword($plainPassword), $expire);
 }