Skip to content

Commit

Permalink
Apply styleCI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sephster committed Dec 13, 2024
1 parent edb6966 commit c25dcec
Show file tree
Hide file tree
Showing 17 changed files with 352 additions and 352 deletions.
12 changes: 6 additions & 6 deletions examples/public/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@
function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
$users = [
[
'id' => 123,
'name' => 'Alex',
'id' => 123,
'name' => 'Alex',
'email' => '[email protected]',
],
[
'id' => 124,
'name' => 'Frank',
'id' => 124,
'name' => 'Frank',
'email' => '[email protected]',
],
[
'id' => 125,
'name' => 'Phil',
'id' => 125,
'name' => 'Phil',
'email' => '[email protected]',
],
];
Expand Down
2 changes: 1 addition & 1 deletion examples/public/auth_code.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
include __DIR__ . '/../vendor/autoload.php';

$app = new App([
'settings' => [
'settings' => [
'displayErrorDetails' => true,
],
AuthorizationServer::class => function () {
Expand Down
2 changes: 1 addition & 1 deletion examples/public/client_credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
include __DIR__ . '/../vendor/autoload.php';

$app = new App([
'settings' => [
'settings' => [
'displayErrorDetails' => true,
],
AuthorizationServer::class => function () {
Expand Down
2 changes: 1 addition & 1 deletion examples/public/implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
include __DIR__ . '/../vendor/autoload.php';

$app = new App([
'settings' => [
'settings' => [
'displayErrorDetails' => true,
],
AuthorizationServer::class => function () {
Expand Down
4 changes: 2 additions & 2 deletions examples/public/middleware_use.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
include __DIR__ . '/../vendor/autoload.php';

$app = new App([
'settings' => [
'settings' => [
'displayErrorDetails' => true,
],
AuthorizationServer::class => function () {
Expand Down Expand Up @@ -89,7 +89,7 @@

if (\in_array('basic', $request->getAttribute('oauth_scopes', []))) {
$params = [
'id' => 1,
'id' => 1,
'name' => 'Alex',
'city' => 'London',
];
Expand Down
2 changes: 1 addition & 1 deletion examples/public/refresh_token.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
include __DIR__ . '/../vendor/autoload.php';

$app = new App([
'settings' => [
'settings' => [
'displayErrorDetails' => true,
],
AuthorizationServer::class => function () {
Expand Down
6 changes: 3 additions & 3 deletions examples/src/Repositories/ClientRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function validateClient($clientIdentifier, $clientSecret, $grantType)
{
$clients = [
'myawesomeapp' => [
'secret' => \password_hash('abc123', PASSWORD_BCRYPT),
'name' => self::CLIENT_NAME,
'redirect_uri' => self::REDIRECT_URI,
'secret' => \password_hash('abc123', PASSWORD_BCRYPT),
'name' => self::CLIENT_NAME,
'redirect_uri' => self::REDIRECT_URI,
'is_confidential' => true,
],
];
Expand Down
16 changes: 8 additions & 8 deletions src/Grant/AuthCodeGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ public function completeAuthorizationRequest(AuthorizationRequest $authorization
);

$payload = [
'client_id' => $authCode->getClient()->getIdentifier(),
'redirect_uri' => $authCode->getRedirectUri(),
'auth_code_id' => $authCode->getIdentifier(),
'scopes' => $authCode->getScopes(),
'user_id' => $authCode->getUserIdentifier(),
'expire_time' => (new DateTimeImmutable())->add($this->authCodeTTL)->getTimestamp(),
'code_challenge' => $authorizationRequest->getCodeChallenge(),
'client_id' => $authCode->getClient()->getIdentifier(),
'redirect_uri' => $authCode->getRedirectUri(),
'auth_code_id' => $authCode->getIdentifier(),
'scopes' => $authCode->getScopes(),
'user_id' => $authCode->getUserIdentifier(),
'expire_time' => (new DateTimeImmutable())->add($this->authCodeTTL)->getTimestamp(),
'code_challenge' => $authorizationRequest->getCodeChallenge(),
'code_challenge_method' => $authorizationRequest->getCodeChallengeMethod(),
];

Expand All @@ -387,7 +387,7 @@ public function completeAuthorizationRequest(AuthorizationRequest $authorization
$this->makeRedirectUri(
$finalRedirectUri,
[
'code' => $this->encrypt($jsonPayload),
'code' => $this->encrypt($jsonPayload),
'state' => $authorizationRequest->getState(),
]
)
Expand Down
6 changes: 3 additions & 3 deletions src/Grant/ImplicitGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ public function completeAuthorizationRequest(AuthorizationRequest $authorization
$finalRedirectUri,
[
'access_token' => (string) $accessToken,
'token_type' => 'Bearer',
'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - \time(),
'state' => $authorizationRequest->getState(),
'token_type' => 'Bearer',
'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - \time(),
'state' => $authorizationRequest->getState(),
],
$this->queryDelimiter
)
Expand Down
14 changes: 7 additions & 7 deletions src/ResponseTypes/BearerTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ public function generateHttpResponse(ResponseInterface $response)
$expireDateTime = $this->accessToken->getExpiryDateTime()->getTimestamp();

$responseParams = [
'token_type' => 'Bearer',
'expires_in' => $expireDateTime - \time(),
'token_type' => 'Bearer',
'expires_in' => $expireDateTime - \time(),
'access_token' => (string) $this->accessToken,
];

if ($this->refreshToken instanceof RefreshTokenEntityInterface) {
$refreshTokenPayload = \json_encode([
'client_id' => $this->accessToken->getClient()->getIdentifier(),
'client_id' => $this->accessToken->getClient()->getIdentifier(),
'refresh_token_id' => $this->refreshToken->getIdentifier(),
'access_token_id' => $this->accessToken->getIdentifier(),
'scopes' => $this->accessToken->getScopes(),
'user_id' => $this->accessToken->getUserIdentifier(),
'expire_time' => $this->refreshToken->getExpiryDateTime()->getTimestamp(),
'access_token_id' => $this->accessToken->getIdentifier(),
'scopes' => $this->accessToken->getScopes(),
'user_id' => $this->accessToken->getUserIdentifier(),
'expire_time' => $this->refreshToken->getExpiryDateTime()->getTimestamp(),
]);

if ($refreshTokenPayload === false) {
Expand Down
6 changes: 3 additions & 3 deletions tests/AuthorizationServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function testValidateAuthorizationRequest()
$cookies = [],
$queryParams = [
'response_type' => 'code',
'client_id' => 'foo',
'client_id' => 'foo',
]
);

Expand Down Expand Up @@ -342,7 +342,7 @@ public function testValidateAuthorizationRequestWithMissingRedirectUri()
$cookies = [],
$queryParams = [
'response_type' => 'code',
'client_id' => 'foo',
'client_id' => 'foo',
]
);

Expand All @@ -369,7 +369,7 @@ public function testValidateAuthorizationRequestUnregistered()
'client_id' => 'foo',
]);

$this->expectException(\League\OAuth2\Server\Exception\OAuthServerException::class);
$this->expectException(OAuthServerException::class);
$this->expectExceptionCode(2);

$server->validateAuthorizationRequest($request);
Expand Down
16 changes: 8 additions & 8 deletions tests/Grant/AbstractGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testGetClientCredentialsClientSecretNotAString()
[],
[],
[
'client_id' => 'client_id',
'client_id' => 'client_id',
'client_secret' => ['not', 'a', 'string'],
]
);
Expand Down Expand Up @@ -161,9 +161,9 @@ public function testValidateClientConfidential()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'client_secret' => 'bar',
'redirect_uri' => 'http://foo/bar',
'redirect_uri' => 'http://foo/bar',
]);

$validateClientMethod = $abstractGrantReflection->getMethod('validateClient');
Expand Down Expand Up @@ -229,7 +229,7 @@ public function testValidateClientInvalidClientSecret()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'client_secret' => 'foo',
]);

Expand All @@ -255,7 +255,7 @@ public function testValidateClientInvalidRedirectUri()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'redirect_uri' => 'http://bar/foo',
]);

Expand All @@ -281,7 +281,7 @@ public function testValidateClientInvalidRedirectUriArray()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'redirect_uri' => 'http://bar/foo',
]);

Expand All @@ -307,7 +307,7 @@ public function testValidateClientMalformedRedirectUri()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'redirect_uri' => ['not', 'a', 'string'],
]);

Expand All @@ -331,7 +331,7 @@ public function testValidateClientBadClient()
$abstractGrantReflection = new \ReflectionClass($grantMock);

$serverRequest = (new ServerRequest())->withParsedBody([
'client_id' => 'foo',
'client_id' => 'foo',
'client_secret' => 'bar',
]);

Expand Down
Loading

0 comments on commit c25dcec

Please sign in to comment.