Skip to content

Commit 58c9be3

Browse files
committed
Compatibility with SimpleSAMLphp 2.5
1 parent f7f3227 commit 58c9be3

4 files changed

Lines changed: 53 additions & 29 deletions

File tree

.github/workflows/php.yml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on: # yamllint disable-line rule:truthy
88
paths-ignore:
99
- '**.md'
1010
pull_request:
11-
branches: [master, release-*]
11+
branches: [master, main, release-*]
1212
paths-ignore:
1313
- '**.md'
1414
workflow_dispatch:
@@ -19,9 +19,9 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
php-version: ['8.1', '8.2', '8.3', '8.4']
22+
php-version: ['8.3', '8.4', '8.5']
2323

24-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.2
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.11.3
2525
with:
2626
php-version: ${{ matrix.php-version }}
2727

@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232

33-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.2
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.11.3
3434
with:
3535
enable_eslinter: false
3636
enable_jsonlinter: true
@@ -41,19 +41,22 @@ jobs:
4141
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
4242
runs-on: ${{ matrix.operating-system }}
4343
needs: [phplinter, linter]
44+
4445
strategy:
4546
fail-fast: false
4647
matrix:
4748
operating-system: [ubuntu-latest]
48-
php-versions: ['8.1', '8.2', '8.3', '8.4']
49+
php-versions: ['8.3', '8.4', '8.5']
4950

5051
steps:
5152
- name: Setup PHP, with composer and extensions
5253
# https://github.com/shivammathur/setup-php
5354
uses: shivammathur/setup-php@v2
5455
with:
5556
php-version: ${{ matrix.php-versions }}
56-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xdebug, xml
57+
extensions: >
58+
ctype, date, dom, fileinfo, filter, hash, intl, mbstring,
59+
mysql, openssl, pcre, posix, spl, xdebug, xml
5760
tools: composer
5861
ini-values: error_reporting=E_ALL, pcov.directory=.
5962
coverage: pcov
@@ -69,32 +72,32 @@ jobs:
6972
git config --global core.autocrlf false
7073
git config --global core.eol lf
7174
72-
- uses: actions/checkout@v5
75+
- uses: actions/checkout@v6
7376

7477
- name: Get composer cache directory
7578
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
7679

7780
- name: Cache composer dependencies
78-
uses: actions/cache@v4
81+
uses: actions/cache@v5
7982
with:
80-
path: $COMPOSER_CACHE
83+
path: ${{ env.COMPOSER_CACHE }}
8184
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
8285
restore-keys: ${{ runner.os }}-composer-
8386

8487
- name: Install Composer dependencies
8588
run: composer install --no-progress --prefer-dist --optimize-autoloader
8689

8790
- name: Run unit tests with coverage
88-
if: ${{ matrix.php-versions == '8.4' }}
91+
if: ${{ matrix.php-versions == '8.5' }}
8992
run: vendor/bin/phpunit --exclude-group skipOnGithub
9093

9194
- name: Run unit tests (no coverage)
92-
if: ${{ matrix.php-versions != '8.4' }}
95+
if: ${{ matrix.php-versions != '8.5' }}
9396
run: vendor/bin/phpunit --exclude-group skipOnGithub --no-coverage
9497

9598
- name: Save coverage data
96-
if: ${{ matrix.php-versions == '8.4' }}
97-
uses: actions/upload-artifact@v4
99+
if: ${{ matrix.php-versions == '8.5' }}
100+
uses: actions/upload-artifact@v7
98101
with:
99102
name: coverage-data
100103
path: ${{ github.workspace }}/build
@@ -110,22 +113,22 @@ jobs:
110113
uses: shivammathur/setup-php@v2
111114
with:
112115
# Should be the higest supported version, so we can use the newest tools
113-
php-version: '8.4'
114-
tools: composer, composer-require-checker, composer-unused
115-
extensions: ctype, date, dom, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
116+
php-version: '8.5'
117+
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
118+
extensions: ctype, date, dom, filter, hash, intl, mbstring, mysql, opcache, openssl, pcre, spl, xml
116119

117120
- name: Setup problem matchers for PHP
118121
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
119122

120-
- uses: actions/checkout@v5
123+
- uses: actions/checkout@v6
121124

122125
- name: Get composer cache directory
123126
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
124127

125128
- name: Cache composer dependencies
126-
uses: actions/cache@v4
129+
uses: actions/cache@v5
127130
with:
128-
path: $COMPOSER_CACHE
131+
path: ${{ env.COMPOSER_CACHE }}
129132
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
130133
restore-keys: ${{ runner.os }}-composer-
131134

@@ -136,7 +139,7 @@ jobs:
136139
run: composer install --no-progress --prefer-dist --optimize-autoloader
137140

138141
- name: Check code for hard dependencies missing in composer.json
139-
run: composer-require-checker check --config-file tools/composer-require-checker.json composer.json
142+
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
140143

141144
- name: Check code for unused dependencies in composer.json
142145
run: |
@@ -156,29 +159,30 @@ jobs:
156159
security:
157160
name: Security checks
158161
runs-on: [ubuntu-latest]
162+
159163
steps:
160164
- name: Setup PHP, with composer and extensions
161165
# https://github.com/shivammathur/setup-php
162166
uses: shivammathur/setup-php@v2
163167
with:
164168
# Should be the lowest supported version
165-
php-version: '8.1'
169+
php-version: '8.3'
166170
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, spl, xml
167171
tools: composer
168172
coverage: none
169173

170174
- name: Setup problem matchers for PHP
171175
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
172176

173-
- uses: actions/checkout@v5
177+
- uses: actions/checkout@v6
174178

