Skip to content

Commit 63df403

Browse files
committed
Build against simplesamlphp-2.5 branch
1 parent c5faa09 commit 63df403

8 files changed

Lines changed: 92 additions & 24 deletions

File tree

.github/workflows/test.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ jobs:
211211
strategy:
212212
fail-fast: false
213213
matrix:
214-
ssp-version: ["v2.5.0"]
214+
# SimpleSAMLphp ref to build the OP base image from. Any Composer version works: a released tag
215+
# (e.g. "v2.5.2") or an (unreleased) branch (e.g. "dev-simplesamlphp-2.5"). During v7 development
216+
# the module depends on the unreleased simplesamlphp-2.5 branch, which exposes
217+
# \SimpleSAML\Locale\Language::getAvailableLanguages() used by the ui_locales support.
218+
ssp-composer-version: ["dev-simplesamlphp-2.5"]
215219
env:
216220
SUITE_BASE_URL: https://localhost.emobix.co.uk:8443
217221
VERSION: release-v5.1.45
@@ -241,11 +245,22 @@ jobs:
241245
run: |
242246
docker compose -f docker-compose-dev.yml up -d
243247
while ! curl -skfail https://localhost.emobix.co.uk:8443/api/runner/available >/dev/null; do sleep 2; done
248+
- name: Build SimpleSAMLphp base image
249+
# SimpleSAMLphp is installed into the base image via Composer (cirrus's SSP_COMPOSER_VERSION path),
250+
# so any tag or branch can be used - here the unreleased simplesamlphp-2.5 branch the module
251+
# currently depends on. The image is built locally each run and not pushed to any registry. The
252+
# cirrus image recipe is pinned to a commit for reproducibility; bump it when needed.
253+
run: |
254+
git clone https://github.com/cirrusidentity/docker-simplesamlphp.git ssp-base-image
255+
git -C ssp-base-image checkout 0bf3ae9df5c0
256+
docker build ssp-base-image/docker \
257+
--build-arg SSP_COMPOSER_VERSION=${{ matrix.ssp-composer-version }} \
258+
-t ssp-base:${{ matrix.ssp-composer-version }}
244259
- name: Start SSP docker
245260
working-directory: ./main
246261
# Must run after conformance suite since they share a docker network.
247262
run: |
248-
SSP_VERSION=${{ matrix.ssp-version }} OIDC_VERSION=@dev docker compose -f docker/docker-compose.yml --project-directory . up -d --build
263+
SSP_IMAGE=ssp-base:${{ matrix.ssp-composer-version }} OIDC_VERSION=@dev docker compose -f docker/docker-compose.yml --project-directory . up -d --build
249264
sleep 30
250265
# while ! curl -skfail https://op.local.stack-dev.cirrusidentity.com/.well-known/openid-configuration >/dev/null; do sleep 2; done
251266
- name: Run Basic conformance tests

docker/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
ARG SSP_VERSION="v2.5.0"
2-
FROM cirrusid/simplesamlphp:${SSP_VERSION}
3-
#FROM cicnavi/simplesamlphp:${SSP_VERSION}
1+
# Base SimpleSAMLphp image. Defaults to a published cirrusid/simplesamlphp release tag, but can be
2+
# overridden to run against a different base image, for example one built locally from an unreleased
3+
# SimpleSAMLphp branch (see "Build against an unreleased SimpleSAMLphp version" in docs/4-oidc-docker.md).
4+
ARG SSP_IMAGE="cirrusid/simplesamlphp:v2.5.0"
5+
FROM ${SSP_IMAGE}
46

57
RUN apt-get update && apt-get --no-install-recommends install -y sqlite3
68
# Prepopulate the DB with items needed for testing

docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
context: .
2323
dockerfile: docker/Dockerfile
2424
args:
25-
SSP_VERSION: "${SSP_VERSION}"
25+
SSP_IMAGE: "${SSP_IMAGE:-cirrusid/simplesamlphp:v2.5.0}"
2626
OIDC_VERSION: "${OIDC_VERSION}"
2727
environment:
2828
- STAGINGCOMPOSERREPOS=oidc

docs/4-oidc-docker.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This document shows how to run and test the module with Docker.
66
- Local testing with other DBs
77
- Testing AuthProc filters
88
- Build image for conformance tests
9+
- Build against an unreleased SimpleSAMLphp version
910
- Docker Compose
1011

