Skip to content

Commit

Permalink
Assert token is not revoked before revoking it
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Jul 15, 2024
1 parent ae4df3d commit 02be53a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/Repositories/Traits/RevokeTokenByAuthCodeIdTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ public function testItGenerateQuery(): void
);
}

/**
* @return void
* @throws \JsonException
* @throws \League\OAuth2\Server\Exception\UniqueTokenIdentifierConstraintViolationException
* @throws \SimpleSAML\Error\Error
* @throws \SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException
*/
public function testRevokeByAuthCodeId(): void
{
$accessToken = self::$repository->getNewToken(
Expand All @@ -162,12 +169,24 @@ public function testRevokeByAuthCodeId(): void

self::$repository->persistNewAccessToken($accessToken);

$isRevoked = self::$repository->isAccessTokenRevoked(self::ACCESS_TOKEN_ID);
$this->assertFalse($isRevoked);

// Revoke the access token
self::$mock->revokeByAuthCodeId(self::AUTH_CODE_ID);
$isRevoked = self::$repository->isAccessTokenRevoked(self::ACCESS_TOKEN_ID);

$this->assertTrue($isRevoked);
}

/**
* @param string $id
* @param bool $enabled
* @param bool $confidential
* @param string|null $owner
*
* @return ClientEntityInterface
*/
public static function clientRepositoryGetClient(
string $id,
bool $enabled = true,
Expand Down

0 comments on commit 02be53a

Please sign in to comment.