Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d93068f
Migrate to cas-lib
tvdijen Mar 14, 2023
5885adb
Use SSP 2.3
tvdijen Apr 14, 2025
80bde34
Allow xmlprovider-plugin
tvdijen Apr 14, 2025
c2fc593
Fix unit-test
tvdijen Apr 14, 2025
88f0586
Fix sniffer-issues
tvdijen Apr 14, 2025
d20d255
Fix phpstan-issues
tvdijen Jul 7, 2025
6c9b58d
Fix case
tvdijen Oct 29, 2025
1572c07
Use local phpcs, bump minimum PHP-version and start testing on PHP 8.5
tvdijen Oct 29, 2025
f73a492
Adopt SSP coding-style
tvdijen Oct 29, 2025
f6d4543
Fix phpstan
tvdijen Oct 29, 2025
988621c
Merge branch 'master' into library
tvdijen Oct 29, 2025
d8f06fb
Fix phpstan
tvdijen Oct 29, 2025
68ed87f
composer.json add dev dependencies and pre-commit script.fix phpstan …
ioigoume Nov 7, 2025
bce21f7
Fix XML element parsing issue
ioigoume Nov 7, 2025
f4a058b
Add useful debug messages
ioigoume Nov 7, 2025
1d4111b
Fix attributes configuration behavioral change. Add tests. Fix cas.md…
ioigoume Nov 8, 2025
62a2de0
improve test doc.replace phpcs disable with php line max length handl…
ioigoume Nov 10, 2025
55b2985
Bump dependencies
tvdijen Nov 14, 2025
7daedad
Upgrade dependencies.
ioigoume Nov 23, 2025
294a180
Merge branch 'library' into phpstan-failing-check
tvdijen Nov 23, 2025
35f052e
add tests. parse both attributes and metadata.
ioigoume Nov 24, 2025
0cc392b
Sync changes. Fix quality issues.
ioigoume Nov 24, 2025
bfd094f
fix depedency list.Use new xml-cas-module-slate.
ioigoume Dec 15, 2025
db2c1ad
Merge pull request #9 from ioigoume/phpstan-failing-check
ioigoume Dec 15, 2025
38478aa
Fix failing PHP-linters
tvdijen Dec 15, 2025
8477cf9
Fix markdown
tvdijen Dec 15, 2025
c70caf6
move linter workflow to 1.10.6
ioigoume Dec 15, 2025
eb15b2e
Merge pull request #10 from ioigoume/github-action-linter-version
ioigoume Dec 15, 2025
c6c42d2
Increase phpstan src level
ioigoume Dec 15, 2025
cf90bb9
Merge pull request #11 from ioigoume/increase-phpstan-src-level
ioigoume Dec 15, 2025
dd29ff1
In PHP 8.4, if a parameter has a default value of `null`, its type mu…
ioigoume Dec 15, 2025
f3d6579
Merge pull request #12 from ioigoume/fix-explicit-nullable-parameter
ioigoume Dec 15, 2025
afaa39e
Replace legacey HTTP/Utils fetch with Symfony HTTP Client
ioigoume Dec 16, 2025
ae2ce00
Merge pull request #13 from ioigoume/symfony-http-client
ioigoume Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
php-version: ['8.2', '8.3', '8.4', '8.5']

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.2
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.6
with:
php-version: ${{ matrix.php-version }}

Expand All @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.2
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.6
with:
enable_eslinter: false
enable_jsonlinter: true
Expand All @@ -45,15 +45,15 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.1', '8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']

steps:
- name: Setup PHP, with composer and extensions
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml
tools: composer
ini-values: error_reporting=E_ALL
coverage: pcov
Expand Down Expand Up @@ -85,15 +85,15 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run unit tests with coverage
if: ${{ matrix.php-versions == '8.4' }}
if: ${{ matrix.php-versions == '8.5' }}
run: vendor/bin/phpunit

- name: Run unit tests (no coverage)
if: ${{ matrix.php-versions != '8.4' }}
if: ${{ matrix.php-versions != '8.5' }}
run: vendor/bin/phpunit --no-coverage

- name: Save coverage data
if: ${{ matrix.php-versions == '8.4' }}
if: ${{ matrix.php-versions == '8.5' }}
uses: actions/upload-artifact@v4
with:
name: coverage-data
Expand All @@ -107,15 +107,15 @@ jobs:
fail-fast: true
matrix:
operating-system: [windows-latest]
php-versions: ['8.1', '8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']

steps:
- name: Setup PHP, with composer and extensions
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml, zip
extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml, zip
tools: composer
ini-values: error_reporting=E_ALL
coverage: none
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
# Should be the higest supported version, so we can use the newest tools
php-version: '8.4'
php-version: '8.5'
tools: composer, composer-require-checker, composer-unused, phpcs
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml

Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
run: composer-unused

- name: PHP Code Sniffer
run: phpcs
run: vendor/bin/phpcs