1112
## Run with the current git branch (live mount)
@@ -117,18 +118,59 @@ docker exec ssp-oidc-dev-image sqlite3 /var/simplesamlphp/data/mydb.sq3 '.dump'
117118

118119
Conformance tests are easier to run locally. See [Conformance](5-oidc-conformance.md).
119120

121+
## Build against an unreleased SimpleSAMLphp version
122+
123+
The OP image is built `FROM` a SimpleSAMLphp base image, selected with the
124+
`SSP_IMAGE` build argument (default: a published `cirrusid/simplesamlphp`
125+
release tag). Published tags only exist for SimpleSAMLphp *releases*, so to run
126+
against an unreleased SimpleSAMLphp branch (or any specific ref) you first build
127+
a base image from that ref and then point `SSP_IMAGE` at it.
128+
129+
> During v7 development the module depends on the unreleased `simplesamlphp-2.5`
130+
> branch (it uses `\SimpleSAML\Locale\Language::getAvailableLanguages()`, added
131+
> there for the `ui_locales` support). Until a SimpleSAMLphp release contains it,
132+
> the OP image must be built from that branch, otherwise the discovery endpoint
133+
> fails.
134+
135+
The [cirrusid/simplesamlphp image](https://github.com/cirrusidentity/docker-simplesamlphp)
136+
installs SimpleSAMLphp with Composer when given an `SSP_COMPOSER_VERSION` build
137+
argument, which accepts any Composer version — a branch (`dev-<branch>`) or a
138+
tag (`v2.5.2`):
139+
140+
```bash
141+
# 1. Build a SimpleSAMLphp base image from the desired ref (branch or tag).
142+
git clone https://github.com/cirrusidentity/docker-simplesamlphp.git
143+
docker build docker-simplesamlphp/docker \
144+
--build-arg SSP_COMPOSER_VERSION=dev-simplesamlphp-2.5 \
145+
-t ssp-base:dev-simplesamlphp-2.5
146+
147+
# 2. Build and run the OP on top of it. For the docker/Dockerfile-based builds
148+
# (Docker Compose below and the conformance image above) set SSP_IMAGE:
149+
SSP_IMAGE=ssp-base:dev-simplesamlphp-2.5 OIDC_VERSION=@dev \
150+
docker compose -f docker/docker-compose.yml --project-directory . up --build
151+
```
152+
153+
For the live-mount `docker run` example above, use the built base image name
154+
(`ssp-base:dev-simplesamlphp-2.5`) directly in place of
155+
`cirrusid/simplesamlphp:...`. This is exactly what the GitHub Actions conformance
156+
job does: it builds the base image from `matrix.ssp-composer-version` and passes
157+
it as `SSP_IMAGE`.
158+
120159
## Docker Compose
121160

122161
Docker Compose runs multiple containers to ease testing. It builds an
123162
image containing the OIDC module. You can remove `--build` to reuse an
124-
existing container.
163+
existing container. The SimpleSAMLphp base image defaults to a published
164+
`cirrusid/simplesamlphp` release tag; override it with `SSP_IMAGE` to run
165+
against a different base (see "Build against an unreleased SimpleSAMLphp
166+
version" above).
125167

126168
```bash
127169
# Use current branch/git checkout. Composer installs local checkout
128-
OIDC_VERSION=@dev docker-compose -f docker/docker-compose.yml --project-directory . up --build
170+
OIDC_VERSION=@dev docker compose -f docker/docker-compose.yml --project-directory . up --build
129171

130172
# Use a specific module version
131-
OIDC_VERSION=dev-master docker-compose -f docker/docker-compose.yml --project-directory . up --build
173+
OIDC_VERSION=dev-master docker compose -f docker/docker-compose.yml --project-directory . up --build
132174
```
133175

134176
Visit the OP and verify a few clients exist:

docs/5-oidc-conformance.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Clone, build, and run the conformance test suite:
1818
git clone https://gitlab.com/openid/conformance-suite.git
1919
cd conformance-suite
2020
git checkout release-v5.1.45
21-
MAVEN_CACHE=./m2 docker-compose -f builder-compose.yml run builder
22-
docker-compose up
21+
MAVEN_CACHE=./m2 docker compose -f builder-compose.yml run builder
22+
docker compose up
2323
```
2424

2525
This starts the Java conformance app and a MongoDB server. Then:
@@ -35,8 +35,16 @@ Next, run your SSP OIDC image.
3535
### Run SSP
3636

3737
Run SSP with OIDC on the same Docker network as the conformance tests so
38-
containers can communicate. See the "Docker Compose" section in the
39-
README for details.
38+
containers can communicate. See the "Docker Compose" section in
39+
[Using Docker](4-oidc-docker.md) for details.
40+
41+
The OP image is built on a SimpleSAMLphp base image. During v7 development the
42+
module depends on the unreleased `simplesamlphp-2.5` branch, so the base image
43+
must be built from that branch (or discovery fails); see
44+
"Build against an unreleased SimpleSAMLphp version" in
45+
[Using Docker](4-oidc-docker.md). The GitHub Actions conformance job does this
46+
automatically: it builds the base image from the SimpleSAMLphp ref in its
47+
matrix (`ssp-composer-version`) and passes it to the OP build as `SSP_IMAGE`.
4048

4149
### Run conformance tests (interactive)
4250

@@ -149,7 +157,7 @@ Because the plan is deterministic, the GitHub Actions step is a blocking gate (n
149157
`continue-on-error`).
150158

151159
Prerequisites: run the docker deploy image for conformance tests (see
152-
README) and the conformance test image first.
160+
[Using Docker](4-oidc-docker.md)) and the conformance test image first.
153161

154162
## Run hosted tests
155163

@@ -158,8 +166,8 @@ OP must be publicly accessible on the internet.
158166

159167
### Deploy SSP OIDC image
160168

161-
Use the docker image described in the README. It contains a SQLite DB
162-
pre-populated with data for the tests. Build and run the image.
169+
Use the docker image described in [Using Docker](4-oidc-docker.md). It contains
170+
a SQLite DB pre-populated with data for the tests. Build and run the image.
163171

164172
### Register and create conformance tests
165173

docs/6-oidc-upgrade.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ example, requested `fr-CA` matches available `fr`). Per specification this is
199199
best-effort: if none of the requested languages are available, the parameter is
200200
ignored without raising an error. The available languages are also advertised
201201
in the OP discovery metadata via the `ui_locales_supported` claim (as BCP47
202-
language tags).
202+
language tags). Note: use the canonical SimpleSAMLphp locale codes in
203+
`language.available` (for example `pt_BR` and `zh_TW`); the deprecated codes
204+
(`pt-br`, `zh-tw`), which SimpleSAMLphp itself warns against, are not fully
205+
supported by `ui_locales` on the authorization endpoint, because the language
206+
cookie is validated against the raw configured codes.
203207
- Logging has been improved for authentication flows. It should now be easier
204208
to find information about what went wrong by looking at the relevant log entries.
205209

tests/unit/src/Controllers/EndSessionControllerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ function (
274274
?bool $showModuleName = null,
275275
?bool $showSubPageTitle = null,
276276
?string $language = null,
277-
) use (&$capturedLanguage, $templateStub): Template {
277+
) use (
278+
&$capturedLanguage,
279+
$templateStub,
280+
): Template {
278281
$capturedLanguage = $language;
279282
return $templateStub;
280283
},

tests/unit/src/Utils/UiLocalesResolverTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public static function uiLocalesProvider(): array
4545
'multiple whitespace between tags' => ['de en', ['en', 'hr'], 'en'],
4646
'returns configured code, not requested tag' => ['en-US', ['en'], 'en'],
4747
'configured code unknown to the translation system is not matched' => ['xx', ['en', 'xx'], null],
48-
'deprecated configured code is renamed like in SSP' => ['pt-BR', ['en', 'pt-br'], 'pt_BR'],
4948
];
5049
}
5150

@@ -79,9 +78,4 @@ public function testSupportedUiLocalesExcludeCodesUnknownToTranslationSystem():
7978
{
8079
$this->assertSame(['en'], $this->sut(['en', 'xx'])->getSupportedUiLocales());
8180
}
82-
83-
public function testSupportedUiLocalesIncludeRenamedDeprecatedCodes(): void
84-
{
85-
$this->assertSame(['en', 'pt-BR', 'zh-TW'], $this->sut(['en', 'pt-br', 'zh-tw'])->getSupportedUiLocales());
86-
}
8781
}

0 commit comments

Comments
 (0)