public function save($entity) { if (!isset($entity->zfcuser) || !$entity->zfcuser instanceof UserInterface) { throw new \RuntimeException('Entity must implement ZfcUser\\Entity\\UserInterface'); } // If the user specified a new password, hash it $password = $entity->zfcuser->getPassword(); if (!empty($password)) { $hydrator = $this->getFieldset()->getHydrator(); if (method_exists($hydrator, 'getCryptoService')) { // ZfcUser dev-master $hash = $this->getFieldset()->getHydrator()->getCryptoService()->create($password); } else { $bcrypt = new Bcrypt(); $bcrypt->setCost($this->getUserService()->getOptions()->getPasswordCost()); $hash = $bcrypt->create($password); } $entity->zfcuser->setPassword($hash); // Clear out the password values now that we don't need them again $this->getFieldset()->get('password')->setValue(''); $this->getFieldset()->get('passwordVerify')->setValue(''); } // Reload the actual user entity and transfer changes to it // (necessary for ZfcUserDoctrineORM to work, as $entity->zfcuser is disconnected) $userobj = $this->getUserService()->getUserMapper()->findById($entity->zfcuser->getId()); $this->transferChangesToExistingEntity($entity->zfcuser, $userobj); // Stash the new entity back in the original's place so that later // extensions can use it in Doctrine associations safely $entity->zfcuser = $userobj; return $this->getUserService()->getUserMapper()->update($userobj); }
public function registerAction() { $request = $this->getRequest(); $form = new UserForm(); $userNameConflict = false; if ($request->isPost()) { // check if the form is valid $form->setData($request->getPost()); $form->setInputFilter(new UserInputFilter()); if ($form->isValid()) { $data = $form->getData(); $userRepo = $this->getObjectManager()->getRepository(User::class); $userNameConflict = $userRepo->findOneBy(['userName' => $data['username']]) instanceof User; if ($userNameConflict) { $form->get('username')->setValue(''); } else { // if the requested username is not taken yet, create the password and redirect the user to the login $user = new User(); $user->setEmail($data['email']); $user->setUserName($data['username']); $bcrypt = new Bcrypt(); $password = $bcrypt->create($data['password']); $user->setPassword($password); $this->getObjectManager()->persist($user); $this->getObjectManager()->flush(); return $this->redirect()->toRoute('application/user', ['action' => 'login']); } } } return new ViewModel(['form' => $form, 'userNameConflict' => $userNameConflict]); }
/** * Retorna hash Bcrypt del password del usuario */ public static function hashPassword($password, $cost) { $bcrypt = new Bcrypt(); $bcrypt->setCost($cost); $securePass = $bcrypt->create($password); return $securePass; }
/** * This method inspects the request and routes the data * to the correct method * * @return void */ public function create($unfilteredData) { $usersTable = $this->getUsersTable(); $filters = $usersTable->getInputFilter(); $filters->setData($unfilteredData); if ($filters->isValid()) { $data = $filters->getValues(); $avatarContent = array_key_exists('avatar', $unfilteredData) ? $unfilteredData['avatar'] : NULL; $bcrypt = new Bcrypt(); $data['password'] = $bcrypt->create($data['password']); if ($usersTable->create($data)) { $user = $usersTable->getByUsername($data['username']); if (!empty($avatarContent)) { $userImagesTable = $this->getUserImagesTable(); $filename = sprintf('public/images/%s.png', sha1(uniqid(time(), TRUE))); $content = base64_decode($avatarContent); $image = imagecreatefromstring($content); if (imagepng($image, $filename) === TRUE) { $userImagesTable->create($user['id'], basename($filename)); } imagedestroy($image); $image = $userImagesTable->getByFilename(basename($filename)); $usersTable->updateAvatar($image['id'], $user['id']); } Mailer::sendWelcomeEmail($user['email'], $user['name']); $result = new JsonModel(array('result' => true)); } else { $result = new JsonModel(array('result' => false)); } } else { $result = new JsonModel(array('result' => false, 'errors' => $filters->getMessages())); } return $result; }
public function load(ObjectManager $manager) { $userFlop = false; $bcrypt = new Bcrypt(); $bcrypt->setCost(14); $scope1 = new OAuth2Scope(); $scope1->setScope('read'); $scope1->setIsDefault(true); $manager->persist($scope1); $scope2 = new OAuth2Scope(); $scope2->setScope('update'); $scope2->setIsDefault(false); $manager->persist($scope2); $scope3 = new OAuth2Scope(); $scope3->setScope('delete'); $scope3->setIsDefault(false); $manager->persist($scope3); $scope4 = new OAuth2Scope(); $scope4->setScope('create'); $scope4->setIsDefault(false); $manager->persist($scope4); $user2 = new Entity\User(); $user2->setUsername('user2'); $user2->setPassword($bcrypt->create('user2password')); $user2->setEmail('*****@*****.**'); $user2->setDisplayName('Tom Anderson'); $manager->persist($user2); $client2 = new OAuth2Client(); $client2->setClientId('readonly'); $client2->setSecret($bcrypt->create('readonly_password')); $client2->setGrantType(array('client_credentials', 'refresh_token')); $client2->setUser($user2); $client2->addScope($scope1); $scope1->addClient($client2); $manager->persist($client2); // Artists $artist = new Entity\Artist(); $artist->setName('Grateful Dead'); $manager->persist($artist); $albums = array('The Grateful Dead', 'Anthem of the Sun', 'Aoxomoxoa', 'Live/Dead', 'Workingman\'s Dead', 'American Beauty'); foreach ($albums as $name) { $album = new Entity\Album(); $album->setArtist($artist); $album->setName($name); $manager->persist($album); $userAlbum = new Entity\UserAlbum(); $userAlbum->setAlbum($album); if ($userFlop = !$userFlop) { # $userAlbum->setUser($user1); } else { $userAlbum->setUser($user2); } $userAlbum->setDescription("Description for {$name}"); $manager->persist($userAlbum); } $loop = new Entity\TestLoop(); $loop->setParentLoop($loop); $manager->persist($loop); $manager->flush(); }
/** * Performs an authentication attempt * * @return \Zend\Authentication\Result * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface If authentication cannot be performed */ public function authenticate() { if (empty($this->_username) || empty($this->_password)) { // throw new \Zend\Authentication\Adapter\Exception(); } if (is_null($this->_dm)) { throw new \Exception('Document Manager is null'); } $query = $this->_dm->createQueryBuilder('MoveIn4User\\Document\\UserDocument'); $query->field('userName')->equals((string) $this->_username); // $query->field ( 'password' )->equals ((string) $this->_password ); $query->field('active')->equals(true); $query->field('deleted')->equals(false); $users = $query->getQuery()->execute(); if (count($users) === 0) { return new Result(Result::FAILURE_CREDENTIAL_INVALID, array()); } else { foreach ($users as $user) { $bcrypt = new Bcrypt(); if ($bcrypt->verify((string) $this->_password, $user->getPassword()) and $user->getInstance()->getDeleted() === false) { return new Result(Result::SUCCESS, array('username' => $user->getUserName(), 'firstName' => $user->getFirstName(), 'surname' => $user->getSurname(), 'defaultLanguage' => $user->getInstance()->getDefaultLanguage(), 'id' => $user->getId())); } return new Result(Result::FAILURE_CREDENTIAL_INVALID, array()); } } }
public function authenticate($username, $password) { $callback = function ($password, $hash) { $bcrypt = new Bcrypt(); return $bcrypt->verify($hash, $password); }; $authenticationService = new AuthenticationService(); $callbackCheckAdapter = new CallbackCheckAdapter($this->dbAdapter, "users", 'username', 'password', $callback); $callbackCheckAdapter->setIdentity($username)->setCredential($password); $authenticationService->setAdapter($callbackCheckAdapter); $authResult = $authenticationService->authenticate(); if ($authResult->isValid()) { $userObject = $callbackCheckAdapter->getResultRowObject(); $authenticationService->getStorage()->write($userObject); if ($userObject->status == 0) { $authenticationService->clearIdentity(); $this->setCode(-5); return false; } else { return true; } } else { $this->setCode($authResult->getCode()); return false; } }
public function indexAction() { if (@$_SESSION['user']['Logged'] == 1 || @$_SESSION['user']['Level'] == 1) { return $this->redirect()->toRoute('application'); } $userContainer = new Container('user'); $userContainer->Logged; $userContainer->Level; $userContainer->Nom; $userContainer->Prenom; $form = new AuthForm(); $request = $this->getRequest(); if ($request->isPost()) { $bcrypt = new Bcrypt(); $User = new User(); $User->user_login = $request->getPost('login'); $User->user_password = $request->getPost('motdepasse'); $UserO = $this->getUserTable()->getVerificationAuth($User->user_login); if ($UserO == true) { $securepass = $UserO->user_password; if ($bcrypt->verify($User->user_password, $securepass)) { $userContainer->Nom = $UserO->user_nom; $userContainer->Prenom = $UserO->user_prenom; $userContainer->Userid = $UserO->user_id; $userContainer->Logged = 1; $userContainer->Level = $UserO->user_droit; return $this->redirect()->toRoute('application'); } else { return array('form' => $form, 'erreur' => 'Mauvais Login ou Mauvais Mot de passe'); } } } return array('form' => $form); }
public function addUser($data) { # get data $email = isset($data['email']) ? $data['email'] : null; $password = isset($data['password']) ? $data['password'] : null; $role = isset($data['role']) ? $data['role'] : null; # Bcrypt for password if (!is_null($password)) { $bcrypt = new Bcrypt(); $bcrypt->setCost(14); $password = $bcrypt->create($password); } # insert new personal data user $arr = array('email' => $email, 'password' => $password); $this->tableGateway->insert($arr); # select current user id $userId = $this->tableGateway->select(function (Select $select) use($email) { $select->columns(array('user_id'))->where(array('email' => $email))->limit(1); }); $userId = $userId->toArray(); # select id role $userRoleId = $this->tableGateway2->select(function (Select $select) use($role) { $select->columns(array('id'))->where(array('roleId' => $role))->limit(1); }); $userRoleId = $userRoleId->toArray(); $arr = array('user_id' => $userId['0']['user_id'], 'role_id' => $userRoleId['0']['id']); # insert role for new user $this->tableGateway3->insert($arr); }
public function load(ObjectManager $manager) { $bcrypt = new Bcrypt(); $clientSecret = $bcrypt->create('123456'); $grantTypes = array('mobile' => array('password', 'implicit', 'refresh_token'), 'custom' => array('client_credentials', 'implicit', 'refresh_token')); $redirectUri = '/oauth/receivecode'; $clientCredentialScope = array($this->getReference('scope0'), $this->getReference('scope1'), $this->getReference('scope2')); $clientData = array(array('user' => null, 'secret' => $clientSecret, 'client_id' => 'mobile', 'grant_type' => $grantTypes['mobile']), array('user' => $this->getReference('user0'), 'secret' => $clientSecret, 'client_id' => '55f94d5ee7707', 'grant_type' => $grantTypes['custom'], 'scope' => $clientCredentialScope), array('user' => $this->getReference('user1'), 'secret' => $clientSecret, 'client_id' => '55f94d92d97e5', 'grant_type' => $grantTypes['custom'], 'scope' => $clientCredentialScope)); foreach ($clientData as $key => $data) { $client[$key] = new Client(); $client[$key]->setUser($data['user']); $client[$key]->setSecret($data['secret']); $client[$key]->setClientId($data['client_id']); $client[$key]->setRedirectUri($redirectUri); $client[$key]->setGrantType($data['grant_type']); if (isset($data['scope'])) { foreach ($data['scope'] as $scope) { $client[$key]->addScope($scope); $scope->addClient($client[$key]); $manager->persist($scope); } } $manager->persist($client[$key]); } $manager->flush(); foreach ($clientData as $key => $data) { $this->addReference('client' . $key, $client[$key]); } }
/** * Function that saves a new User * @param array $data * @return Orcamentos\Model\User $user */ public function save($data) { $data = json_decode($data); if (!isset($data->name) || !isset($data->password) || !isset($data->email) || !isset($data->companyId)) { throw new Exception("Invalid Parameters", 1); } $user = $this->getUser($data); $user->setName($data->name); $user->setEmail($data->email); $password = $user->getPassword(); if (!isset($password) || $password != $data->password) { $bcrypt = new Bcrypt(); $password = $bcrypt->create($data->password); } $user->setPassword($password); $admin = false; if (isset($data->admin)) { $admin = true; } $user->setAdmin($admin); $company = $this->em->getRepository('Orcamentos\\Model\\Company')->find($data->companyId); if (!isset($company)) { throw new Exception("Empresa não encontrada", 1); } $user->setCompany($company); try { $this->em->persist($user); $this->em->flush(); return $user; } catch (Exception $e) { echo $e->getMessage(); } }
public function setPasswordBcrypt(Bcrypt $passwordBcrypt) { $passwordBcrypt->setSalt(self::BCRYPT_SALT); $passwordBcrypt->setCost(self::BCRYPT_COST); $this->passwordBcrypt = $passwordBcrypt; return $this; }
public function load(ObjectManager $manager) { $bcrypt = new Bcrypt(); $bcrypt->setCost(16); $admin = new \User\Entity\User(); $admin->setUsername('admin'); $admin->setDisplayName('Admin'); $admin->setEmail('*****@*****.**'); $admin->setState(1); $admin->setPassword($bcrypt->create('password')); $admin->addRole($this->getReference('role_admin')); $userOne = new \User\Entity\User(); $userOne->setUsername('User A'); $userOne->setDisplayName('Anton'); $userOne->setEmail('*****@*****.**'); $userOne->setState(1); $userOne->setPassword($bcrypt->create('password')); $userOne->addRole($this->getReference('role_user')); $userTwo = new \User\Entity\User(); $userTwo->setUsername('User B'); $userTwo->setDisplayName('Berty'); $userTwo->setEmail('*****@*****.**'); $userTwo->setState(1); $userTwo->setPassword($bcrypt->create('password')); $userTwo->addRole($this->getReference('role_user')); $manager->persist($admin); $manager->persist($userOne); $manager->persist($userTwo); $this->addReference('user_admin', $admin); $this->addReference('user_a', $userOne); $this->addReference('user_b', $userTwo); $manager->flush(); }
public function resetAction() { $this->updateLayoutWithIdentity(); $form = new ResetForm(); $errors = []; if ($this->getRequest()->isPost()) { $form->setData($this->getRequest()->getPost()); if ($form->isValid()) { try { $minecraft = new MinecraftAPI($form->get('username')->getValue(), $form->get('mojangPassword')->getValue()); $user = $this->getEntityManager()->getRepository('NightsWatch\\Entity\\User')->findOneBy(['username' => $minecraft->username]); if (!$user) { $errors[] = 'No Such User'; } else { $bcrypt = new Bcrypt(); $user->password = $bcrypt->create($form->get('password')->getValue()); $this->getEntityManager()->persist($user); $this->getEntityManager()->flush(); $this->getAuthenticationService()->authenticate(new ForceAdapter($user->id)); $this->updateLayoutWithIdentity(); return new ViewModel(['done' => true]); } } catch (\RuntimeException $e) { $errors[] = 'Problem querying the API'; } catch (BadLoginException $e) { $errors[] = 'Invalid username or Password'; } catch (MigrationException $e) { $errors[] = 'Your Minecraft account has been migrated to a Mojang account. ' . 'Please enter your Mojang email and try again'; } catch (BasicException $e) { $errors[] = 'This is not a premium Minecraft Account'; } } } return new ViewModel(['done' => false, 'errors' => $errors, 'form' => $form]); }
public static function validate($user, $passwordGiven) { $passwordHash = $user->getPassword(); $passwordBcrypt = new Bcrypt(); $result = $passwordBcrypt->verify($passwordGiven, $passwordHash); return $result; }
public function cleanerAction() { $form = new CleanerForm(); $form->setAttribute('method', 'POST'); $repo = array(); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); #test cipher $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes', 'hash' => 'sha512')); $blockCipher->setKey('DA$#3434fsa432dfef32327'); $hash = 'f19f8bf56c4f61b6b2ca51e4cd5973faa5a165e4db6ad7aae0f065463ba2330fx2kZPSH5xCnLy48nVPWnprIh601be0H2Quh2o88oCws='; #\Zend\Debug\Debug::dump($blockCipher->decrypt($hash)); #test bcrypt $bcrypt = new Bcrypt(); $hash = $bcrypt->create('xxx'); $hash = '$2y$10$HQORKaG/QUWk.wJGj9lPuOHLTrm11pRdSSBDP.L2JVrAkCid7W5O.'; #get git data $pwd = $request->getPost()['pwd']; $hour = $request->getPost()['hour']; if ($bcrypt->verify($pwd, $hash) && is_numeric($hour)) { $this->getActionLogTable()->deleteOlderThan($hour); $result['message'] = 'OK'; } else { $result['message'] = 'Error. Passwd or Hour are not valid.'; } } $result['form'] = $form; return new ViewModel($result); }
/** * createService * * @param ServiceLocatorInterface $serviceLocator serviceLocator * * @return PasswordInterface */ public function createService(ServiceLocatorInterface $serviceLocator) { $cfg = $serviceLocator->get('RcmUser\\User\\Config'); $encryptor = new Bcrypt(); $encryptor->setCost($cfg->get('Encryptor.passwordCost', 14)); return $encryptor; }
/** * Action pour la création. * * @return array */ public function createAction() { $oForm = new \Commun\Form\UsersForm(); //new \Commun\Form\UsersForm($this->getServiceLocator()); $oRequest = $this->getRequest(); $oFiltre = new \Commun\Filter\UsersFilter(); $oForm->setInputFilter($oFiltre->getInputFilter()); if ($oRequest->isPost()) { $oEntite = new \Commun\Model\Users(); $aPost = $oRequest->getPost(); $bcrypt = new Bcrypt(); $bcrypt->setCost(14); $aPost['password'] = $bcrypt->create($aPost['password']); $oForm->setData($aPost); if ($oForm->isValid()) { $oEntite->exchangeArray($oForm->getData()); $this->getTable()->insert($oEntite); $this->flashMessenger()->addMessage($this->_getServTranslator()->translate("La users a été créé avec succès."), 'success'); return $this->redirect()->toRoute('backend-users-list'); } else { $this->flashMessenger()->addMessage($this->_getServTranslator()->translate("Formulaire non valid."), 'error'); return $this->redirect()->toRoute('backend-users-create'); } } // Pour optimiser le rendu $oViewModel = new ViewModel(); $oViewModel->setTemplate('backend/users/create'); return $oViewModel->setVariables(array('form' => $oForm)); }
/** * {@inheritDoc} */ public function createService(ServiceLocatorInterface $serviceLocator) { $options = $serviceLocator->get('zfcuser_module_options'); $crypto = new Bcrypt(); $crypto->setCost($options->getPasswordCost()); return new Mapper\UserHydrator($crypto); }
public function postLogin(Request $request, Application $app) { $data = $request->request->all(); if (!isset($data['email']) || !isset($data['password'])) { $app['session']->getFlashBag()->add('message', 'Email e/ou senha inválidos!'); return $app->redirect('/'); } $user = $app['orm.em']->getRepository('Orcamentos\\Model\\User')->findOneBy(array('email' => $data['email'])); if (!$user) { $app['session']->getFlashBag()->add('message', 'Usuário inválido!'); return $app->redirect('/'); } $bcrypt = new Bcrypt(); $valid = $bcrypt->verify($data['password'], $user->getPassword()); if (!$valid) { $app['session']->getFlashBag()->add('message', 'Email e/ou senha inválidos!'); return $app->redirect('/'); } $app['session']->set('email', $data['email']); $app['session']->set('isAdmin', $user->getAdmin()); $app['session']->set('companyId', $user->getCompany()->getId()); $app['session']->set('companyLogotype', $user->getCompany()->getLogotype()); $app['session']->set('companyName', $user->getCompany()->getName()); if ($user->getAdmin()) { return $app->redirect('/'); } return $app->redirect('/project'); }
/** * @return Bcrypt */ public function getBcrypt() { if (null === $this->bcrypt) { $this->bcrypt = new Bcrypt(); $this->bcrypt->setCost($this->bcryptCost); } return $this->bcrypt; }
public function processRegistration($data) { $bcrypt = new Bcrypt(); $data->password = $bcrypt->create($data->password); $registerEntity = new RegistrationEntity(); $this->getMapper()->getHydrator()->hydrate((array) $data, $registerEntity); return $this->getMapper()->insert($registerEntity); }
public function hashPassword($password) { $zfUserOption = $this->getServiceManager()->get('zfcuser_module_options'); $bcrypt = new Bcrypt(); $bcrypt->setCost($zfUserOption->getPasswordCost()); $pass = $bcrypt->create($password); return $pass; }
/** * Encrypt Password * * Creates a Bcrypt password hash * * @return String */ public static function encryptPassword($password) { $bcrypt = new Bcrypt(array('cost' => 10)); $passwordSalt = $bcrypt->create($password); $bcrypt->setSalt($passwordSalt); $encryptedPassword = $bcrypt->create($password); return array('password' => $encryptedPassword, 'password_salt' => $passwordSalt); }
public function authenticate(AuthEvent $e) { if ($this->isSatisfied()) { $storage = $this->getStorage()->read(); $e->setIdentity($storage['identity'])->setCode(AuthenticationResult::SUCCESS)->setMessages(array('Authentication successful.')); return; } $identity = $e->getRequest()->getPost()->get('identity'); $credential = $e->getRequest()->getPost()->get('credential'); $credential = $this->preProcessCredential($credential); $userObject = null; // Cycle through the configured identity sources and test each $fields = $this->getOptions()->getAuthIdentityFields(); while (!is_object($userObject) && count($fields) > 0) { $mode = array_shift($fields); switch ($mode) { case 'username': $userObject = $this->getMapper()->findByUsername($identity); break; case 'email': $userObject = $this->getMapper()->findByEmail($identity); break; } } if (!$userObject) { $e->setCode(AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND)->setMessages(array('A record with the supplied identity could not be found.')); $this->setSatisfied(false); return false; } if ($this->getOptions()->getEnableUserState()) { // Don't allow user to login if state is not in allowed list if (!in_array($userObject->getState(), $this->getOptions()->getAllowedLoginStates())) { $e->setCode(AuthenticationResult::FAILURE_UNCATEGORIZED)->setMessages(array('A record with the supplied identity is not active.')); $this->setSatisfied(false); return false; } } $bcrypt = new Bcrypt(); $bcrypt->setCost($this->getOptions()->getPasswordCost()); if (!$bcrypt->verify($credential, $userObject->getPassword())) { // Password does not match $e->setCode(AuthenticationResult::FAILURE_CREDENTIAL_INVALID)->setMessages(array('Supplied credential is invalid.')); $this->setSatisfied(false); return false; } // regen the id $session = new SessionContainer($this->getStorage()->getNameSpace()); $session->getManager()->regenerateId(); // Success! $e->setIdentity($userObject->getId()); // Update user's password hash if the cost parameter has changed $this->updateUserPasswordHash($userObject, $credential, $bcrypt); $this->setSatisfied(true); $storage = $this->getStorage()->read(); $storage['identity'] = $e->getIdentity(); $this->getStorage()->write($storage); $e->setCode(AuthenticationResult::SUCCESS)->setMessages(array('Authentication successful.')); }
public function resetPassword($uuid, $password) { $userId = $this->userUuidMapper->getUuid($uuid)[0]['user_id']; $bcrypt = new Bcrypt(); $bcrypt->setCost(14); $pass = $bcrypt->create($password); $this->userMapper->updatePassword($userId, $pass); $uuid = $this->userUuidMapper->deleteUuid($uuid); }
public function verifyCredentials() { $this->user = $this->gateway->findByUsername($this->username); if ($this->user) { $bcrypt = new Bcrypt(); return $bcrypt->verify($this->password, $this->user->password); } return false; }
/** * Set password * * @param string $password * @return User */ public function setPassword($password) { if ($password) { $bcrypt = new Bcrypt(); $password = $bcrypt->create($password); } $this->password = $password; return $this; }
public function create($username, $password, $fullname) { if ($this->byUsername($username)) { throw new DomainException(sprintf('Username "%s" already exists', $username), 409); } $crypt = new Bcrypt(); $user = array('user_id' => (string) Uuid::uuid4(), 'username' => $username, 'password' => $crypt->create($password), 'name' => $fullname); $this->table->insert($user); return new $this->entityClass($user); }
public function authenticate() { $bcrypt = new Bcrypt(); if ($bcrypt->verify($this->getCredential(), $this->userApi->getPasswordByUserId($this->getIdentity()))) { $code = Result::SUCCESS; } else { $code = Result::FAILURE; } return new Result($code, $this->getIdentity()); }