diff --git a/examples/src/Repositories/DeviceCodeRepository.php b/examples/src/Repositories/DeviceCodeRepository.php index 053720ffd..f71141575 100644 --- a/examples/src/Repositories/DeviceCodeRepository.php +++ b/examples/src/Repositories/DeviceCodeRepository.php @@ -45,11 +45,11 @@ public function getDeviceCodeEntityByDeviceCode($deviceCode): ?DeviceCodeEntityI $deviceCodeEntity = new DeviceCodeEntity(); $deviceCodeEntity->setIdentifier($deviceCode); - $deviceCodeEntity->setExpiryDateTime((new DateTimeImmutable)->setTimestamp($this->getDeviceCodeExpiryTime($deviceCode))); + $deviceCodeEntity->setExpiryDateTime(new DateTimeImmutable('now +1 hour')); $deviceCodeEntity->setClient($clientEntity); - // TODO: Check if this is still true as it seems we need to set userapproved - // The user identifier should be set when the user authenticates on the OAuth server + // The user identifier should be set when the user authenticates on the + // OAuth server, along with whether they approved the request $deviceCodeEntity->setUserApproved(true); $deviceCodeEntity->setUserIdentifier(1); @@ -71,15 +71,4 @@ public function isDeviceCodeRevoked($codeId): bool { return false; } - - // TODO: This should probably return a datetimeimmutable object to match the setter - public function getDeviceCodeExpiryTime(string $codeId): int - { - return (new DateTimeImmutable('now + 1 hour'))->getTimestamp(); - } - - public function getDeviceCodeClientId(string $codeId): string - { - // Some logic to get the client ID of the device code - } } diff --git a/examples/src/Repositories/ScopeRepository.php b/examples/src/Repositories/ScopeRepository.php index 6b0d72a45..21ea92ba8 100644 --- a/examples/src/Repositories/ScopeRepository.php +++ b/examples/src/Repositories/ScopeRepository.php @@ -40,7 +40,6 @@ public function getScopeEntityByIdentifier($scopeIdentifier): ?ScopeEntityInterf return $scope; } - // TODO: Check why I have added authCodeId here /** * {@inheritdoc} */ diff --git a/src/Grant/DeviceCodeGrant.php b/src/Grant/DeviceCodeGrant.php index e6921a7ee..bf90d6105 100644 --- a/src/Grant/DeviceCodeGrant.php +++ b/src/Grant/DeviceCodeGrant.php @@ -141,7 +141,6 @@ public function respondToAccessTokenRequest( $scopes = $this->validateScopes($this->getRequestParameter('scope', $request, $this->defaultScope)); $deviceCodeEntity = $this->validateDeviceCode($request, $client); - // TODO: This should be set on the repository, not the entity $deviceCodeEntity->setLastPolledAt(new DateTimeImmutable()); $this->deviceCodeRepository->persistDeviceCode($deviceCodeEntity); diff --git a/src/Repositories/DeviceCodeRepositoryInterface.php b/src/Repositories/DeviceCodeRepositoryInterface.php index e548ab0c5..b25b45d20 100644 --- a/src/Repositories/DeviceCodeRepositoryInterface.php +++ b/src/Repositories/DeviceCodeRepositoryInterface.php @@ -51,14 +51,4 @@ public function revokeDeviceCode(string $codeId): void; * @return bool Return true if this code has been revoked */ public function isDeviceCodeRevoked(string $codeId): bool; - - /** - * Get the expiry time of the device code. - */ - public function getDeviceCodeExpiryTime(string $codeId): int; - - /** - * Get the client ID of the device code. - */ - public function getDeviceCodeClientId(string $codeId): string; }