Skip to content

Commit 265ef7b

Browse files
authored
Feature/logout (#149)
* Add end_session_endpoint to discovery * Add post_logout_redirect_uri column migration * Enable post-logout redirect URI registration * Validate LogoutRequest * Add sid to ID token * Add RP associations * logout handler * Update conformance.sql * Implement BCL requests * curl version * Simplify BCL handler * Indicate BCL support in discovery * cleanup * Change custom scope 'attributes' key to 'claims' * Cleanup and add incomplete tests * tests * wip: logout conformance tests * logout conformance: add browser matcher * conformance: add rp initiated logout tests * conformance: add logout url * Use logger service * Add logout page template * Add BCL URI to client * Register logout URI * Add useridattr to sub claim attribute list by default * Show different message if logout was not performed * Add new clients for RP-Initiated and Back-Channel logout tests * Prevent logoutHnalder for Prompt and MaxAge rules * Run logout handler only if logout is OIDC initiated * Check for sub claim as user ID when creating RP associaton * Clean it up * Enable logout conformance tests in github actions Co-authored-by: Marko Ivančić <[email protected]>
1 parent a4088e9 commit 265ef7b

File tree

129 files changed

+6848
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+6848
-896
lines changed

.github/workflows/test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ jobs:
263263
- name: Run Implicit conformance tests
264264
run: |
265265
./conformance-suite/scripts/run-test-plan.py --expected-failures-file ./main/conformance-tests/implicit-warnings.json --expected-skips-file ./main/conformance-tests/implicit-skips.json "oidcc-implicit-certification-test-plan[server_metadata=discovery][client_registration=static_client]" ./main/conformance-tests/conformance-implicit-ci.json
266+
- name: Run RP logout
267+
run: |
268+
./conformance-suite/scripts/run-test-plan.py "oidcc-rp-initiated-logout-certification-test-plan[response_type=code][client_registration=static_client]" ./main/conformance-tests/conformance-rp-initiated-logout-ci.json
269+
- name: Run RP backchannel
270+
run: |
271+
./conformance-suite/scripts/run-test-plan.py "oidcc-backchannel-rp-initiated-logout-certification-test-plan[response_type=code][client_registration=static_client]" ./main/conformance-tests/conformance-back-channel-logout-ci.json
266272
- name: Stop SSP
267273
working-directory: ./main
268274
run: |

CONFORMANCE_TEST.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ To run basic profile test, launch this command in console inside `simplesamlphp-
5454
```shell
5555
# Run run-test-plan.py script inside conformance-suite/scripts
5656
# Change the relative path to your conformance-suite installation
57+
# conformance-basic-ci.json contains clients, and browser interactions for automating various tests
58+
# Lines like "oidcc-implicit-certification-test-plan[server_metadata=discovery][client_registration=static_client]"
59+
# indicate the conformance plan to run, and any variants (parameters) are passed in []
5760

5861
OIDC_MODULE_FOLDER=. # path to your checkout of the OIDC module
5962
# Basic profile
@@ -69,6 +72,15 @@ conformance-suite/scripts/run-test-plan.py \
6972
--expected-skips-file ${OIDC_MODULE_FOLDER}/conformance-tests/implicit-skips.json \
7073
"oidcc-implicit-certification-test-plan[server_metadata=discovery][client_registration=static_client]" \
7174
${OIDC_MODULE_FOLDER}/conformance-tests/conformance-implicit-ci.json
75+
76+
# RP Initiated back channel
77+
conformance-suite/scripts/run-test-plan.py \
78+
"oidcc-backchannel-rp-initiated-logout-certification-test-plan[response_type=code][client_registration=static_client]" \
79+
${OIDC_MODULE_FOLDER}/conformance-tests/conformance-back-channel-logout-ci.json
80+
81+
conformance-suite/scripts/run-test-plan.py \
82+
"oidcc-rp-initiated-logout-certification-test-plan[response_type=code][client_registration=static_client]" \
83+
${OIDC_MODULE_FOLDER}/conformance-tests/conformance-rp-initiated-logout-ci.json
7284
```
7385

7486

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@
1818
],
1919
"require": {
2020
"php": ">=7.4",
21+
"ext-curl": ">=7.4",
2122
"ext-json": "*",
2223
"ext-openssl": "*",
2324
"ext-pdo": "*",
25+
"guzzlehttp/guzzle": "^7.0",
2426
"laminas/laminas-diactoros": "^2.2.1",
2527
"laminas/laminas-httphandlerrunner": "^1.1.0",
2628
"lcobucci/jwt": "^4.1",
2729
"league/oauth2-server": "^8.1.0",
2830
"nette/forms": "^2.4",
2931
"psr/container": "^1.0",
32+
"psr/log": "^1.1",
3033
"simplesamlphp/composer-module-installer": "^1.0",
34+
"spomky-labs/base64url": "^2.0",
3135
"steverhoades/oauth2-openid-connect-server": "^2.0",
32-
"web-token/jwt-framework": "^2.1",
33-
"spomky-labs/base64url": "^2.0"
36+
"web-token/jwt-framework": "^2.1"
3437
},
3538
"require-dev": {
3639
"friendsofphp/php-cs-fixer": "^2.10",
3740
"friends-of-phpspec/phpspec-code-coverage": "^6.1",
38-
"php-coveralls/php-coveralls": "^2.0",
3941
"phpspec/phpspec": "^7.1.0",
4042
"phpunit/php-code-coverage": "^9.0.0",
4143
"phpunit/phpcov": "^8.2.0",

config-templates/module_oidc.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
// is not specified on particular client
4242
'auth' => 'default-sp',
4343

44-
// useridattr is the attribute-name that contains the userid as returned from idp
44+
// useridattr is the attribute-name that contains the userid as returned from idp. By default, this attribute
45+
// will be dynamically added to the 'sub' claim in the attribute-to-claim translation table (you will probably
46+
// want to use this attribute as the 'sub' claim since it designates unique identifier for the user).
4547
'useridattr' => 'uid',
4648

4749
/**
@@ -84,16 +86,13 @@
8486
// Add authproc filters here
8587
],
8688

87-
// You can create as many scopes as you want and assign claims to them
89+
// Optional custom scopes. You can create as many scopes as you want and assign claims to them.
8890
'scopes' => [
89-
/*
90-
* Optional. You can add more scopes.
91-
*/
92-
// 'private' => [
91+
// 'private' => [ // The key represents the scope name.
9392
// 'description' => 'private scope',
9493
// 'claim_name_prefix' => '', // Prefix to apply for all claim names from this scope
9594
// 'are_multiple_claim_values_allowed' => false, // Are claims for this scope allowed to have multiple values
96-
// 'attributes' => ['national_document_id'] // TODO refactor key 'attributes' to 'claims'
95+
// 'claims' => ['national_document_id'] // Claims from the translation table which this scope will contain
9796
// ],
9897
],
9998
'translate' => [
@@ -117,8 +116,13 @@
117116
* For convenience the default type is "string" so type does not need to be defined.
118117
* If "attributes" is not set, then it is assumed that the rest of the values are saml
119118
* attribute names.
119+
*
120+
* Note on 'sub' claim: by default, the list of attributes for 'sub' claim will also contain attribute defined
121+
* in 'useridattr' setting. You will probably want to use this attribute as the 'sub' claim since it
122+
* designates unique identifier for the user, However, override as necessary.
120123
*/
121124
// 'sub' => [
125+
// 'attribute-defined-in-useridattr', // will be dynamically added if the list for 'sub' claim is not set.
122126
// 'eduPersonPrincipalName',
123127
// 'eduPersonTargetedID',
124128
// 'eduPersonUniqueId',

0 commit comments

Comments
 (0)