Skip to content

Add support for preferred IdPs in WAYF display#1985

Open
johanib wants to merge 2 commits intomainfrom
feature/1970-preferred-idps-wayf
Open

Add support for preferred IdPs in WAYF display#1985
johanib wants to merge 2 commits intomainfrom
feature/1970-preferred-idps-wayf

Conversation

@johanib
Copy link
Copy Markdown
Contributor

@johanib johanib commented Apr 22, 2026

Prior to this change, there was no way to configure priority IdPs.

This change adds a wayf.preferred_idp_entity_ids parameter to configure IdPs that should show prominent in the wayf.
IdPs in this list are shown on top of the wayf, outside of the regular list.

Also make the twig templates more explicit by not enabling the global variable scope.

Resolves #1970

@johanib johanib force-pushed the feature/1970-preferred-idps-wayf branch 2 times, most recently from 2f6926b to 62b309b Compare April 22, 2026 08:32
johanib added 2 commits April 22, 2026 10:53
Prior to this change, there was no way to configure priority IdPs.

This change adds a `wayf.preferred_idp_entity_ids` parameter to configure IdPs that should show prominent in the wayf.
IdPs in this list are shown on top of the wayf, outside of the regular list.

Resolves #1970
…vice

Prior to this change, much of the wayf rendering happened in Corto.

This change moves that logic to the Symfony workspaces.

Benefits:
- Business logic is now in a testable Symfony service with proper DI
- Production (SingleSignOn) and the functional test (WayfController)
  share the exact same rendering path, eliminating logic duplication
- DiContainerRuntime bridge is thinner
@johanib johanib force-pushed the feature/1970-preferred-idps-wayf branch from 62b309b to a8115aa Compare April 22, 2026 08:54
@johanib johanib requested a review from kayjoosten April 22, 2026 08:55
): string {
$split = $this->splitter->split($idpList, $preferredIdpEntityIds);
$showPreferredIdps = !empty($split['preferred']);
$isDefaultIdpPreferred = in_array($defaultIdpEntityId, $preferredIdpEntityIds, true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The banner is suppressed when the default IdP is in $preferredIdpEntityIds, but this is the raw config list it doesn't know whether the IdP is actually connected to this SP. IdpSplitter silently drops disconnected preferred IdPs, so the default IdP can be "on the guest list" but never show up to the party.

When this happens the default IdP is invisible everywhere: not in the preferred section (dropped by splitter), not in the regular list (preferred IdPs are excluded from regular), and the banner is suppressed too.

// checks the config — doesn't know if the IdP is connected
$isDefaultIdpPreferred = in_array($defaultIdpEntityId, $preferredIdpEntityIds, true);

// fix: check what the splitter actually produced
$preferredEntityIdsShown = array_column($split['preferred'], 'EntityID');
$isDefaultIdpPreferred = in_array($defaultIdpEntityId, $preferredEntityIdsShown, true);

@@ -0,0 +1,7 @@
<section class="wayf__preferredIdps {% if connectedIdps.formattedPreviousSelectionList is not empty %}hidden{% endif %}">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remainingIdps.html.twig has a visually-hidden <h2> so screenreader users know where they are. preferredIdps.html.twig has none a screenreader user landing in this section gets no context.

<section class="wayf__preferredIdps {% if connectedIdps.formattedPreviousSelectionList is not empty %}hidden{% endif %}">
    <h2 class="visually-hidden">{{ 'wayf_preferred_idps_title_screenreader'|trans }}</h2>
    <ul class="wayf__idpList wayf__idpList--preferred">

Or is it not needed here? What do you think?

showRequestAccess: $showRequestAccess,
requestId: $requestId,
serviceProvider: $serviceProvider,
showRequestAccessContainer: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showRequestAccessContainer is hardcoded true the parameter does nothing

WayfRenderer::render() always passes showRequestAccessContainer: true to the factory. It is carried through WayfViewModelFactory and stored in WayfViewModel, but no caller can ever change it.

If it should always be true, can you not hardcode it in the factory?

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.

Show preferred IdPs on a special position in the WAYF

2 participants