Skip to content

Commit

Permalink
no encryption on this grant
Browse files Browse the repository at this point in the history
  • Loading branch information
hafezdivandari committed Oct 28, 2024
1 parent 8d4d98f commit 7522a46
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions tests/Grant/DeviceCodeGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
use LeagueTests\Stubs\AccessTokenEntity;
use LeagueTests\Stubs\ClientEntity;
use LeagueTests\Stubs\CryptTraitStub;
use LeagueTests\Stubs\DeviceCodeEntity;
use LeagueTests\Stubs\RefreshTokenEntity;
use LeagueTests\Stubs\ScopeEntity;
Expand All @@ -36,13 +35,6 @@ class DeviceCodeGrantTest extends TestCase
private const DEFAULT_SCOPE = 'basic';
private const INTERVAL_RATE = 10;

protected CryptTraitStub $cryptStub;

public function setUp(): void
{
$this->cryptStub = new CryptTraitStub();
}

public function testGetIdentifier(): void
{
$deviceCodeRepositoryMock = $this->getMockBuilder(DeviceCodeRepositoryInterface::class)->getMock();
Expand Down Expand Up @@ -100,7 +92,6 @@ public function testRespondToDeviceAuthorizationRequest(): void

$grant->setClientRepository($clientRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setScopeRepository($scopeRepositoryMock);

$request = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -145,7 +136,6 @@ public function testRespondToDeviceAuthorizationRequestWithVerificationUriComple

$grant->setClientRepository($clientRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setScopeRepository($scopeRepositoryMock);

$request = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -272,8 +262,6 @@ public function testCompleteDeviceAuthorizationRequest(): void
'http://foo/bar',
);

$grant->setEncryptionKey($this->cryptStub->getKey());

$grant->completeDeviceAuthorizationRequest($deviceCode->getIdentifier(), 'userId', true);

$this::assertEquals('userId', $deviceCode->getUserIdentifier());
Expand Down Expand Up @@ -323,8 +311,6 @@ public function testDeviceAuthorizationResponse(): void
'http://foo/bar'
);

$deviceCodeGrant->setEncryptionKey($this->cryptStub->getKey());

$server->enableGrantType($deviceCodeGrant);

$response = $server->respondToDeviceAuthorizationRequest($serverRequest, new Response());
Expand Down Expand Up @@ -390,7 +376,6 @@ public function testRespondToAccessTokenRequest(): void
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$grant->completeDeviceAuthorizationRequest($deviceCodeEntity->getIdentifier(), 'baz', true);
Expand Down Expand Up @@ -469,7 +454,6 @@ public function testRespondToRequestMissingDeviceCode(): void
$grant->setClientRepository($clientRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$serverRequest = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -517,7 +501,6 @@ public function testIssueSlowDownError(): void
$grant->setClientRepository($clientRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$serverRequest = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -565,7 +548,6 @@ public function testIssueAuthorizationPendingError(): void
$grant->setClientRepository($clientRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$serverRequest = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -613,7 +595,6 @@ public function testIssueExpiredTokenError(): void
$grant->setClientRepository($clientRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$serverRequest = (new ServerRequest())->withParsedBody([
Expand Down Expand Up @@ -657,7 +638,6 @@ public function testSettingDeviceCodeIntervalRate(): void

$grant->setClientRepository($clientRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setIntervalVisibility(true);

Expand Down Expand Up @@ -712,7 +692,6 @@ public function testIssueAccessDeniedError(): void
$grant->setClientRepository($clientRepositoryMock);
$grant->setScopeRepository($scopeRepositoryMock);
$grant->setDefaultScope(self::DEFAULT_SCOPE);
$grant->setEncryptionKey($this->cryptStub->getKey());
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));

$grant->completeDeviceAuthorizationRequest($deviceCode->getIdentifier(), '1', false);
Expand Down

0 comments on commit 7522a46

Please sign in to comment.