Skip to content

Commit

Permalink
change function name and update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Sephster committed Jun 3, 2021
1 parent 8c33b52 commit d7634f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- The server will now validate redirect uris according to rfc8252 (PR #1203)
- Events emitted now include the refresh token and access token payloads (PR #1211)
- Use the `revokeRefreshTokens()` function to decide whether refresh tokens are revoked or not upon use (PR #1189)

### Changed
- Keys are now validated using `openssl_pkey_get_private()` and openssl_pkey_get_public()` instead of regex matching (PR #1215)
Expand Down
4 changes: 2 additions & 2 deletions src/AuthorizationServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function enableGrantType(GrantTypeInterface $grantType, DateInterval $acc
$grantType->setPrivateKey($this->privateKey);
$grantType->setEmitter($this->getEmitter());
$grantType->setEncryptionKey($this->encryptionKey);
$grantType->setRevokeRefreshTokens($this->revokeRefreshTokens);
$grantType->revokeRefreshTokens($this->revokeRefreshTokens);

This comment has been minimized.

Copy link
@reedy

reedy Mar 1, 2022

Contributor

revokeRefreshTokens isn't part of GrantTypeInterface.

And seemingly, neither was setRevokeRefreshTokens...

https://github.com/thephpleague/oauth2-server/blob/4bb5b74/src/Grant/GrantTypeInterface.php


$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
Expand Down Expand Up @@ -245,7 +245,7 @@ public function setDefaultScope($defaultScope)
*
* @param bool $revokeRefreshTokens
*/
public function setRevokeRefreshTokens(bool $revokeRefreshTokens): void
public function revokeRefreshTokens(bool $revokeRefreshTokens): void
{
$this->revokeRefreshTokens = $revokeRefreshTokens;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Grant/AbstractGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function setDefaultScope($scope)
/**
* @param bool $revokeRefreshTokens
*/
public function setRevokeRefreshTokens(bool $revokeRefreshTokens)
public function revokeRefreshTokens(bool $revokeRefreshTokens)
{
$this->revokeRefreshTokens = $revokeRefreshTokens;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Grant/RefreshTokenGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testRespondToRequest()
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
$grant->setRevokeRefreshTokens(true);
$grant->revokeRefreshTokens(true);

$oldRefreshToken = $this->cryptStub->doEncrypt(
\json_encode(
Expand Down Expand Up @@ -183,7 +183,7 @@ public function testRespondToReducedScopes()
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
$grant->setRevokeRefreshTokens(true);
$grant->revokeRefreshTokens(true);

$oldRefreshToken = $this->cryptStub->doEncrypt(
\json_encode(
Expand Down Expand Up @@ -523,7 +523,7 @@ public function testRevokedRefreshToken()
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
$grant->setRevokeRefreshTokens(true);
$grant->revokeRefreshTokens(true);
$grant->respondToAccessTokenRequest($serverRequest, new StubResponseType(), new DateInterval('PT5M'));

Assert::assertTrue($refreshTokenRepositoryMock->isRefreshTokenRevoked($refreshTokenId));
Expand Down

0 comments on commit d7634f9

Please sign in to comment.