Skip to content

Display service name from mdui:UIInfo on authentication/registration pages#141

Open
kayjoosten wants to merge 1 commit into
mainfrom
feature/issue-140-service-name-display
Open

Display service name from mdui:UIInfo on authentication/registration pages#141
kayjoosten wants to merge 1 commit into
mainfrom
feature/issue-140-service-name-display

Conversation

@kayjoosten

@kayjoosten kayjoosten commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Closes #140.

Displays the service name (mdui:DisplayName from a mdui:UIInfo SAML extension in the incoming AuthnRequest) on both the authentication and registration pages, so users can verify which service they're authenticating to.

  • ServiceNameFormatter / ServiceNameResolver (src/Surfnet/Gssp/Domain/ServiceName/) — cleans/truncates the raw display name (max 40 chars + ellipsis, whitespace trim/collapse, control/format char stripping) and picks the right language (request locale → en → first available), per the shared multi-repo spec.
  • Wired into DefaultController's authentication()/registration() actions, both templates, and translations (en/nl). Renders nothing if no mdui data is present — no error.
  • The built-in demo SP (/demo/sp) got two new optional fields, ServiceNameEn/ServiceNameNl, so the whole flow is testable locally without EngineBlock/Gateway deployed, plus new @remote Behat scenarios exercising it.
  • New PHPUnit test infrastructure (none existed in this repo before) with 15 unit tests for the formatter/resolver.

Dependency

Requires Stepup-gssp-bundle#49, which adds AuthenticationService::getMdui() / RegistrationService::getMdui() exposing the session-stored mdui data to downstream GSSP apps. composer.json currently points at that PR's branch via a VCS repository + dev- requirement, with minimum-stability: dev (matching the same pattern already used in gssp-bundle's own composer.json) — this needs to be swapped to a tagged release once #49 merges.

Test plan

  • composer phpstan / composer phpcs clean
  • composer test — 15/15 PHPUnit tests passing
  • Manually verified end-to-end with Playwright against a local dev server: authentication page shows the resolved English name (Dutch present but not shown, per locale fallback), registration page shows the service name, and the no-mdui case renders cleanly with nothing shown
  • @remote Behat scenarios (sp_authentication.feature, sp_registration.feature) — need a running local instance to execute; dry-run confirms all scenarios/steps parse with no undefined steps

kayjoosten added a commit that referenced this pull request Jul 3, 2026
- Demo SP: gate the mdui extension on either ServiceNameEn or
  ServiceNameNl being present, not English only. Filling in only the
  Dutch field previously sent no mdui extension at all, silently
  breaking the Dutch-only test path.
- ServiceNameResolver: normalize xml:lang keys (lowercase, language
  subtag only) before matching, so "en-US" or "EN" on the wire still
  match the "en" locale/fallback lookup instead of falling through to
  "first available".
- ServiceNameFormatterTest: replace the self-referential mb_substr(...)
  expected value in the combination-of-rules case with a literal
  string, so the test can't pass on a shared misunderstanding of
  mb_substr with the implementation.
kayjoosten added a commit that referenced this pull request Jul 3, 2026
- Demo SP: gate the mdui extension on either ServiceNameEn or
  ServiceNameNl being present, not English only. Filling in only the
  Dutch field previously sent no mdui extension at all, silently
  breaking the Dutch-only test path.
- ServiceNameResolver: normalize xml:lang keys (lowercase, language
  subtag only) before matching, so "en-US" or "EN" on the wire still
  match the "en" locale/fallback lookup instead of falling through to
  "first available".
- ServiceNameFormatterTest: replace the self-referential mb_substr(...)
  expected value in the combination-of-rules case with a literal
  string, so the test can't pass on a shared misunderstanding of
  mb_substr with the implementation.
@kayjoosten kayjoosten force-pushed the feature/issue-140-service-name-display branch from 42f6e95 to b9f22a5 Compare July 3, 2026 07:01
@kayjoosten kayjoosten force-pushed the feature/issue-140-service-name-display branch from 3f33907 to 6192f1d Compare July 10, 2026 10:43
Prior to this change, the registration and authentication pages gave
no indication of which service the second-factor action was for,
leaving end users unable to confirm they were acting on the SP they
expected.

This change resolves the service name from the AuthnRequest's
mdui:UIInfo metadata (via ServiceNameResolver/ServiceNameFormatter,
now provided by stepup-gssp-bundle) and renders it on the
authentication and registration templates. The demo SP controller and
templates are extended so the mdui:UIInfo fields can be exercised
locally, and Behat scenarios cover the new display behaviour.

Also included:
 - Bump the stepup-gssp-bundle dependency to the branch that exposes
   ServiceNameResolver/Formatter
 - Skip phpunit gracefully instead of failing when tests/Unit is empty

Resolves: #140
@kayjoosten kayjoosten force-pushed the feature/issue-140-service-name-display branch from 6192f1d to 96cd560 Compare July 10, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose service name: Add support for new SAML extension

1 participant