Problem/Motivation

If the user tries to use the URL: /openid-connect/{client_name}/redirect while there's a session open, the site breaks with a RuntimeException.

RuntimeException: User already logged in in Drupal\openid_connect\OpenIDConnect->completeAuthorization() (line 303 of modules/contrib/openid_connect/src/OpenIDConnect.php).
Drupal\openid_connect\Controller\OpenIDConnectRedirectController->authenticate()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 57)
Drupal\Core\StackMiddleware\Session->handle() (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 708)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Login using SSO, then try to use the URL: /openid-connect/{client_name}/redirect again.

Proposed resolution

If there's an active session then redirect to destination instead of trying to start the authorize process again.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nicobot created an issue. See original summary.

luchot’s picture

tested and verified, the fix works perfectly

nicobot’s picture

Thank you Lucho

nicobot’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.