Skip to content

Commit 954d4af

Browse files
committed
Merge branch 'wip-version-7' into wip-vci
2 parents cfc93cc + 0550086 commit 954d4af

File tree

7 files changed

+170
-42
lines changed

7 files changed

+170
-42
lines changed

.github/workflows/test.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ jobs:
208208

209209
conformance-suite:
210210
runs-on: ubuntu-latest
211+
strategy:
212+
fail-fast: false
213+
matrix:
214+
ssp-version: ["v2.3.7", "v2.4.2"]
211215
env:
212216
SUITE_BASE_URL: https://localhost.emobix.co.uk:8443
213217
VERSION: release-v5.1.35
@@ -240,7 +244,7 @@ jobs:
240244
working-directory: ./main
241245
# Must run after conformance suite since they share a docker network.
242246
run: |
243-
OIDC_VERSION=@dev docker compose -f docker/docker-compose.yml --project-directory . up -d --build
247+
SSP_VERSION=${{ matrix.ssp-version }} OIDC_VERSION=@dev docker compose -f docker/docker-compose.yml --project-directory . up -d --build
244248
sleep 30
245249
# while ! curl -skfail https://op.local.stack-dev.cirrusidentity.com/.well-known/openid-configuration >/dev/null; do sleep 2; done
246250
- name: Run Basic conformance tests

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ during module development. SimpleSAMLphp has followed semantic versioning for it
3939
for example, that v5.* of the OIDC module should work with any v2.* of SimpleSAMLphp. However, please note that
4040
PHP version requirements have changed in minor SimpleSAMLphp releases.
4141

42-
| OIDC module | Tested SimpleSAMLphp | PHP | Note |
43-
|:------------|:---------------------|:------:|-----------------------------|
44-
| v6.\* | v2.3.\* | \>=8.2 | Recommended |
45-
| v5.\* | v2.1.\* | \>=8.1 | |
46-
| v4.\* | v2.0.\* | \>=8.0 | |
47-
| v3.\* | v2.0.\* | \>=7.4 | Abandoned from August 2023. |
48-
| v2.\* | v1.19.\* | \>=7.4 | |
42+
| OIDC module | Tested SimpleSAMLphp | PHP | Note |
43+
|:------------|:---------------------|:------:|-------------|
44+
| v6.\* | v2.3.\*, v2.4.\* | \>=8.2 | Recommended |
45+
| v5.\* | v2.1.\* | \>=8.1 | |
46+
| v4.\* | v2.0.\* | \>=8.0 | |
47+
| v3.\* | v2.0.\* | \>=7.4 | |
48+
| v2.\* | v1.19.\* | \>=7.4 | |
4949

5050
### Upgrading?
5151

UPGRADE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# TODO mivanci
22
* Move to specific simplesamlphp/openid release (composer.json).
33

4+
# Version 6 to 7
5+
6+
## New features
7+
8+
## New configuration options
9+
10+
## Major impact changes
11+
- In v6 of the module, when defining custom scopes, there was a possibility to use standard claims with the
12+
'are_multiple_claim_values_allowed' option. This would allow multiple values (array of values) for standard
13+
claims which have a single value by specification. All
14+
[standard claims](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims)
15+
are now hardcoded to have single value, even when 'are_multiple_claim_values_allowed' option is enabled.
16+
17+
## Medium impact changes
18+
19+
## Low impact changes
20+
21+
422
# Version 5 to 6
523

624
## New features

docker/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
FROM cirrusid/simplesamlphp:v2.3.7
2-
#FROM cicnavi/simplesamlphp:dev
1+
ARG SSP_VERSION="v2.4.2"
2+
FROM cirrusid/simplesamlphp:${SSP_VERSION}
3+
#FROM cicnavi/simplesamlphp:${SSP_VERSION}
34

45
RUN apt-get update && apt-get install -y sqlite3
56
# Prepopulate the DB with items needed for testing

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
context: .
1717
dockerfile: docker/Dockerfile
1818
args:
19+
SSP_VERSION: "${SSP_VERSION}"
1920
OIDC_VERSION: "${OIDC_VERSION}"
2021
environment:
2122
- STAGINGCOMPOSERREPOS=oidc

