Route subscriber / method of overriding core logout path

Created on 21 June 2022, almost 3 years ago
Updated 2 May 2025, 18 days ago

Problem/Motivation

The way that the module is overriding the logout route is confusing at best and problematic at worst.

There is a route subscriber in the module that is not being used. It appears to be attempting to replace Drupal Core's user.logout controller; however, after debugging why my custom module's route subscriber overrides were not working, I have discovered 2 underlying reasons:

  1. The openid_connect route subscriber is not being used because it is not defined in the services.yml file
  2. There is a custom route openid_connect.logout with the same logout path which is overriding the core user.logout, so any customizations made to user.logout are not applied when a user hits the /user/logout path because the openid_connect.logout route settings are used instead

This causes confusion because the route subscriber gives the impression that it is hooking into core's logout when it is not. This can be problematic because if someone has overridden core's logout path using the typically recommended way (via an event subscriber to alter the route's path), the openid_connect logout process will not occur.

Steps to reproduce

  1. Install and configure the openid_connect module with the setting to "Logout from identity provider" and configure a client that supports logout
  2. Test and verify that logging out of Drupal results in a logout from the IdP
  3. Add a custom module with a registered route subscriber and override core's user.logout path (e.g. /logout)
  4. Test and note that logging out of Drupal does not result in a logout from the IdP

Proposed resolution

  1. Properly register the route subscriber in the services.yml file w/ an event_subscriber tag
  2. If desired, in the route subscriber add the other route options that are defined in this module's openid_connect.logout route (default _title and option no_cache), although the former seems unnecessary and could conflict w/ custom module tweaks
  3. Remove the custom openid_connect.logout route

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024