Skip to content

Commit 9f4ad55

Browse files
authored
Merge pull request #158 from packbackbooks/lti-157-aud
Fix LtiServiceConnector aud
2 parents e347894 + 21ea15b commit 9f4ad55

26 files changed

+336
-336
lines changed

src/LtiServiceConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getAccessToken(ILtiRegistration $registration, array $scopes): s
4545
$jwtClaim = [
4646
'iss' => $clientId,
4747
'sub' => $clientId,
48-
'aud' => $registration->getAuthServer(),
48+
'aud' => [$registration->getAuthTokenUrl()],
4949
'iat' => time() - 5,
5050
'exp' => time() + 60,
5151
'jti' => 'lti-service-token'.hash('sha256', random_bytes(64)),

tests/Certification/Lti13CertificationTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class Lti13CertificationTest extends TestCase
145145
private $cookie;
146146
private $serviceConnector;
147147

148-
public function setUp(): void
148+
protected function setUp(): void
149149
{
150150
$this->issuer = [
151151
'id' => 'issuer_id',
@@ -283,7 +283,7 @@ public function buildJWT($data, $header)
283283
}
284284

285285
// tests
286-
public function testLtiVersionPassedIsNot13()
286+
public function test_lti_version_passed_is_not13()
287287
{
288288
$payload = $this->payload;
289289
$payload[LtiConstants::VERSION] = 'not-1.3';
@@ -293,7 +293,7 @@ public function testLtiVersionPassedIsNot13()
293293
$this->launch($payload);
294294
}
295295

296-
public function testNoLtiVersionPassedIsInJwt()
296+
public function test_no_lti_version_passed_is_in_jwt()
297297
{
298298
$payload = $this->payload;
299299
unset($payload[LtiConstants::VERSION]);
@@ -303,7 +303,7 @@ public function testNoLtiVersionPassedIsInJwt()
303303
$this->launch($payload);
304304
}
305305

306-
public function testJwtPassedIsNotLti13Jwt()
306+
public function test_jwt_passed_is_not_lti13_jwt()
307307
{
308308
$jwt = $this->buildJWT([], $this->issuer);
309309
$jwt_r = explode('.', $jwt);
@@ -322,7 +322,7 @@ public function testJwtPassedIsNotLti13Jwt()
322322
->initialize($params);
323323
}
324324

325-
public function testExpAndIatFieldsInvalid()
325+
public function test_exp_and_iat_fields_invalid()
326326
{
327327
$payload = $this->payload;
328328
$payload['exp'] = Carbon::now()->subYear()->timestamp;
@@ -333,7 +333,7 @@ public function testExpAndIatFieldsInvalid()
333333
$this->launch($payload);
334334
}
335335

336-
public function testMessageTypeClaimMissing()
336+
public function test_message_type_claim_missing()
337337
{
338338
$payload = $this->payload;
339339
unset($payload[LtiConstants::MESSAGE_TYPE]);
@@ -343,7 +343,7 @@ public function testMessageTypeClaimMissing()
343343
$this->launch($payload);
344344
}
345345

346-
public function testRoleClaimMissing()
346+
public function test_role_claim_missing()
347347
{
348348
$payload = $this->payload;
349349
unset($payload[LtiConstants::ROLES]);
@@ -353,7 +353,7 @@ public function testRoleClaimMissing()
353353
$this->launch($payload);
354354
}
355355

356-
public function testDeploymentIdClaimMissing()
356+
public function test_deployment_id_claim_missing()
357357
{
358358
$payload = $this->payload;
359359
unset($payload[LtiConstants::DEPLOYMENT_ID]);
@@ -363,7 +363,7 @@ public function testDeploymentIdClaimMissing()
363363
$this->launch($payload);
364364
}
365365

366-
public function testLti1p1MigrationSuccessfullyMakesDeployment()
366+
public function test_lti1p1_migration_successfully_makes_deployment()
367367
{
368368
$payload = $this->payload;
369369
$db = $this->migrateDb;
@@ -394,7 +394,7 @@ public function testLti1p1MigrationSuccessfullyMakesDeployment()
394394
$this->assertInstanceOf(LtiMessageLaunch::class, $launch);
395395
}
396396

397-
public function testDoesNotMigrate1p1IfMissingOauthKeySign()
397+
public function test_does_not_migrate1p1_if_missing_oauth_key_sign()
398398
{
399399
$payload = $this->payload;
400400
$db = $this->migrateDb;
@@ -417,7 +417,7 @@ public function testDoesNotMigrate1p1IfMissingOauthKeySign()
417417
$this->launch($payload, $db);
418418
}
419419

420-
public function testDoesNotMigrate1p1IfOauthKeySignDoesntMatch()
420+
public function test_does_not_migrate1p1_if_oauth_key_sign_doesnt_match()
421421
{
422422
$payload = $this->payload;
423423
$db = $this->migrateDb;
@@ -441,7 +441,7 @@ public function testDoesNotMigrate1p1IfOauthKeySignDoesntMatch()
441441
$ltiMessageLaunch = $this->launch($payload, $db);
442442
}
443443

444-
public function testLaunchWithMissingResourceLinkId()
444+
public function test_launch_with_missing_resource_link_id()
445445
{
446446
$payload = $this->payload;
447447
unset($payload['sub']);
@@ -451,7 +451,7 @@ public function testLaunchWithMissingResourceLinkId()
451451
$this->launch($payload);
452452
}
453453

454-
public function testInvalidCertificationCases()
454+
public function test_invalid_certification_cases()
455455
{
456456
$testCasesDir = static::CERT_DATA_DIR.'invalid';
457457

@@ -530,7 +530,7 @@ public function testInvalidCertificationCases()
530530
$this->assertEquals($casesCount, $testedCases);
531531
}
532532

533-
public function testValidCertificationCases()
533+
public function test_valid_certification_cases()
534534
{
535535
$testCasesDir = static::CERT_DATA_DIR.'valid';
536536

tests/DeepLinkResources/DateTimeIntervalTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@ class DateTimeIntervalTest extends TestCase
1313
private DateTime $initialEnd;
1414
private DateTimeInterval $dateTimeInterval;
1515

16-
public function setUp(): void
16+
protected function setUp(): void
1717
{
1818
$this->initialStart = date_create();
1919
$this->initialEnd = date_create();
2020
$this->dateTimeInterval = new DateTimeInterval($this->initialStart, $this->initialEnd);
2121
}
2222

23-
public function testItInstantiates()
23+
public function test_it_instantiates()
2424
{
2525
$this->assertInstanceOf(DateTimeInterval::class, $this->dateTimeInterval);
2626
}
2727

28-
public function testItCreatesANewInstance()
28+
public function test_it_creates_a_new_instance()
2929
{
3030
$DeepLinkResources = DateTimeInterval::new();
3131

3232
$this->assertInstanceOf(DateTimeInterval::class, $DeepLinkResources);
3333
}
3434

35-
public function testItGetsStart()
35+
public function test_it_gets_start()
3636
{
3737
$result = $this->dateTimeInterval->getStart();
3838

3939
$this->assertEquals($this->initialStart, $result);
4040
}
4141

42-
public function testItSetsStart()
42+
public function test_it_sets_start()
4343
{
4444
$expected = date_create('+1 day');
4545

@@ -49,14 +49,14 @@ public function testItSetsStart()
4949
$this->assertEquals($expected, $this->dateTimeInterval->getStart());
5050
}
5151

52-
public function testItGetsEnd()
52+
public function test_it_gets_end()
5353
{
5454
$result = $this->dateTimeInterval->getEnd();
5555

5656
$this->assertEquals($this->initialEnd, $result);
5757
}
5858

59-
public function testItSetsEnd()
59+
public function test_it_sets_end()
6060
{
6161
$expected = date_create('+1 day');
6262

@@ -66,7 +66,7 @@ public function testItSetsEnd()
6666
$this->assertEquals($expected, $this->dateTimeInterval->getEnd());
6767
}
6868

69-
public function testItThrowsExceptionWhenCreatingArrayWithBothPropertiesNull()
69+
public function test_it_throws_exception_when_creating_array_with_both_properties_null()
7070
{
7171
$this->dateTimeInterval->setStart(null);
7272
$this->dateTimeInterval->setEnd(null);
@@ -77,7 +77,7 @@ public function testItThrowsExceptionWhenCreatingArrayWithBothPropertiesNull()
7777
$this->dateTimeInterval->toArray();
7878
}
7979

80-
public function testItThrowsExceptionWhenCreatingArrayWithInvalidTimeInterval()
80+
public function test_it_throws_exception_when_creating_array_with_invalid_time_interval()
8181
{
8282
$this->dateTimeInterval->setStart(date_create());
8383
$this->dateTimeInterval->setEnd(date_create('-1 day'));
@@ -88,7 +88,7 @@ public function testItThrowsExceptionWhenCreatingArrayWithInvalidTimeInterval()
8888
$this->dateTimeInterval->toArray();
8989
}
9090

91-
public function testItCreatesArrayWithDefinedOptionalProperties()
91+
public function test_it_creates_array_with_defined_optional_properties()
9292
{
9393
$expectedStart = date_create('+1 day');
9494
$expectedEnd = date_create('+2 days');

tests/DeepLinkResources/IconTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ class IconTest extends TestCase
99
{
1010
private $imageUrl;
1111
private $icon;
12-
public function setUp(): void
12+
protected function setUp(): void
1313
{
1414
$this->imageUrl = 'https://example.com/image.png';
1515
$this->icon = new Icon($this->imageUrl, 1, 2);
1616
}
1717

18-
public function testItInstantiates()
18+
public function test_it_instantiates()
1919
{
2020
$this->assertInstanceOf(Icon::class, $this->icon);
2121
}
2222

23-
public function testItCreatesANewInstance()
23+
public function test_it_creates_a_new_instance()
2424
{
2525
$DeepLinkResources = Icon::new($this->imageUrl, 100, 200);
2626

2727
$this->assertInstanceOf(Icon::class, $DeepLinkResources);
2828
}
2929

30-
public function testItGetsUrl()
30+
public function test_it_gets_url()
3131
{
3232
$result = $this->icon->getUrl();
3333

3434
$this->assertEquals($this->imageUrl, $result);
3535
}
3636

37-
public function testItSetsUrl()
37+
public function test_it_sets_url()
3838
{
3939
$expected = 'expected';
4040

@@ -43,14 +43,14 @@ public function testItSetsUrl()
4343
$this->assertEquals($expected, $this->icon->getUrl());
4444
}
4545

46-
public function testItGetsWidth()
46+
public function test_it_gets_width()
4747
{
4848
$result = $this->icon->getWidth();
4949

5050
$this->assertEquals(1, $result);
5151
}
5252

53-
public function testItSetsWidth()
53+
public function test_it_sets_width()
5454
{
5555
$expected = 300;
5656

@@ -59,14 +59,14 @@ public function testItSetsWidth()
5959
$this->assertEquals($expected, $this->icon->getWidth());
6060
}
6161

62-
public function testItGetsHeight()
62+
public function test_it_gets_height()
6363
{
6464
$result = $this->icon->getHeight();
6565

6666
$this->assertEquals(2, $result);
6767
}
6868

69-
public function testItSetsHeight()
69+
public function test_it_sets_height()
7070
{
7171
$expected = 400;
7272

@@ -75,7 +75,7 @@ public function testItSetsHeight()
7575
$this->assertEquals($expected, $this->icon->getHeight());
7676
}
7777

78-
public function testItCreatesArray()
78+
public function test_it_creates_array()
7979
{
8080
$expected = [
8181
'url' => $this->imageUrl,

tests/DeepLinkResources/IframeTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class IframeTest extends TestCase
1212
public const INITIAL_HEIGHT = 2;
1313
private Iframe $iframe;
1414

15-
public function setUp(): void
15+
protected function setUp(): void
1616
{
1717
$this->iframe = new Iframe(
1818
self::INITIAL_SRC,
@@ -21,26 +21,26 @@ public function setUp(): void
2121
);
2222
}
2323

24-
public function testItInstantiates()
24+
public function test_it_instantiates()
2525
{
2626
$this->assertInstanceOf(Iframe::class, $this->iframe);
2727
}
2828

29-
public function testItCreatesANewInstance()
29+
public function test_it_creates_a_new_instance()
3030
{
3131
$DeepLinkResources = Iframe::new();
3232

3333
$this->assertInstanceOf(Iframe::class, $DeepLinkResources);
3434
}
3535

36-
public function testItGetsWidth()
36+
public function test_it_gets_width()
3737
{
3838
$result = $this->iframe->getWidth();
3939

4040
$this->assertEquals(self::INITIAL_WIDTH, $result);
4141
}
4242

43-
public function testItSetsWidth()
43+
public function test_it_sets_width()
4444
{
4545
$expected = 300;
4646

@@ -50,14 +50,14 @@ public function testItSetsWidth()
5050
$this->assertEquals($expected, $this->iframe->getWidth());
5151
}
5252

53-
public function testItGetsHeight()
53+
public function test_it_gets_height()
5454
{
5555
$result = $this->iframe->getHeight();
5656

5757
$this->assertEquals(self::INITIAL_HEIGHT, $result);
5858
}
5959

60-
public function testItSetsHeight()
60+
public function test_it_sets_height()
6161
{
6262
$expected = 400;
6363

@@ -67,14 +67,14 @@ public function testItSetsHeight()
6767
$this->assertEquals($expected, $this->iframe->getHeight());
6868
}
6969

70-
public function testItGetsSrc()
70+
public function test_it_gets_src()
7171
{
7272
$result = $this->iframe->getSrc();
7373

7474
$this->assertEquals(self::INITIAL_SRC, $result);
7575
}
7676

77-
public function testItSetsSrc()
77+
public function test_it_sets_src()
7878
{
7979
$expected = 'https://example.com/foo/bar';
8080

@@ -84,7 +84,7 @@ public function testItSetsSrc()
8484
$this->assertEquals($expected, $this->iframe->getSrc());
8585
}
8686

87-
public function testItCreatesArrayWithoutOptionalProperties()
87+
public function test_it_creates_array_without_optional_properties()
8888
{
8989
$this->iframe->setWidth(null);
9090
$this->iframe->setHeight(null);
@@ -95,7 +95,7 @@ public function testItCreatesArrayWithoutOptionalProperties()
9595
$this->assertEquals([], $result);
9696
}
9797

98-
public function testItCreatesArrayWithDefinedOptionalProperties()
98+
public function test_it_creates_array_with_defined_optional_properties()
9999
{
100100
$expected = [
101101
'width' => 100,

0 commit comments

Comments
 (0)