src/Utils/ClaimTranslatorExtractor.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,25 @@ class ClaimTranslatorExtractor
130130
*/
131131
final public const MANDATORY_SINGLE_VALUE_CLAIMS = [
132132
'sub',
133-
// TODO mivanci v7 Uncomment the rest of the claims, as this was a potential breaking change in v6.
134-
// 'name',
135-
// 'given_name',
136-
// 'family_name',
137-
// 'middle_name',
138-
// 'nickname',
139-
// 'preferred_username',
140-
// 'profile',
141-
// 'picture',
142-
// 'website',
143-
// 'email',
144-
// 'email_verified',
145-
// 'gender',
146-
// 'birthdate',
147-
// 'zoneinfo',
148-
// 'locale',
149-
// 'phone_number',
150-
// 'phone_number_verified',
151-
// 'address',
152-
// 'updated_at',
133+
'name',
134+
'given_name',
135+
'family_name',
136+
'middle_name',
137+
'nickname',
138+
'preferred_username',
139+
'profile',
140+
'picture',
141+
'website',
142+
'email',
143+
'email_verified',
144+
'gender',
145+
'birthdate',
146+
'zoneinfo',
147+
'locale',
148+
'phone_number',
149+
'phone_number_verified',
150+
'address',
151+
'updated_at',
153152
];
154153

