Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 10.*, 11.* ]
php: [ 8.1, 8.2, 8.3, 8.4 ]
laravel: [ 10.*, 11.*, 12.* ]
stability: [ prefer-stable ]
experimental: [ false ]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
exclude:
- php: 8.1
laravel: 11.*
- php: 8.1
laravel: 12.*


name: PHP ${{ matrix.php }} - L${{ matrix.laravel }}
Expand All @@ -49,11 +53,10 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev --ignore-platform-reqs
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Execute tests (Unit and Feature)
run: vendor/bin/phpunit
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"php": ">=8.1",
"jumbojett/openid-connect-php": "^1.0.2",
"guzzlehttp/guzzle": "^7.5",
"illuminate/contracts": "^10.0||^11.0",
"illuminate/contracts": "^10.0||^11.0||^12.0",
"web-token/jwt-library": "^3.4"
},
"require-dev": {
"orchestra/testbench": "^8.0||^9.0",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.8",
"orchestra/testbench": "^8.0||^9.0||^10.0",
"phpunit/phpunit": "^10.0||^11.0||^12.0",
"vimeo/psalm": "^5.8||^6.0",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.8",
"slevomat/coding-standard": "^8.14",
Expand Down
1 change: 1 addition & 0 deletions src/Http/Responses/LoginResponseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class LoginResponseHandler implements LoginResponseHandlerInterface
{
#[\Override]
public function handleLoginResponse(object $userInfo): Response
{
return new JsonResponse([
Expand Down
13 changes: 12 additions & 1 deletion src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ public function __construct(
$this->openIDConfiguration = $openIDConfiguration;
}

#[\Override]
protected function startSession(): void
{
// Laravel magic in the background :)
}

#[\Override]
protected function commitSession(): void
{
Session::save();
Expand All @@ -53,6 +55,7 @@ protected function commitSession(): void
/**
* @param string $key
*/
#[\Override]
protected function getSessionKey($key): mixed
{
if (!Session::has($key)) {
Expand All @@ -66,6 +69,7 @@ protected function getSessionKey($key): mixed
* @param string $key
* @param mixed $value mixed
*/
#[\Override]
protected function setSessionKey($key, $value): void
{
Session::put($key, $value);
Expand All @@ -74,6 +78,7 @@ protected function setSessionKey($key, $value): void
/**
* @param string $key
*/
#[\Override]
protected function unsetSessionKey($key): void
{
Session::remove($key);
Expand All @@ -84,6 +89,7 @@ protected function unsetSessionKey($key): void
* @return string the JWT payload
* @throws OpenIDConnectClientException
*/
#[\Override]
protected function handleJweResponse($jwe): string
{
if ($this->jweDecrypter === null) {
Expand All @@ -102,6 +108,7 @@ protected function handleJweResponse($jwe): string
* @throws OpenIDConnectClientException
* @return string|string[]|bool
*/
#[\Override]
protected function getWellKnownConfigValue($param, $default = null): string|array|bool
{
if ($this->openIDConfiguration === null) {
Expand Down Expand Up @@ -137,6 +144,7 @@ public function setLoginHint(?string $loginHint = null): void
* @return void
* @throws OpenIDConnectClientException
*/
#[\Override]
public function redirect($url): void
{
throw new HttpResponseException(new RedirectResponse($url));
Expand Down Expand Up @@ -172,7 +180,8 @@ protected function getAuthorizationEndpoint(): string
* @return string
* @throws OpenIDConnectClientException
*/
protected function fetchURL(string $url, string $post_body = null, array $headers = []): string
#[\Override]
protected function fetchURL(string $url, ?string $post_body = null, array $headers = []): string
{
$pendingRequest = Http::withUserAgent($this->getUserAgent())
->timeout($this->timeOut)
Expand Down Expand Up @@ -211,6 +220,7 @@ protected function fetchURL(string $url, string $post_body = null, array $header
*
* @return int
*/
#[\Override]
public function getResponseCode(): int
{
return $this->responseCode ?? 0;
Expand All @@ -221,6 +231,7 @@ public function getResponseCode(): int
*
* @return string|null
*/
#[\Override]
public function getResponseContentType(): ?string
{
return $this->internalResponseContentType;
Expand Down
1 change: 1 addition & 0 deletions src/OpenIDConnectServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

class OpenIDConnectServiceProvider extends ServiceProvider
{
#[\Override]
public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/oidc.php', 'oidc');
Expand Down
3 changes: 3 additions & 0 deletions src/Services/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct(
) {
}

#[\Override]
public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $exception): Response
{
if (str_starts_with($exception->getMessage(), 'Error: ')) {
Expand All @@ -38,6 +39,7 @@ public function handleExceptionWhileAuthenticate(OpenIDConnectClientException $e
* @param OpenIDConnectClientException $exception
* @return Response
*/
#[\Override]
public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException $exception): Response
{
$this->logger?->error('OIDC Exception occurred while requesting user info', [
Expand All @@ -47,6 +49,7 @@ public function handleExceptionWhileRequestUserInfo(OpenIDConnectClientException
return $this->defaultResponse($exception);
}

#[\Override]
public function handleException(Exception $exception): Response
{
$this->logger?->error('OIDC Generic exception occurred', [
Expand Down
1 change: 1 addition & 0 deletions src/Services/JWE/JweDecryptService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct(
/**
* @throws JweDecryptException
*/
#[\Override]
public function decrypt(string $jweString): string
{
$jwe = $this->serializerManager->unserialize($jweString);
Expand Down