/** * Tests authentication failure due to token failure. * * @covers empire\framework\login\SecurePersistentLoginMethod::authenticate */ public function testAuthenticateTokenFail() { $gid = '58d93d649ffffffff5331ad0219ea200'; $storage = new JsonLoginStorage(__DIR__ . DIRECTORY_SEPARATOR . 'login.json', new Md5HashFunction(), 100, 'mykey'); $transceiver = new SecureCookieTransceiver(self::$cryptoFactory->getHashFunction('Sha256'), self::$cryptoFactory->getHashFunction('Sha256'), self::$cryptoFactory->getSymmetricCypher('Aes256'), 'secret key', new GID(), 'session id', $gid); $method = new SecurePersistentLoginMethod($storage, $transceiver); $this->remoteCall('login', $method, $gid); $storage->deleteAll($gid); $this->assertNull($this->remoteCall('authenticate', $method)); }
/** * Tests authentication failure due to token failure. * * @covers empire\framework\login\DefaultPersistentLoginMethod::authenticate */ public function testAuthenticateTokenFail() { $gid = '58d93d649ffffffff5331ad0219ea200'; $storage = new JsonLoginStorage(__DIR__ . DIRECTORY_SEPARATOR . 'login.json', new Md5HashFunction(), 100, 'mykey'); $transceiver = new DefaultCookieTransceiver(); $method = new DefaultPersistentLoginMethod($storage, $transceiver); $this->remoteCall('login', $method, $gid); $storage->deleteAll($gid); $this->assertNull($this->remoteCall('authenticate', $method)); }
/** * Tests deleting all tokens. * * @covers empire\framework\login\storage\JsonLoginStorage::deleteAll */ public function testDeleteAll() { $this->instance->addToken(12, 'hello'); $this->instance->deleteAll(12); $this->assertFalse($this->instance->tokenExists(12, 'hello')); }