Skip to content

Commit 3287ae8

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pass-user-id-to-finalize-scopes
2 parents 163834b + d8e2f39 commit 3287ae8

35 files changed

+502
-159
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
php-version: [8.1, 8.2, 8.3, 8.4]
15+
php-version: [8.1, 8.2, 8.3, 8.4, 8.5]
1616
composer-stability: [prefer-lowest, prefer-stable]
1717
operating-system:
1818
- ubuntu-latest

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php: [8.1, 8.2, 8.3, 8.4]
14+
php: [8.1, 8.2, 8.3, 8.4, 8.5]
1515
os: [ubuntu-latest, windows-latest]
1616
stability: [prefer-lowest, prefer-stable]
1717

@@ -44,6 +44,6 @@ jobs:
4444
run: vendor/bin/phpunit --coverage-clover=coverage.clover
4545

4646
- name: Code coverage
47-
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'thephpleague/oauth2-server' }}
47+
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'thephpleague/oauth2-server' && startsWith(matrix.os, 'ubuntu') }}
4848
run:
4949
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

.styleci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ enabled:
99
- include
1010
- method_separation
1111
- native_function_casing
12-
- no_blank_lines_between_uses
1312
- no_duplicate_semicolons
1413
- no_multiline_whitespace_before_semicolons
1514
- no_php4_constructor

CHANGELOG.md

Lines changed: 121 additions & 12 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The latest version of this package supports the following versions of PHP:
3636
* PHP 8.2
3737
* PHP 8.3
3838
* PHP 8.4
39+
* PHP 8.5
3940

4041
The `openssl` and `json` extensions are also required.
4142

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "https://oauth2.thephpleague.com/",
55
"license": "MIT",
66
"require": {
7-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
7+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
88
"ext-openssl": "*",
99
"league/event": "^3.0",
1010
"league/uri": "^7.0",
@@ -16,14 +16,14 @@
1616
"psr/http-server-middleware": "^1.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^9.6.21",
19+
"phpunit/phpunit": "^10.5|^11.5|^12.0",
2020
"laminas/laminas-diactoros": "^3.5",
21-
"phpstan/phpstan": "^1.12",
22-
"phpstan/phpstan-phpunit": "^1.3.15",
21+
"phpstan/phpstan": "^1.12|^2.0",
22+
"phpstan/phpstan-phpunit": "^1.3.15|^2.0",
2323
"roave/security-advisories": "dev-master",
2424
"phpstan/extension-installer": "^1.3.1",
25-
"phpstan/phpstan-deprecation-rules": "^1.1.4",
26-
"phpstan/phpstan-strict-rules": "^1.5.2",
25+
"phpstan/phpstan-deprecation-rules": "^1.1.4|^2.0",
26+
"phpstan/phpstan-strict-rules": "^1.5.2|^2.0",
2727
"slevomat/coding-standard": "^8.14.1",
2828
"php-parallel-lint/php-parallel-lint": "^1.3.2",
2929
"squizlabs/php_codesniffer": "^3.8"
@@ -46,7 +46,6 @@
4646
"authentication",
4747
"resource",
4848
"api",
49-
"auth",
5049
"protect",
5150
"secure"
5251
],

phpstan.neon.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ parameters:
22
level: 8
33
paths:
44
- src
5-
- tests
5+
- tests
6+
ignoreErrors:
7+
-
8+
message: '#Deprecated since v5.5, please use {@see self::withValidationConstraints\(\)} instead#'
9+
reportUnmatched: false

phpunit.xml.dist

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
45
colors="true"
6+
failOnRisky="true"
7+
failOnWarning="true"
58
stopOnError="true"
69
stopOnFailure="true"
7-
stopOnIncomplete="false"
8-
stopOnSkipped="false"
9-
bootstrap="tests/Bootstrap.php"
1010
>
11-
<coverage includeUncoveredFiles="true">
11+
<source>
1212
<include>
13-
<directory suffix=".php">src</directory>
13+
<directory>src</directory>
1414
</include>
15-
</coverage>
15+
</source>
16+
1617
<testsuites>
1718
<testsuite name="Tests">
1819
<directory>./tests/</directory>

src/AuthorizationServer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use League\OAuth2\Server\ResponseTypes\ResponseTypeInterface;
2828
use Psr\Http\Message\ResponseInterface;
2929
use Psr\Http\Message\ServerRequestInterface;
30+
use SensitiveParameter;
3031

3132
class AuthorizationServer implements EmitterAwareInterface
3233
{
@@ -61,7 +62,9 @@ public function __construct(
6162
private ClientRepositoryInterface $clientRepository,
6263
private AccessTokenRepositoryInterface $accessTokenRepository,
6364
private ScopeRepositoryInterface $scopeRepository,
65+
#[SensitiveParameter]
6466
CryptKeyInterface|string $privateKey,
67+
#[SensitiveParameter]
6568
Key|string $encryptionKey,
6669
ResponseTypeInterface|null $responseType = null
6770
) {

src/AuthorizationValidators/BearerTokenValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private function initJwtConfiguration(): void
7474
throw new RuntimeException('Public key is empty');
7575
}
7676

77+
// TODO: next major release: replace deprecated method and remove phpstan ignored error
7778
$this->jwtConfiguration->setValidationConstraints(
7879
new LooseValidAt($clock, $this->jwtValidAtDateLeeway),
7980
new SignedWith(
@@ -93,7 +94,7 @@ public function validateAuthorization(ServerRequestInterface $request): ServerRe
9394
}
9495

9596
$header = $request->getHeader('authorization');
96-
$jwt = trim((string) preg_replace('/^\s*Bearer\s/', '', $header[0]));
97+
$jwt = trim((string) preg_replace('/^\s*Bearer\s/i', '', $header[0]));
9798

9899
if ($jwt === '') {
99100
throw OAuthServerException::accessDenied('Missing "Bearer" token');

0 commit comments

Comments
 (0)