155154
/**

tests/unit/src/Utils/ClaimTranslatorExtractorTest.php

Lines changed: 117 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,33 +357,138 @@ public function testWillReleaseSingleValueClaimsIfMultiValueNotAllowed(): void
357357

358358
public function testWillReleaseSingleValueClaimsForMandatorySingleValueClaims(): void
359359
{
360-
361-
// TODO mivanci v7 Test for mandatory single value claims in other scopes, as per
362-
// \SimpleSAML\Module\oidc\Utils\ClaimTranslatorExtractor::MANDATORY_SINGLE_VALUE_CLAIMS
363360
$claimSet = new ClaimSetEntity(
364-
'customScopeWithSubClaim',
365-
['sub'],
361+
'customScope',
362+
[
363+
'sub',
364+
'name',
365+
'given_name',
366+
'family_name',
367+
'middle_name',
368+
'nickname',
369+
'preferred_username',
370+
'profile',
371+
'picture',
372+
'website',
373+
'email',
374+
'email_verified',
375+
'gender',
376+
'birthdate',
377+
'zoneinfo',
378+
'locale',
379+
'phone_number',
380+
'phone_number_verified',
381+
'address',
382+
'updated_at',
383+
],
366384
);
367385

368386
$translate = [
369-
'sub' => [
370-
'subAttribute',
387+
'sub' => ['subAttribute'],
388+
'name' => ['nameAttribute'],
389+
'given_name' => ['givenNameAttribute'],
390+
'family_name' => ['familyNameAttribute'],
391+
'middle_name' => ['middleNameAttribute'],
392+
'nickname' => ['nicknameAttribute'],
393+
'preferred_username' => ['preferredUsernameAttribute'],
394+
'profile' => ['profileAttribute'],
395+
'picture' => ['pictureAttribute'],
396+
'website' => ['websiteAttribute'],
397+
'email' => ['emailAttribute'],
398+
'email_verified' => ['emailVerifiedAttribute'],
399+
'gender' => ['genderAttribute'],
400+
'birthdate' => ['birthdateAttribute'],
401+
'zoneinfo' => ['zoneinfoAttribute'],
402+
'locale' => ['localeAttribute'],
403+
'phone_number' => ['phoneNumberAttribute'],
404+
'phone_number_verified' => ['phoneNumberVerifiedAttribute'],
405+
'address' => [
406+
'type' => 'json',
407+
'claims' => [
408+
'formatted' => ['addressAttribute'],
409+
],
371410
],
411+
'updated_at' => ['updatedAtAttribute'],
372412
];
373413

374414
$userAttributes = [
375-
'subAttribute' => ['1', '2', '3'],
415+
'subAttribute' => ['id1', 'id2', 'id3'],
416+
'nameAttribute' => ['name1', 'name2', 'name3'],
417+
'givenNameAttribute' => ['givenName1', 'givenName2', 'givenName3'],
418+
'familyNameAttribute' => ['familyName1', 'familyName2', 'familyName3'],
419+
'middleNameAttribute' => ['middleName1', 'middleName2', 'middleName3'],
420+
'nicknameAttribute' => ['nickname1', 'nickname2', 'nickname3'],
421+
'preferredUsernameAttribute' => ['preferredUsername1', 'preferredUsername2', 'preferredUsername3'],
422+
'profileAttribute' => ['profileUrl1', 'profileUrl2', 'profileUrl3'],
423+
'pictureAttribute' => ['pictureUrl1', 'pictureUrl2', 'pictureUrl3'],
424+
'websiteAttribute' => ['websiteUrl1', 'websiteUrl2', 'websiteUrl3'],
425+
'emailAttribute' => ['email1', 'email2', 'email3'],
426+
'emailVerifiedAttribute' => [true, false],
427+
'genderAttribute' => ['gender1', 'gender2', 'gender3'],
428+
'birthdateAttribute' => ['birthdate1', 'birthdate2', 'birthdate3'],
429+
'zoneinfoAttribute' => ['zoneinfo1', 'zoneinfo2', 'zoneinfo3'],
430+
'localeAttribute' => ['locale1', 'locale2', 'locale3'],
431+
'phoneNumberAttribute' => ['phoneNumber1', 'phoneNumber2', 'phoneNumber3'],
432+
'phoneNumberVerifiedAttribute' => [true, false],
433+
'addressAttribute' => ['address1', 'address2', 'address3'],
434+
'updatedAtAttribute' => [123, 456],
376435
];
377436

378-
$claimTranslator = $this->mock([$claimSet], $translate, ['sub']);
437+
$claimTranslator = $this->mock(
438+
[$claimSet],
439+
$translate,
440+
[
441+
'sub',
442+
'name',
443+
'given_name',
444+
'family_name',
445+
'middle_name',
446+
'nickname',
447+
'preferred_username',
448+
'profile',
449+
'picture',
450+
'website',
451+
'email',
452+
'email_verified',
453+
'gender',
454+
'birthdate',
455+
'zoneinfo',
456+
'locale',
457+
'phone_number',
458+
'phone_number_verified',
459+
'address',
460+
'updated_at',
461+
],
462+
);
379463

380464
$releasedClaims = $claimTranslator->extract(
381-
['openid'],
465+
['customScope'],
382466
$userAttributes,
383467
);
384468

385-
$expectedClaims = ['sub' => '1'];
469+
$expectedClaims = [
470+
'sub' => 'id1',
471+
'name' => 'name1',
472+
'given_name' => 'givenName1',
473+
'family_name' => 'familyName1',
474+
'middle_name' => 'middleName1',
475+
'nickname' => 'nickname1',
476+
'preferred_username' => 'preferredUsername1',
477+
'profile' => 'profileUrl1',
478+
'picture' => 'pictureUrl1',
479+
'website' => 'websiteUrl1',
480+
'email' => 'email1',
481+
'email_verified' => true,
482+
'gender' => 'gender1',
483+
'birthdate' => 'birthdate1',
484+
'zoneinfo' => 'zoneinfo1',
485+
'locale' => 'locale1',
486+
'phone_number' => 'phoneNumber1',
487+
'phone_number_verified' => true,
488+
'address' => ['formatted' => 'address1'],
489+
'updated_at' => 123,
490+
];
386491

387-
$this->assertSame($expectedClaims, $releasedClaims);
492+
$this->assertEquals($expectedClaims, $releasedClaims);
388493
}
389494
}

0 commit comments

Comments
 (0)