Skip to content

Add link to reset remembered WAYF login-method choices - #353

Merged
kayjoosten merged 4 commits into
mainfrom
wayf-reset-choice-link
Oct 14, 2026
Merged

kayjoosten merged 4 commits into
mainfrom
wayf-reset-choice-link

Conversation

@kayjoosten

Copy link
Copy Markdown
Contributor

What

Adds a "Login method choices" section to the bottom of the "my personal
data" page (/my-profile) that lets a user reset every per-application
WAYF login-method choice they've made, behind a confirmation popup.
Confirming sends the user to EngineBlock's /reset-remember-wayf
endpoint (OpenConext-engineblock#2085), which clears the cookie and
redirects back to this same page.

Closes #345.

Depends on OpenConext-engineblock#2097

/reset-remember-wayf needs to accept a redirect query parameter and
send a result signal back for this to fully work end-to-end; that's
OpenConext/OpenConext-engineblock#2097,
stacked on the already-open OpenConext-engineblock#2094. Without it,
this page's link still works, but the user is sent to EngineBlock's own
configured default afterwards instead of back here.

Scope note: this PR covers #345 only. #350 ("cookies have been
removed" feedback) and OpenConext-profile#346/#348 are intentionally out
of scope and deferred pending re-confirmation, per the epic's recommended
order.

Details

  • WayfResetLinkBuilder is a small, pure service that appends a
    redirect query parameter (the absolute URL of this same page) to the
    configured wayf_reset_url. It's factored out of MyProfileController
    and unit tested in isolation, since this repo has no
    controller/functional test infrastructure and the interesting logic
    (building the link) doesn't need a kernel to test.
  • New wayf_reset_url parameter follows the existing pattern of simple
    string config values in parameters.yaml(.dist), pointing at
    EngineBlock's reset endpoint.
  • The new section reuses the shared modal.html.twig confirmation
    component (the same one used for deleting a connection), wrapped in a
    single-iteration for loop: the helper unconditionally derives its
    element ids from loop.index, which only exists inside a loop, and its
    one existing caller is always used from within a real loop over
    services.
  • SCSS mirrors the structure/naming of the existing "Download" section on
    the SURFconext dashboard (mySurfConext__download*), including its
    IE11 fallback rules, since both are a text explanation next to a single
    button.
  • New translation keys were added under the existing
    profile.my_profile key in all three locales (en/nl/pt). Exact copy
    from design mockups wasn't available to me
    , so the wording is a
    best-effort draft that should be reviewed against the actual designs
    before merging; the confirm button text ("Reset all") is the one piece
    of copy specified by the ticket itself.

Testing

All run inside the CI Docker image
(ghcr.io/openconext/openconext-basecontainers/php85-apache2-node24):

  • composer check (validate, phplint, phpmd, phpcs, docheader, phpunit,
    phpstan): clean. 146/146 tests pass, including the new
    WayfResetLinkBuilderTest (100% coverage).
  • bin/console lint:twig: 57/57 templates valid.
  • yarn build (Encore/Sass): compiles cleanly (only pre-existing Sass
    deprecation warnings, unrelated to this change).

No controller/functional test was added for MyProfileController
itself, consistent with this repo's existing convention of not having
kernel/controller tests anywhere.

Add a "Login method choices" section to the bottom of the "my personal
data" page that lets a user reset every per-application login-method
choice they've made in the WAYF, behind a confirmation popup. Confirming
sends the user to EngineBlock's /reset-remember-wayf endpoint (#2085),
which clears the cookie and redirects back here.

- WayfResetLinkBuilder is a small, pure service that appends a `redirect`
  query parameter (the absolute URL of this same page) to the configured
  wayf_reset_url. It's factored out of MyProfileController and unit
  tested in isolation because this repo has no controller/functional
  test infrastructure yet, and the interesting logic (building the
  link) doesn't need a kernel to test.
- New wayf_reset_url parameter follows the existing pattern of simple
  string config values in parameters.yaml(.dist), pointing at
  EngineBlock's reset endpoint.
- The new section reuses the shared modal.html.twig confirmation
  component (the same one used for deleting a connection), wrapped in a
  single-iteration `for` loop: the helper unconditionally derives its
  element ids from `loop.index`, which only exists inside a loop, and
  its one existing caller is always used from within a real loop over
  services.
- SCSS mirrors the structure/naming of the existing "Download" section
  on the SURFconext dashboard (mySurfConext__download*), including its
  IE11 fallback rules, since both are a text explanation next to a
  single button.
- New translation keys were added under the existing
  profile.my_profile key in all three locales (en/nl/pt). Since exact
  copy from design isn't available, the wording is a best-effort draft
  that should be reviewed against the actual mockups; the confirm
  button text ("Reset all") is the one piece of copy specified by the
  ticket itself.

This depends on OpenConext/OpenConext-engineblock#2097 adding `redirect`
support to /reset-remember-wayf; without it the endpoint still works but
always redirects to its own configured default instead of back here.

Refs: #345
# If applied, this commit will
Stop the 'reset login method choices' action from being triggerable
by a plain, unauthenticated cross-site GET request.

# Why is this change needed?
Prior to this change, the confirm button in the reset modal was a
plain <a href> pointing directly at EngineBlock's cross-origin
/reset-remember-wayf endpoint. The confirmation modal was a
client-side-only gate; the underlying action was a GET with no CSRF
token, so it could be triggered by cross-site navigation or an
auto-submitting link, silently clearing a user's remembered WAYF
choices without their intent.

# How does it address the issue?
This change replaces the link with a same-origin POST form carrying
a Symfony CSRF token. A new route validates the token and only then
redirects the browser on to EngineBlock's existing reset endpoint,
preserving the same redirect-back behavior for legitimate
same-origin submissions.

# Provide links to any relevant tickets, articles or other resources
Found during review of PR #353.
@kayjoosten

Copy link
Copy Markdown
Contributor Author

We have decided to use the same design as the remove consent.

@johanib johanib left a comment

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.

Two small issues, then good to merge!
Looks nice.

The modal has some potential a11y issues but that is pre-existing, not in scope for this pr.

Comment thread config/openconext/parameters.yaml.dist Resolved
# If applied, this commit will...
Fix the reset-choice confirmation button's layout in the modal and add
changelog guidance for the new required parameter.

# Why is this change needed?
Prior to this change, the modal button used a width:100% rule on the
form wrapper that broke the button's intended layout, and the
CHANGELOG did not mention that the new wayf_reset_url parameter must
be set by deployments.

# How does it address the issue?
This change replaces the width override with display:contents on the
form wrapper so the button retains its natural sizing, and adds
CHANGELOG entries describing the feature and the required parameter.

# Provide links to any relevant tickets, articles or other resources
#353

@johanib johanib left a comment

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.

Thanks for testing in Firefox & safari after the firefox redirect loop bug :)

