Skip to content

Commit 899aea6

Browse files
authored
Merge pull request #207 from oat-sa/fix/compatibility-issues
Fix compatibility issues
2 parents 84d5968 + 01aeebb commit 899aea6

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212

1313
strategy:
1414
fail-fast: false
@@ -41,6 +41,7 @@ jobs:
4141
|| ./vendor/bin/phpunit
4242
4343
- name: Psalm
44+
if: ${{ matrix.php == '8.0' }}
4445
run: |
4546
./vendor/bin/psalm --shepherd
4647

psalm.xml.dist

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,49 @@
2727
<file name="src/Resource/ResourceCollectionInterface.php" />
2828
</errorLevel>
2929
</PossiblyUnusedReturnValue>
30-
30+
3131
<MissingTemplateParam>
3232
<errorLevel type="suppress">
3333
<file name="src/Resource/ResourceCollectionInterface.php" />
3434
<file name="src/Util/Collection/CollectionInterface.php" />
3535
</errorLevel>
3636
</MissingTemplateParam>
37-
37+
3838
<FalsableReturnStatement>
3939
<errorLevel type="suppress">
4040
<file name="src/Role/Type/CustomRole.php" />
4141
</errorLevel>
4242
</FalsableReturnStatement>
43-
43+
4444
<PossiblyFalseArgument>
4545
<errorLevel type="suppress">
4646
<file name="src/Security/Jwks/Exporter/Jwk/JwkRS256Exporter.php" />
4747
</errorLevel>
4848
</PossiblyFalseArgument>
49-
49+
5050
<PossiblyInvalidArrayAccess>
5151
<errorLevel type="suppress">
5252
<file name="src/Security/Jwks/Exporter/Jwk/JwkRS256Exporter.php" />
5353
</errorLevel>
5454
</PossiblyInvalidArrayAccess>
55-
55+
5656
<UnusedProperty>
5757
<errorLevel type="suppress">
5858
<file name="src/Security/Jwks/Fetcher/JwksFetcher.php" />
5959
</errorLevel>
6060
</UnusedProperty>
61-
61+
6262
<InternalClass>
6363
<errorLevel type="suppress">
64-
<file name="src/Security/Jwt/Signer/SignerFactory.php"/>
64+
<file name="src/Security/Jwt/Signer/SignerFactory.php" />
6565
</errorLevel>
6666
</InternalClass>
67+
68+
<TooManyArguments>
69+
<errorLevel type="suppress">
70+
<file name="src/Security/Jwt/Configuration/ConfigurationFactory.php" />
71+
</errorLevel>
72+
</TooManyArguments>
6773
</issueHandlers>
6874
<mockClasses>
6975
<class name="PHPUnit\Framework\MockObject\MockObject"/>

src/Security/OAuth2/Entity/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(RegistrationInterface $registration)
3737
{
3838
$this->registration = $registration;
3939
$this->name = $this->registration->getTool()->getName();
40-
$this->redirectUri = $this->registration->getTool()->getLaunchUrl();
40+
$this->redirectUri = (string)$this->registration->getTool()->getLaunchUrl();
4141
$this->isConfidential = true;
4242
}
4343

src/Security/OAuth2/Repository/AccessTokenRepository.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public function getNewToken(ClientEntityInterface $clientEntity, array $scopes,
5353
$accessToken = new AccessToken();
5454

5555
$accessToken->setClient($clientEntity);
56-
$accessToken->setUserIdentifier($userIdentifier);
56+
if (null !== $userIdentifier) {
57+
$accessToken->setUserIdentifier($userIdentifier);
58+
}
5759

5860
foreach ($scopes as $scope) {
5961
$accessToken->addScope($scope);

src/Security/OAuth2/Repository/ScopeRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public function finalizeScopes(
5858
array $scopes,
5959
$grantType,
6060
ClientEntityInterface $clientEntity,
61-
$userIdentifier = null
61+
$userIdentifier = null,
62+
?string $authCodeId = null,
6263
): array {
6364
return $scopes;
6465
}

tests/Integration/Security/OAuth2/Repository/AccessTokenRepositoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
namespace OAT\Library\Lti1p3Core\Tests\Integration\Security\OAuth2\Repository;
2424

2525
use Cache\Adapter\PHPArray\ArrayCachePool;
26+
use DateTimeImmutable;
2627
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
2728
use OAT\Library\Lti1p3Core\Security\OAuth2\Entity\AccessToken;
2829
use OAT\Library\Lti1p3Core\Security\OAuth2\Entity\Client;
@@ -94,6 +95,7 @@ private function createAccessToken($accessTokenIdentifier = null): AccessTokenEn
9495
$accessToken = new AccessToken();
9596

9697
$accessToken->setIdentifier($accessTokenIdentifier ?? 'accessTokenIdentifier');
98+
$accessToken->setExpiryDateTime(new DateTimeImmutable('+1 minute'));
9799
$accessToken->setClient(new Client($this->createTestRegistration()));
98100
$accessToken->addScope(new Scope('scope1'));
99101
$accessToken->addScope(new Scope('scope2'));

tests/Unit/Security/OAuth2/ResponseType/ScopedBearerTokenResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace OAT\Library\Lti1p3Core\Tests\Unit\Security\OAuth2\ResponseType;
2424

25-
use Carbon\Carbon;
25+
use DateTimeImmutable;
2626
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
2727
use League\OAuth2\Server\Entities\ScopeEntityInterface;
2828
use League\OAuth2\Server\ResponseTypes\BearerTokenResponse;
@@ -53,7 +53,7 @@ public function testItAddScopeToResponse(): void
5353

5454
/** @var AccessTokenEntityInterface|MockObject $accessToken */
5555
$accessToken = $this->createMock(AccessTokenEntityInterface::class);
56-
$accessToken->method('getExpiryDateTime')->willReturn(Carbon::now());
56+
$accessToken->method('getExpiryDateTime')->willReturn(new DateTimeImmutable());
5757
$accessToken->method('getScopes')->willReturn([$scope]);
5858

5959
$this->subject->setAccessToken($accessToken);

0 commit comments

Comments
 (0)