Skip to content

Commit 9b3cd12

Browse files
authored
Start with version 5 (#211)
* Move to PHP v8.1 * Move to psalm level 1 * Remove dependency on steverhoades/oauth2-openid-connect-server * Move ClaimTranslatorExtractor to Utils * Move ConfigurationService to src * Rename ConfigurationService to ModuleConfig * Move to module config constants * Normalize codebase * First Symfony route (OP configuration) * Update tests * Set SSP requirement to 2.1 * Update upgrade log --------- Co-authored-by: Marko Ivančić <[email protected]>
1 parent 895abfd commit 9b3cd12

File tree

265 files changed

+4971
-4066
lines changed

Some content is hidden

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

265 files changed

+4971
-4066
lines changed

.github/workflows/test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-versions: ["8.0", "8.1", "8.2"]
16+
php-versions: ["8.1", "8.2"]
1717

1818
steps:
1919
- name: Setup PHP, with composer and extensions
@@ -55,7 +55,7 @@ jobs:
5555
run: composer install --no-progress --prefer-dist --optimize-autoloader
5656

5757
- name: Decide whether to run code coverage or not
58-
if: ${{ matrix.php-versions != '8.0' }}
58+
if: ${{ matrix.php-versions != '8.1' }}
5959
run: |
6060
echo "NO_COVERAGE=--no-coverage" >> $GITHUB_ENV
6161
@@ -65,7 +65,7 @@ jobs:
6565
./vendor/bin/phpunit $NO_COVERAGE
6666
6767
- name: Save coverage data
68-
if: ${{ matrix.php-versions == '8.0' }}
68+
if: ${{ matrix.php-versions == '8.1' }}
6969
uses: actions/upload-artifact@v1
7070
with:
7171
name: build-data
@@ -78,7 +78,7 @@ jobs:
7878
- name: Setup PHP, with composer and extensions
7979
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
8080
with:
81-
php-version: "8.0"
81+
php-version: "8.1"
8282
extensions: mbstring, xml
8383
tools: composer:v2
8484
coverage: none
@@ -119,7 +119,7 @@ jobs:
119119
- name: Setup PHP, with composer and extensions
120120
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
121121
with:
122-
php-version: "8.0"
122+
php-version: "8.1"
123123
extensions: mbstring, xml
124124
tools: composer:v2
125125
coverage: none
@@ -152,7 +152,7 @@ jobs:
152152
- name: Setup PHP, with composer and extensions
153153
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
154154
with:
155-
php-version: "8.0"
155+
php-version: "8.1"
156156
tools: composer:v2
157157
extensions: mbstring, xml
158158

CHANGELOG.md

Lines changed: 0 additions & 88 deletions
This file was deleted.

CONFORMANCE_TEST.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ MAVEN_CACHE=./m2 docker-compose -f builder-compose.yml run builder
2020
docker-compose up
2121
```
2222

23-
This will startup the Java conformance app and a MongoDB server. You'll need to configure a test.
23+
This will start up the Java conformance app and a MongoDB server. You'll need to configure a test.
2424

2525
Visit https://localhost:8443/ and "Create a new plan".
2626
The Test Plan should be "OpenID Connect Core: Basic Certification Profile Authorization server test"
@@ -33,20 +33,21 @@ You'll need to get your OIDC SSP image running next
3333

3434
## Run SSP
3535

36-
You'll need to run SSP with OIDC on the same docker network as the compliance tests so they are able to communicate.
36+
You'll need to run SSP with OIDC on the same docker network as the compliance tests, so they are able to communicate.
3737

3838
See "Docker Compose" section of the main README.
3939

4040
## Run Conformance Tests
4141

42-
The conformance tests are interactive to make you authenticate. Some of the tests require you to clear cookies to confirm
43-
certain test scenarios, while others require you to have session cookies to test the RP signaling to the OP that the user
44-
should reauthenticate. The tests may also redirect you to https://localhost.emobix.co.uk:8443/ which will resolve to
45-
the conformance Java container. You'll need to accept any SSL connection warnings.
42+
The conformance tests are interactive to make you authenticate. Some of the tests require you to clear cookies to
43+
confirm certain test scenarios, while others require you to have session cookies to test the RP signaling to the
44+
OP that the user should reauthenticate. The tests may also redirect you to https://localhost.emobix.co.uk:8443/
45+
which will resolve to the conformance Java container. You'll need to accept any SSL connection warnings.
4646

4747
## Run automated tests
4848

49-
Eventually these test can have [the browser portion automated](https://gitlab.com/openid/conformance-suite/-/wikis/Design/BrowserControl)
49+
Eventually these test can have
50+
[the browser portion automated](https://gitlab.com/openid/conformance-suite/-/wikis/Design/BrowserControl)
5051
though the Conformance tests authors recommend getting them all to pass first.
5152

5253
To run basic profile test, launch this command in console inside `simplesamlphp-module-oidc` directory:
@@ -96,13 +97,13 @@ In this situation your OIDC OP must be accessible to the public internet.
9697
## Deploy SSP OIDC Image
9798

9899
The docker image created in the README.md is designed to be used for running the conformance tests.
99-
It contains an sqlite database pre-populated with data that can be used for these tests.
100+
It contains a sqlite database pre-populated with data that can be used for these tests.
100101
Build and run the image somewhere.
101102

102103
## Register and Create Conformance Tests
103104

104105
Visit https://openid.net/certification/instructions/
105-
You can use the `json` deployment configurations under `conformance-tests` to configure your cloud instances. Update your
106-
`discoveryUrl` to reflect the location you deployed SSP. You may also need to adjust `alias` since that is used in all
107-
client redirect URIs and may conflict with existing test suites.
106+
You can use the `json` deployment configurations under `conformance-tests` to configure your cloud instances. Update
107+
your `discoveryUrl` to reflect the location you deployed SSP. You may also need to adjust `alias` since that is used
108+
in all client redirect URIs and may conflict with existing test suites.
108109

FAQ.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Set JSON type for claims
22

33
You can set the type of claim by prefixing the name with `int:`, `bool:` or `string:`. If no prefix is set then `string`
4-
is assumed. In the rare event that your custom claim name starts with a prefix (example: `int:mycustomclaim`) you can add an one of
5-
the type prefixes (example: `string:int:mycustomclaim`) to force the module to release a claim with the original prefix in it
6-
(example: claim `int:mycustomclaim` of type `string`)
4+
is assumed. In the rare event that your custom claim name starts with a prefix (example: `int:mycustomclaim`) you can
5+
add one of the type prefixes (example: `string:int:mycustomclaim`) to force the module to release a claim with the
6+
original prefix in it (example: claim `int:mycustomclaim` of type `string`)
77

88
# Release photo
99

10-
The OIDC `picture` claim is a url, while the `jpegPhoto` ldap attribute is often a b64 string. To use `jpegPhoto` you can
11-
try using an authproc filter to turn it into a data url by adding `data:image/jpeg;base64,` prefix. The support for data urls
12-
amongst OIDC client is unknown.
10+
The OIDC `picture` claim is an URL, while the `jpegPhoto` LDAP attribute is often a b64 string. To use `jpegPhoto` you
11+
can try using an authproc filter to turn it into a data url by adding `data:image/jpeg;base64,` prefix. The support
12+
for data URLs amongst OIDC client is unknown.

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ Currently supported flows are:
2121

2222
| OIDC module | SimpleSAMLphp | PHP | Note |
2323
|:------------|:--------------|:------:|-----------------------------|
24-
| v4.\* | v2.0.\* | \>=8.0 | Recommended |
25-
| v3.\* | v2.0.0 | \>=7.4 | Abandoned from August 2023. |
24+
| v5.\* | v2.1.\* | \>=8.1 | Recommended |
25+
| v4.\* | v2.0.\* | \>=8.0 | |
26+
| v3.\* | v2.0.\* | \>=7.4 | Abandoned from August 2023. |
2627
| v2.\* | v1.19.\* | \>=7.4 | |
2728

29+
### Upgrading?
30+
31+
If you are upgrading from a previous version, checkout the [upgrade guide](UPGRADE.md).
32+
2833
## Installation
2934

3035
Installation can be as easy as executing:
@@ -95,10 +100,6 @@ If you use a passphrase, make sure to also configure it in the `module_oidc.php`
95100
In order to purge expired tokens, this module requires [cron module](https://simplesamlphp.org/docs/stable/cron:cron)
96101
to be enabled and configured.
97102

98-
## Upgrading?
99-
100-
If you are upgrading from a previous version, checkout the [upgrade guide](UPGRADE.md).
101-
102103
## Additional considerations
103104
### Private scopes
104105

@@ -109,7 +110,7 @@ However, you can add your own private scopes in the `module_oidc.php` config fil
109110
<?php
110111

111112
$config = [
112-
'scopes' => [
113+
\SimpleSAML\Module\oidc\ModuleConfig::OPTION_AUTH_CUSTOM_SCOPES => [
113114
'private' => [
114115
'description' => 'private scope',
115116
'claim_name_prefix' => '', // Optional prefix for claim names
@@ -131,7 +132,7 @@ You can change or extend this table in the `module_oidc.php` config file, for ex
131132
<?php
132133

133134
$config = [
134-
'translate' => [
135+
\SimpleSAML\Module\oidc\ModuleConfig::OPTION_AUTH_SAML_TO_OIDC_TRANSLATE_TABLE => [
135136
// Overwrite default translation
136137
'sub' => [
137138
'uid', // added
@@ -185,7 +186,7 @@ documentation](https://simplesamlphp.org/docs/stable/simplesamlphp-authproc).
185186
<?php
186187

187188
$config = [
188-
'authproc.oidc' => [
189+
\SimpleSAML\Module\oidc\ModuleConfig::OPTION_AUTH_PROCESSING_FILTERS => [
189190
50 => [
190191
'class' => 'core:AttributeAdd',
191192
'groups' => ['users', 'members'],
@@ -206,8 +207,8 @@ eduPersonEntitlements from the `client` permission array.
206207

207208
A permission can be disabled by commenting it out.
208209

209-
```bash
210-
'permissions' => [
210+
```php
211+
\SimpleSAML\Module\oidc\ModuleConfig::OPTION_ADMIN_UI_PERMISSIONS => [
211212
// Attribute to inspect to determine user's permissions
212213
'attribute' => 'eduPersonEntitlement',
213214
// Which entitlements allow for registering, editing, delete a client. OIDC clients are owned by the creator
@@ -242,9 +243,9 @@ form. Here are some sample configurations:
242243

243244
### With current git branch.
244245

245-
To explore the module using docker run the below command. This will run an SSP image, with the current oidc module mounted
246-
in the container, along with some configuration files. Any code changes you make to your git checkout are "live" in
247-
the container, allowing you to test and iterate different things.
246+
To explore the module using docker run the below command. This will run an SSP image, with the current oidc module
247+
mounted in the container, along with some configuration files. Any code changes you make to your git checkout are
248+
"live" in the container, allowing you to test and iterate different things.
248249

249250
```
250251
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

UPGRADE.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
1+
# Version 4 to 5
2+
3+
## Major impact changes
4+
- PHP version requirement was bumped to v8.1
5+
6+
## Medium impact changes
7+
- Module config options in file 'module_oidc.php' are now using constants for config keys. The values for constants are
8+
taken from the previous version of the module, so theoretically you don't have to rewrite your current config file,
9+
although it is recommended to do so.
10+
11+
## Low impact changes
12+
- Removed the 'kid' config option which was not utilized in the codebase (from v2 of the module, the 'kid' value is the
13+
fingerprint of the certificate).
14+
15+
Below are some internal changes that should not have impact for the OIDC OP implementors. However, if you are using
16+
this module as a library or extending from it, you will probably encounter breaking changes, since a lot of code
17+
has been refactored:
18+
19+
- psalm error level set to 1, which needed a fair amount of code adjustments
20+
- refactored to strict typing whenever possible (psalm can now infer types for >99% of the codebase)
21+
- refactored to PHP v8.* (up to PHP v8.1) code styling whenever possible, like using constructor property promotion,
22+
match expressions...
23+
- removed dependency on steverhoades/oauth2-openid-connect-server (low maintenance)
24+
125
# Version 3 to 4
226
- PHP version requirement was bumped to v8.0 to enable updating important dependant packages like 'league/oauth2-server'
327
which has already moved to PHPv8 between their minor releases.
4-
- SimpleSAMLphp version fixed to v2.0.*
28+
- SimpleSAMLphp version requirement fixed to v2.0.*
529

630
# Version 2 to 3
731
- Module code was refactored to make it compatible with SimpleSAMLphp v2

composer.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.0",
20+
"php": "^8.1",
2121
"ext-curl": "*",
2222
"ext-json": "*",
2323
"ext-openssl": "*",
@@ -28,22 +28,21 @@
2828
"lcobucci/jwt": "^4.1",
2929
"league/oauth2-server": "^8.5.3",
3030
"nette/forms": "^3",
31-
"psr/container": "^1.0",
32-
"psr/log": "^1.1",
33-
"simplesamlphp/composer-module-installer": "^1.2",
31+
"psr/container": "^2.0",
32+
"psr/log": "^3",
33+
"simplesamlphp/composer-module-installer": "^1.3",
3434
"spomky-labs/base64url": "^2.0",
35-
"steverhoades/oauth2-openid-connect-server": "^2.0",
36-
"web-token/jwt-framework": "^2.1"
35+
"symfony/expression-language": "^6.3",
36+
"web-token/jwt-framework": "^3"
3737
},
3838
"require-dev": {
3939
"friendsofphp/php-cs-fixer": "^3",
40-
"phpunit/php-code-coverage": "^9.0.0",
41-
"phpunit/phpcov": "^8.2.0",
42-
"phpunit/phpunit": "^9.0.0",
43-
"simplesamlphp/simplesamlphp": "2.0.*",
44-
"simplesamlphp/simplesamlphp-test-framework": "^1.2.1",
45-
"squizlabs/php_codesniffer": "^3.7",
46-
"vimeo/psalm": "^5.8"
40+
"phpunit/phpunit": "^10",
41+
"rector/rector": "^0.18.3",
42+
"simplesamlphp/simplesamlphp": "2.1.*",
43+
"simplesamlphp/simplesamlphp-test-framework": "^1.5",
44+
"squizlabs/php_codesniffer": "^3",
45+
"vimeo/psalm": "^5"
4746
},
4847
"config": {
4948
"preferred-install": {
@@ -52,7 +51,8 @@
5251
"sort-packages": true,
5352
"allow-plugins": {
5453
"simplesamlphp/composer-module-installer": true
55-
}
54+
},
55+
"cache-dir": "build/composer"
5656
},
5757
"autoload": {
5858
"psr-4": {
@@ -61,12 +61,11 @@
6161
},
6262
"autoload-dev": {
6363
"psr-4": {
64-
"SimpleSAML\\Test\\Module\\oidc\\": "tests/"
64+
"SimpleSAML\\Test\\Module\\oidc\\": "tests/src/"
6565
}
6666
},
6767
"extra": {
6868
"branch-alias": {
69-
"dev-master": "1.0.x-dev"
7069
}
7170
},
7271
"scripts": {

0 commit comments

Comments
 (0)