Skip to content

Commit abfa828

Browse files
committed
Fix styling
1 parent 6720d77 commit abfa828

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+38
-271
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1919
- Authorization Request objects are now created through the factory method, `createAuthorizationRequest()` (PR #1111)
2020
- Changed parameters for `finalizeScopes()` to allow a reference to an auth code ID (PR #1112)
2121

22+
### Removed
23+
- Removed message property from OAuthException HTTP response. Now just use error_description as per the OAuth 2 spec (PR #1375)
24+
2225
### [8.3.6] - released 2022-11-14
2326
### Fixed
2427
- Use LooseValidAt instead of StrictValidAt so that users aren't forced to use claims such as NBF in their JWT tokens (PR #1312)

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ parameters:
44
- src
55
- tests
66
ignoreErrors:
7+
-
8+
message: '#Call to an undefined method League\\OAuth2\\Server\\ResponseTypes\\ResponseTypeInterface::getAccessToken\(\)\.#'
9+
path: tests/Grant/ClientCredentialsGrantTest.php
10+
- '#Return type \(League\\Event\\EmitterInterface\|null\) of method LeagueTests\\Stubs\\GrantType::getEmitter\(\) should be covariant with return type \(League\\Event\\EmitterInterface\) of method League\\Event\\EmitterAwareInterface::getEmitter\(\)#'
711
- '#Method League\\OAuth2\\Server\\Grant\\AbstractGrant::issueAccessToken\(\) should return League\\OAuth2\\Server\\Entities\\AccessTokenEntityInterface but return statement is missing\.#'
812
- '#Method League\\OAuth2\\Server\\Grant\\AbstractGrant::issueAuthCode\(\) should return League\\OAuth2\\Server\\Entities\\AuthCodeEntityInterface but return statement is missing\.#'
913
- '#Method League\\OAuth2\\Server\\Grant\\AbstractGrant::issueRefreshToken\(\) should return League\\OAuth2\\Server\\Entities\\RefreshTokenEntityInterface\|null but return statement is missing\.#'

src/AuthorizationServer.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ class AuthorizationServer implements EmitterAwareInterface
4848

4949
protected ResponseTypeInterface $responseType;
5050

51-
private ClientRepositoryInterface $clientRepository;
52-
53-
private AccessTokenRepositoryInterface $accessTokenRepository;
54-
55-
private ScopeRepositoryInterface $scopeRepository;
56-
5751
private string|Key $encryptionKey;
5852

5953
private string $defaultScope = '';
@@ -64,16 +58,13 @@ class AuthorizationServer implements EmitterAwareInterface
6458
* New server instance
6559
*/
6660
public function __construct(
67-
ClientRepositoryInterface $clientRepository,
68-
AccessTokenRepositoryInterface $accessTokenRepository,
69-
ScopeRepositoryInterface $scopeRepository,
61+
private ClientRepositoryInterface $clientRepository,
62+
private AccessTokenRepositoryInterface $accessTokenRepository,
63+
private ScopeRepositoryInterface $scopeRepository,
7064
CryptKeyInterface|string $privateKey,
7165
Key|string $encryptionKey,
7266
ResponseTypeInterface|null $responseType = null
7367
) {
74-
$this->clientRepository = $clientRepository;
75-
$this->accessTokenRepository = $accessTokenRepository;
76-
$this->scopeRepository = $scopeRepository;
7768

7869
if ($privateKey instanceof CryptKeyInterface === false) {
7970
$privateKey = new CryptKey($privateKey);

src/AuthorizationValidators/BearerTokenValidator.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,16 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
3939
{
4040
use CryptTrait;
4141

42-
private AccessTokenRepositoryInterface $accessTokenRepository;
43-
4442
protected CryptKeyInterface $publicKey;
4543

4644
private Configuration $jwtConfiguration;
4745

48-
public function __construct(AccessTokenRepositoryInterface $accessTokenRepository)
46+
public function __construct(private AccessTokenRepositoryInterface $accessTokenRepository)
4947
{
50-
$this->accessTokenRepository = $accessTokenRepository;
5148
}
5249

5350
/**
5451
* Set the public key
55-
*
5652
*/
5753
public function setPublicKey(CryptKeyInterface $key): void
5854
{
@@ -113,7 +109,7 @@ public function validateAuthorization(ServerRequestInterface $request): ServerRe
113109
throw OAuthServerException::accessDenied('Access token could not be verified');
114110
}
115111

116-
if (! $token instanceof UnencryptedToken) {
112+
if (!$token instanceof UnencryptedToken) {
117113
throw OAuthServerException::accessDenied('Access token is not an instance of UnencryptedToken');
118114
}
119115

@@ -135,6 +131,7 @@ public function validateAuthorization(ServerRequestInterface $request): ServerRe
135131
/**
136132
* Convert single record arrays into strings to ensure backwards compatibility between v4 and v3.x of lcobucci/jwt
137133
*
134+
* TODO: Investigate as I don't think we need this any more
138135
*
139136
* @return array<string>|string
140137
*/

src/CodeChallengeVerifiers/CodeChallengeVerifierInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ interface CodeChallengeVerifierInterface
1616
{
1717
/**
1818
* Return code challenge method.
19-
*
2019
*/
2120
public function getMethod(): string;
2221

2322
/**
2423
* Verify the code challenge.
25-
*
26-
*
2724
*/
2825
public function verifyCodeChallenge(string $codeVerifier, string $codeChallenge): bool;
2926
}

src/CodeChallengeVerifiers/PlainVerifier.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class PlainVerifier implements CodeChallengeVerifierInterface
1818
{
1919
/**
2020
* Return code challenge method.
21-
*
2221
*/
2322
public function getMethod(): string
2423
{
@@ -27,8 +26,6 @@ public function getMethod(): string
2726

2827
/**
2928
* Verify the code challenge.
30-
*
31-
*
3229
*/
3330
public function verifyCodeChallenge(string $codeVerifier, string $codeChallenge): bool
3431
{

src/CodeChallengeVerifiers/S256Verifier.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class S256Verifier implements CodeChallengeVerifierInterface
2222
{
2323
/**
2424
* Return code challenge method.
25-
*
2625
*/
2726
public function getMethod(): string
2827
{
@@ -31,8 +30,6 @@ public function getMethod(): string
3130

3231
/**
3332
* Verify the code challenge.
34-
*
35-
*
3633
*/
3734
public function verifyCodeChallenge(string $codeVerifier, string $codeChallenge): bool
3835
{

src/CryptKey.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ class CryptKey implements CryptKeyInterface
4141

4242
protected string $keyPath;
4343

44-
protected ?string $passPhrase = null;
45-
46-
public function __construct(string $keyPath, ?string $passPhrase = null, bool $keyPermissionsCheck = true)
44+
public function __construct(string $keyPath, protected ?string $passPhrase = null, bool $keyPermissionsCheck = true)
4745
{
48-
$this->passPhrase = $passPhrase;
4946

5047
if (strpos($keyPath, self::FILE_PREFIX) !== 0 && $this->isValidKey($keyPath, $this->passPhrase ?? '')) {
5148
$this->keyContents = $keyPath;
@@ -103,8 +100,6 @@ public function getKeyContents(): string
103100

104101
/**
105102
* Validate key contents.
106-
*
107-
*
108103
*/
109104
private function isValidKey(string $contents, string $passPhrase): bool
110105
{

src/CryptTrait.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ trait CryptTrait
2828
/**
2929
* Encrypt data with encryptionKey.
3030
*
31-
*
3231
* @throws LogicException
33-
*
3432
*/
3533
protected function encrypt(string $unencryptedData): string
3634
{
@@ -52,9 +50,7 @@ protected function encrypt(string $unencryptedData): string
5250
/**
5351
* Decrypt data with encryptionKey.
5452
*
55-
*
5653
* @throws LogicException
57-
*
5854
*/
5955
protected function decrypt(string $encryptedData): string
6056
{

src/Entities/ClientEntityInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,24 @@ interface ClientEntityInterface
1616
{
1717
/**
1818
* Get the client's identifier.
19-
*
2019
*/
2120
public function getIdentifier(): string;
2221

2322
/**
2423
* Get the client's name.
25-
*
2624
*/
2725
public function getName(): string;
2826

2927
/**
30-
* Returns the registered redirect URI (as a string).
31-
*
32-
* Alternatively return an indexed array of redirect URIs.
28+
* Returns the registered redirect URI (as a string). Alternatively return
29+
* an indexed array of redirect URIs.
3330
*
3431
* @return string|string[]
3532
*/
3633
public function getRedirectUri(): string|array;
3734

3835
/**
3936
* Returns true if the client is confidential.
40-
*
4137
*/
4238
public function isConfidential(): bool;
4339
}

0 commit comments

Comments
 (0)