@kayjoosten
kayjoosten merged commit fc36bd5 into main Oct 14, 2026
1 check passed
@kayjoosten
kayjoosten deleted the wayf-reset-choice-link branch October 14, 2026 09:12
kayjoosten added a commit that referenced this pull request Oct 19, 2026
* Add link to reset remembered WAYF login-method choices

Add a "Login method choices" section to the bottom of the "my personal
data" page that lets a user reset every per-application login-method
choice they've made in the WAYF, behind a confirmation popup. Confirming
sends the user to EngineBlock's /reset-remember-wayf endpoint (#2085),
which clears the cookie and redirects back here.

- WayfResetLinkBuilder is a small, pure service that appends a `redirect`
  query parameter (the absolute URL of this same page) to the configured
  wayf_reset_url. It's factored out of MyProfileController and unit
  tested in isolation because this repo has no controller/functional
  test infrastructure yet, and the interesting logic (building the
  link) doesn't need a kernel to test.
- New wayf_reset_url parameter follows the existing pattern of simple
  string config values in parameters.yaml(.dist), pointing at
  EngineBlock's reset endpoint.
- The new section reuses the shared modal.html.twig confirmation
  component (the same one used for deleting a connection), wrapped in a
  single-iteration `for` loop: the helper unconditionally derives its
  element ids from `loop.index`, which only exists inside a loop, and
  its one existing caller is always used from within a real loop over
  services.
- SCSS mirrors the structure/naming of the existing "Download" section
  on the SURFconext dashboard (mySurfConext__download*), including its
  IE11 fallback rules, since both are a text explanation next to a
  single button.
- New translation keys were added under the existing
  profile.my_profile key in all three locales (en/nl/pt). Since exact
  copy from design isn't available, the wording is a best-effort draft
  that should be reviewed against the actual mockups; the confirm
  button text ("Reset all") is the one piece of copy specified by the
  ticket itself.

This depends on OpenConext/OpenConext-engineblock#2097 adding `redirect`
support to /reset-remember-wayf; without it the endpoint still works but
always redirects to its own configured default instead of back here.

Refs: #345

* Require CSRF protection for the WAYF-reset action

# If applied, this commit will
Stop the 'reset login method choices' action from being triggerable
by a plain, unauthenticated cross-site GET request.

# Why is this change needed?
Prior to this change, the confirm button in the reset modal was a
plain <a href> pointing directly at EngineBlock's cross-origin
/reset-remember-wayf endpoint. The confirmation modal was a
client-side-only gate; the underlying action was a GET with no CSRF
token, so it could be triggered by cross-site navigation or an
auto-submitting link, silently clearing a user's remembered WAYF
choices without their intent.

# How does it address the issue?
This change replaces the link with a same-origin POST form carrying
a Symfony CSRF token. A new route validates the token and only then
redirects the browser on to EngineBlock's existing reset endpoint,
preserving the same redirect-back behavior for legitimate
same-origin submissions.

# Provide links to any relevant tickets, articles or other resources
Found during review of PR #353.

* Fix modal button layout and document wayf_reset_url param

# If applied, this commit will...
Fix the reset-choice confirmation button's layout in the modal and add
changelog guidance for the new required parameter.

# Why is this change needed?
Prior to this change, the modal button used a width:100% rule on the
form wrapper that broke the button's intended layout, and the
CHANGELOG did not mention that the new wayf_reset_url parameter must
be set by deployments.

# How does it address the issue?
This change replaces the width override with display:contents on the
form wrapper so the button retains its natural sizing, and adds
CHANGELOG entries describing the feature and the required parameter.

# Provide links to any relevant tickets, articles or other resources
#353

* Show feedback modal after resetting WAYF remembered choice

# If applied, this commit will
Show the user a modal confirming the outcome of resetting their
remembered WAYF login-method choice.

# Why is this change needed?
Prior to this change, resetting the "remember my choice" cookie via
the profile page redirected back silently. The user had no feedback
on whether a cookie was actually removed or whether there was none
to begin with.

# How does it address the issue?
This change reads the wayfReset query parameter set by EngineBlock's
reset endpoint (removed or none) through a new WayfResetResultResolver
service, and passes it to the overview template. The template renders
an auto-opening modal, reusing the existing modal helper, with copy
that matches the removed/none outcome. The modal helper is extended
with autoOpen and cleanParam options so the modal shows itself on
load and the query parameter is stripped from the URL afterwards,
and its header id is now derived from the modal's own linkId rather
than loop.index so multiple modals on one page never collide.

# Provide links to any relevant tickets, articles or other resources
#350
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.

Support global reset of all per-SP "remember my choice" entries for the WAYF

2 participants