diff --git a/src/Generator/TokenGenerator.php b/src/Generator/TokenGenerator.php index 1327862..a2c03a7 100644 --- a/src/Generator/TokenGenerator.php +++ b/src/Generator/TokenGenerator.php @@ -47,7 +47,7 @@ public function setExpiration(int $expiration): void $this->expiration = $expiration; } - public function getToken(int $uId, string $email, array $extraData = null): Token + public function getToken(string $uId, string $email, array $extraData = null): Token { $builder = new Builder(); $builder->issuedBy($this->issuer) diff --git a/tests/Generator/TokenGeneratorTest.php b/tests/Generator/TokenGeneratorTest.php index b96f223..65877ed 100644 --- a/tests/Generator/TokenGeneratorTest.php +++ b/tests/Generator/TokenGeneratorTest.php @@ -21,7 +21,7 @@ public function testTokenExpirationTime(): void $generator->setExpiration(3600); $time = time(); - $token = $generator->getToken(2, 'test@example.com'); + $token = $generator->getToken('2', 'test@example.com'); $this->assertEquals('issuer', $token->getClaim('iss')); $this->assertEquals('issuer', $token->getClaim('aud')); @@ -41,7 +41,7 @@ public function testTokenExtraData(): void $generator = new TokenGenerator('id', Sha256::class, 'key', 'issuer'); $params = ['something' => 'another', 'whatever' => 4]; - $token = $generator->getToken(2, 'test@example.com', $params); + $token = $generator->getToken('2', 'test@example.com', $params); $this->assertEquals('issuer', $token->getClaim('iss')); $this->assertEquals('issuer', $token->getClaim('aud')); @@ -59,7 +59,7 @@ public function testTokenWithNoAudience(): void $generator = new TokenGenerator('id', Sha256::class, 'key', 'issuer'); $time = time(); - $token = $generator->getToken(2, 'test@example.com'); + $token = $generator->getToken('2', 'test@example.com'); $this->assertEquals('issuer', $token->getClaim('iss')); $this->assertEquals('issuer', $token->getClaim('aud')); @@ -80,7 +80,7 @@ public function testTokenWithAudience(): void $generator = new TokenGenerator('id', Sha256::class, 'key', 'issuer', 'audience'); $time = time(); - $token = $generator->getToken(2, 'test@example.com'); + $token = $generator->getToken('2', 'test@example.com'); $this->assertEquals('issuer', $token->getClaim('iss')); $this->assertEquals('audience', $token->getClaim('aud')); @@ -100,7 +100,7 @@ public function testTokenWithSigner(): void $generator = new TokenGenerator('id', Sha256::class, 'key', 'issuer', 'audience'); $time = time(); - $token = $generator->getToken(2, 'test@example.com'); + $token = $generator->getToken('2', 'test@example.com'); $this->assertEquals('issuer', $token->getClaim('iss')); $this->assertEquals('audience', $token->getClaim('aud')); @@ -123,7 +123,7 @@ public function testNotAllowedSerializedObjects(): void $time = time(); $stdClass = new \stdClass(); $stdClass->prop = 'something'; - $token = $generator->getToken(2, 'test@example.com', ['hash' => 'blah blah blah', 'stdClass' => $stdClass]); + $token = $generator->getToken('2', 'test@example.com', ['hash' => 'blah blah blah', 'stdClass' => $stdClass]); $decrypted = $generator->decryptToken((string)$token); $extra = $decrypted->getExtra(); self::assertArrayHasKey('stdClass', $extra);