- name: PHPStan
run: |
Expand All @@ -214,7 +214,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
# Should be the lowest supported version
php-version: '8.1'
php-version: '8.2'
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
tools: composer
coverage: none
Expand Down
42 changes: 36 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
},
"allow-plugins": {
"composer/package-versions-deprecated": true,
"simplesamlphp/composer-module-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"simplesamlphp/composer-xmlprovider-installer": true
}
},
Expand All @@ -34,17 +34,47 @@
}
},
"require": {
"php": "^8.1",
"simplesamlphp/composer-module-installer": "^1.3.4",
"simplesamlphp/simplesamlphp": "~2.4.0",
"php": "^8.2",
"ext-pcre": "*",
"ext-dom": "*",

"simplesamlphp/assert": "^1.9",
"simplesamlphp/composer-module-installer": "^1.4",
"simplesamlphp/simplesamlphp": "dev-simplesamlphp-2.5 as v2.5.x-dev",
"simplesamlphp/simplesamlphp-module-ldap": "~1.2",
"symfony/http-foundation": "^6.4"
"simplesamlphp/xml-cas-module-slate": "~1.1.0",
"simplesamlphp/xml-cas": "^v2.2.0",
"simplesamlphp/xml-common": "~2.4",
"symfony/http-foundation": "~7.4",
"symfony/http-client": "~7.4",
"symfony/http-client-contracts": "^3.5"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "^1.9.2"
"simplesamlphp/simplesamlphp-test-framework": "^1.10",
"phpunit/phpunit": "^11",
"icanhazstring/composer-unused": "^0.9.5",
"squizlabs/php_codesniffer": "^4.0.0",
"phpstan/phpstan": "^2.1.33",
"maglnet/composer-require-checker": "^4"
},
"support": {
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-cas/issues",
"source": "https://github.com/simplesamlphp/simplesamlphp-module-cas"
},
"scripts": {
"pre-commit": [
"vendor/bin/phpcs -p",
"vendor/bin/composer-require-checker check --config-file=tools/composer-require-checker.json composer.json",
"vendor/bin/phpstan analyze -c phpstan.neon",
"vendor/bin/phpstan analyze -c phpstan-dev.neon",
"vendor/bin/composer-unused",
"vendor/bin/phpunit --no-coverage --testdox"
],
"tests": [
"vendor/bin/phpunit --no-coverage"
],
"propose-fix": [
"vendor/bin/phpcs --report=diff"
]
}
}
45 changes: 37 additions & 8 deletions docs/cas.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ the only difference is this is authentication module and not a script.

## Setting up the CAS authentication module

Adding a authentication source
Adding an authentication source

Example authsource.php:

Expand All @@ -31,7 +31,7 @@ Example authsource.php:

## Querying Attributes

CAS V3 (since 2017) supports querying attributes. Those have to be published
CAS v3 (since 2017) supports querying attributes. Those have to be published
for the service you're calling. Here the service publishes `sn`, `firstName`
and `mail`.

Expand All @@ -51,6 +51,35 @@ Or you might have to call serviceValidate for Protocol 3 via **/p3/**:
]
```

### Optional: Enabling Slate extensions

Some deployments include vendor‑specific fields (for example `slate:*`) in CAS responses.
You can opt in to Slate support:

```php
'cas' => [
// ...
'serviceValidate' => 'https://cas.example.com/p3/serviceValidate',
// Enable Slate support (optional)
'slate.enabled' => true,

// Optional XPath-based attribute mappings
'attributes' => [
// Standard CAS attributes
'uid' => 'cas:user',
'mail' => 'cas:attributes/cas:mail',

// Slate namespaced attributes inside cas:attributes
'slate_person' => 'cas:attributes/slate:person',
'slate_round' => 'cas:attributes/slate:round',
'slate_ref' => 'cas:attributes/slate:ref',

// Some deployments also place vendor elements at the top level
'slate_person_top' => '/cas:serviceResponse/cas:authenticationSuccess/slate:person',
],
],
```

which would return something like

```xml
Expand All @@ -76,22 +105,22 @@ for each value:
```php
'cas' => [
'attributes' => [
'uid' => '/cas:serviceResponse/cas:authenticationSuccess/cas:user',
'sn' => '/cas:serviceResponse/cas:authenticationSuccess/cas:attributes/cas:sn',
'givenName' => '/cas:serviceResponse/cas:authenticationSuccess/cas:attributes/cas:firstname',
'mail' => '/cas:serviceResponse/cas:authenticationSuccess/cas:attributes/cas:mail',
'uid' => 'cas:user',
'sn' => 'cas:attributes/cas:sn',
'givenName' => 'cas:attributes/cas:firstname',
'mail' => 'cas:attributes/cas:mail',
],
],
```

and even some custom attributes if they're set:

```php
'customabc' => '/cas:serviceResponse/cas:authenticationSuccess/custom:abc',
'customabc' => 'custom:abc',
```

You'll probably want to avoid querying LDAP for attributes:
set `ldap` to a `null`:
set `ldap` to `null`:

```php
'example-cas' => [
Expand Down
2 changes: 1 addition & 1 deletion phpstan-dev.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
level: 8
level: 9
paths:
- tests
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
level: 7
level: 8
paths:
- src
6 changes: 5 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
colors="true"
cacheDirectory=".phpunit.cache">
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
Expand Down
Loading