/** * Retrieve user with password token and use it to decrypt the cipher key in the user * The encryption manager will store it in the session for the following requests * {@inheritdoc} */ protected function retrieveUser($username, UsernamePasswordToken $token) { $user = parent::retrieveUser($username, $token); if ($user instanceof UserEncryptionProviderInterface && null !== $token->getCredentials()) { $this->encryptionManager->decryptCipherKey($user, $token->getCredentials()); } return $user; }