175179
- name: Get composer cache directory
176180
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
177181

178182
- name: Cache composer dependencies
179-
uses: actions/cache@v4
183+
uses: actions/cache@v5
180184
with:
181-
path: $COMPOSER_CACHE
185+
path: ${{ env.COMPOSER_CACHE }}
182186
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
183187
restore-keys: ${{ runner.os }}-composer-
184188

@@ -201,6 +205,6 @@ jobs:
201205
if: ${{ always() && needs.unit-tests-linux.result == 'success' }}
202206

203207
steps:
204-
- uses: geekyeggo/delete-artifact@v5
208+
- uses: geekyeggo/delete-artifact@v6
205209
with:
206210
name: coverage-data

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
}
2626
},
2727
"require": {
28-
"php": "^8.1",
29-
"simplesamlphp/assert": "^0.8.0 || ^1.0.0"
28+
"php": "^8.3",
29+
"simplesamlphp/assert": "^2.0.0"
3030
},
3131
"require-dev": {
32-
"simplesamlphp/simplesamlphp": ">=2.0.0 <2.6.0",
33-
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
32+
"simplesamlphp/simplesamlphp": ">=2.5.0 <2.6.0",
33+
"simplesamlphp/simplesamlphp-test-framework": "^1.11.2"
3434
},
3535

3636
"autoload": {

src/Auth/Process/GenerateUniqueId.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class GenerateUniqueId extends Auth\ProcessingFilter
3535
/** @var bool|false $privacy Whether to hash the resulting UUID to preserve privacy */
3636
private bool $privacy = false;
3737

38+
3839
/**
3940
* Initialize this filter, parse configuration.
4041
*
@@ -82,6 +83,7 @@ public function __construct(array $config, $reserved)
8283
}
8384
}
8485

86+
8587
/**
8688
* Decode Microsoft's mixed-endian binary encoding
8789
* http://php.net/manual/en/function.mssql-guid-string.php#119391
@@ -112,6 +114,7 @@ private function decodeActiveDirectory(string $value): string
112114
return $guid;
113115
}
114116

117+
115118
/**
116119
* Decode big-endian binary encoding
117120
*
@@ -141,6 +144,7 @@ private function decodeBinaryBigEndian(string $value): string
141144
return $guid;
142145
}
143146

147+
144148
/**
145149
* Decode textual UUID
146150
*
@@ -162,6 +166,7 @@ private function decodeUuidString(string $value): string
162166
return $guid;
163167
}
164168

169+
165170
/**
166171
* Generate a privacy-preserving hash
167172
*
@@ -175,6 +180,7 @@ private function privacyHash(string $value, string $source = ''): string
175180
return hash('sha256', $value . '|' . $salter->getSecretSalt() . '|' . $source);
176181
}
177182

183+
178184
/**
179185
* Process this filter
180186
*

tests/src/Auth/Process/GenerateUniqueIdTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ private static function processFilter(array $config, array $request)
2626
return $request;
2727
}
2828

29+
2930
protected function setUp(): void
3031
{
3132
parent::setUp();
3233
Configuration::loadFromArray(['secretsalt' => 'test'], '[ARRAY]', 'simplesaml');
3334
}
3435

36+
3537
public function testNoConfig(): void
3638
{
3739
$request = [
@@ -53,6 +55,7 @@ public function testNoConfig(): void
5355
);
5456
}
5557

58+
5659
public function testScopeAttributeWithAt(): void
5760
{
5861
$request = [
@@ -74,6 +77,7 @@ public function testScopeAttributeWithAt(): void
7477
);
7578
}
7679

80+
7781
public function testDifferentAttributes(): void
7882
{
7983
$request = [
@@ -102,6 +106,7 @@ public function testDifferentAttributes(): void
102106
);
103107
}
104108

109+
105110
public function testEmpty(): void
106111
{
107112
$request = [
@@ -120,6 +125,7 @@ public function testEmpty(): void
120125
);
121126
}
122127

128+
123129
public function testPrivacyHash(): void
124130
{
125131
$request = [
@@ -147,6 +153,7 @@ public function testPrivacyHash(): void
147153
);
148154
}
149155

156+
150157
public function testPrivacyHashProxied(): void
151158
{
152159
$request = [
@@ -175,6 +182,7 @@ public function testPrivacyHashProxied(): void
175182
);
176183
}
177184

185+
178186
public function testUnknownFormat(): void
179187
{
180188
$request = [
@@ -193,6 +201,7 @@ public function testUnknownFormat(): void
193201
);
194202
}
195203

204+
196205
public function testMicrosoft(): void
197206
{
198207
$request = [
@@ -219,6 +228,7 @@ public function testMicrosoft(): void
219228
);
220229
}
221230

231+
222232
public function testBogusMicrosoft(): void
223233
{
224234
$request = [
@@ -238,6 +248,7 @@ public function testBogusMicrosoft(): void
238248
$this->assertEquals($result['eduPersonUniqueId'], '');
239249
}
240250

251+
241252
public function testEdirectory(): void
242253
{
243254
$request = [
@@ -264,6 +275,7 @@ public function testEdirectory(): void
264275
);
265276
}
266277

278+
267279
public function testBogusEdirectory(): void
268280
{
269281
$request = [
@@ -282,6 +294,7 @@ public function testBogusEdirectory(): void
282294
);
283295
}
284296

297+
285298
public function testOpenLdap(): void
286299
{
287300
$request = [
@@ -308,6 +321,7 @@ public function testOpenLdap(): void
308321
);
309322
}
310323

324+
311325
public function testBogusOpenLdap(): void
312326
{
313327
$request = [

0 commit comments

Comments
 (0)