Skip to content

Commit 20f88dc

Browse files
Merge pull request #50 from minvws/support-laravel
feat: support laravel 12
2 parents 8ecce78 + 0234a0d commit 20f88dc

File tree

7 files changed

+32
-12
lines changed

7 files changed

+32
-12
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: [ 8.1, 8.2, 8.3 ]
17-
laravel: [ 10.*, 11.* ]
16+
php: [ 8.1, 8.2, 8.3, 8.4 ]
17+
laravel: [ 10.*, 11.*, 12.* ]
1818
stability: [ prefer-stable ]
1919
experimental: [ false ]
2020
include:
2121
- laravel: 10.*
2222
testbench: 8.*
2323
- laravel: 11.*
2424
testbench: 9.*
25+
- laravel: 12.*
26+
testbench: 10.*
2527
exclude:
2628
- php: 8.1
2729
laravel: 11.*
30+
- php: 8.1
31+
laravel: 12.*
2832

2933

3034
name: PHP ${{ matrix.php }} - L${{ matrix.laravel }}
@@ -49,11 +53,10 @@ jobs:
4953
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev --ignore-platform-reqs
5054
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
5155
52-
- name: Setup problem matchers for PHP
53-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
54-
55-
- name: Setup problem matchers for PHPUnit
56-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
56+
- name: Setup problem matchers
57+
run: |
58+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
59+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5760
5861
- name: Execute tests (Unit and Feature)
5962
run: vendor/bin/phpunit

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
"php": ">=8.1",
3434
"jumbojett/openid-connect-php": "^1.0.2",
3535
"guzzlehttp/guzzle": "^7.5",
36-
"illuminate/contracts": "^10.0||^11.0",
36+
"illuminate/contracts": "^10.0||^11.0||^12.0",
3737
"web-token/jwt-library": "^3.4"
3838
},
3939
"require-dev": {
40-
"orchestra/testbench": "^8.0||^9.0",
41-
"phpunit/phpunit": "^10.0",
42-
"vimeo/psalm": "^5.8",
40+
"orchestra/testbench": "^8.0||^9.0||^10.0",
41+
"phpunit/phpunit": "^10.0||^11.0||^12.0",
42+
"vimeo/psalm": "^5.8||^6.0",
4343
"phpstan/phpstan": "^1.10",
4444
"squizlabs/php_codesniffer": "^3.8",
4545
"slevomat/coding-standard": "^8.14",

src/Http/Responses/LoginResponseHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
class LoginResponseHandler implements LoginResponseHandlerInterface
1111
{
12+
#[\Override]
1213
public function handleLoginResponse(object $userInfo): Response
1314
{
1415
return new JsonResponse([

src/OpenIDConnectClient.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ public function __construct(
4040
$this->openIDConfiguration = $openIDConfiguration;
4141
}
4242

43+
#[\Override]
4344
protected function startSession(): void
4445
{
4546
// Laravel magic in the background :)
4647
}
4748

49+
#[\Override]
4850
protected function commitSession(): void
4951
{
5052
Session::save();
@@ -53,6 +55,7 @@ protected function commitSession(): void
5355
/**
5456
* @param string $key
5557
*/
58+
#[\Override]
5659
protected function getSessionKey($key): mixed
5760
{
5861
if (!Session::has($key)) {
@@ -66,6 +69,7 @@ protected function getSessionKey($key): mixed
6669
* @param string $key
6770
* @param mixed $value mixed
6871
*/
72+
#[\Override]
6973
protected function setSessionKey($key, $value): void
7074
{
7175
Session::put($key, $value);
@@ -74,6 +78,7 @@ protected function setSessionKey($key, $value): void
7478
/**
7579
* @param string $key
7680
*/
81+
#[\Override]
7782
protected function unsetSessionKey($key): void
7883
{
7984
Session::remove($key);
@@ -84,6 +89,7 @@ protected function unsetSessionKey($key): void
8489
* @return string the JWT payload
8590
* @throws OpenIDConnectClientException
8691
*/
92+
#[\Override]
8793
protected function handleJweResponse($jwe): string
8894
{
8995
if ($this->jweDecrypter === null) {
@@ -102,6 +108,7 @@ protected function handleJweResponse($jwe): string
102108
* @throws OpenIDConnectClientException
103109
* @return string|string[]|bool
104110
*/
111+
#[\Override]
105112
protected function getWellKnownConfigValue($param, $default = null): string|array|bool
106113
{
107114
if ($this->openIDConfiguration === null) {
@@ -137,6 +144,7 @@ public function setLoginHint(?string $loginHint = null): void
137144
* @return void
138145
* @throws OpenIDConnectClientException
139146
*/
147+
#[\Override]
140148
public function redirect($url): void
141149
{
142150
throw new HttpResponseException(new RedirectResponse($url));
@@ -172,7 +180,8 @@ protected function getAuthorizationEndpoint(): string
172180
* @return string
173181
* @throws OpenIDConnectClientException
174182
*/
175-
protected function fetchURL(string $url, string $post_body = null, array $headers = []): string
183+
#[\Override]
184+
protected function fetchURL(string $url, ?string $post_body = null, array $headers = []): string
176185
{
177186
$pendingRequest = Http::withUserAgent($this->getUserAgent())
178187
->timeout($this->timeOut)
@@ -211,6 +220,7 @@ protected function fetchURL(string $url, string $post_body = null, array $header
211220
*
212221
* @return int
213222
*/
223+
#[\Override]
214224
public function getResponseCode(): int
215225
{
216226
return $this->responseCode ?? 0;
@@ -221,6 +231,7 @@ public function getResponseCode(): int
221231
*
222232
* @return string|null
223233
*/
234+
#[\Override]
224235
public function getResponseContentType(): ?string
225236
{
226237
return $this->internalResponseContentType;

src/OpenIDConnectServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
class OpenIDConnectServiceProvider extends ServiceProvider
2727
{
28+
#[\Override]
2829
public function register(): void
2930
{
3031
$this->mergeConfigFrom(__DIR__ . '/../config/oidc.php', 'oidc');

src/Services/ExceptionHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function __construct(
1717
) {
1818
}
1919

20+
#[\Override]
2021
public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $exception): Response
2122
{
2223
if (str_starts_with($exception->getMessage(), 'Error: ')) {
@@ -38,6 +39,7 @@ public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $e
3839
* @param OpenIDConnectClientException $exception
3940
* @return Response
4041
*/
42+
#[\Override]
4143
public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException $exception): Response
4244
{
4345
$this->logger?->error('OIDC Exception occurred while requesting user info', [
@@ -47,6 +49,7 @@ public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException
4749
return $this->defaultResponse($exception);
4850
}
4951

52+
#[\Override]
5053
public function handleException(Exception $exception): Response
5154
{
5255
$this->logger?->error('OIDC Generic exception occurred', [

src/Services/JWE/JweDecryptService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct(
3535
/**
3636
* @throws JweDecryptException
3737
*/
38+
#[\Override]
3839
public function decrypt(string $jweString): string
3940
{
4041
$jwe = $this->serializerManager->unserialize($jweString);

0 commit comments

Comments
 (0)