From 18135addac4dd3504a9cf28272b5474d2f003bf6 Mon Sep 17 00:00:00 2001 From: Steve Breker Date: Wed, 9 Oct 2024 23:51:57 -0700 Subject: [PATCH] Move setRedirectUrl() logic --- plugins/arOidcPlugin/lib/arOidc.class.php | 12 ++++++------ plugins/arOidcPlugin/lib/oidcUser.class.php | 13 +++++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/arOidcPlugin/lib/arOidc.class.php b/plugins/arOidcPlugin/lib/arOidc.class.php index aae0e6d073..ad1c6f23ce 100644 --- a/plugins/arOidcPlugin/lib/arOidc.class.php +++ b/plugins/arOidcPlugin/lib/arOidc.class.php @@ -33,12 +33,12 @@ public static function getOidcInstance() { $oidc = new OpenIDConnectClient(); - // Validate redirect URL. - $redirectUrl = sfConfig::get('app_oidc_redirect_url', ''); - if (empty($redirectUrl)) { - throw new Exception('Invalid OIDC redirect URL. Please review the app_oidc_redirect_url parameter in plugin app.yml.'); - } - $oidc->setRedirectURL($redirectUrl); + // // Validate redirect URL. + // $redirectUrl = sfConfig::get('app_oidc_redirect_url', ''); + // if (empty($redirectUrl)) { + // throw new Exception('Invalid OIDC redirect URL. Please review the app_oidc_redirect_url parameter in plugin app.yml.'); + // } + // $oidc->setRedirectURL($redirectUrl); return $oidc; } diff --git a/plugins/arOidcPlugin/lib/oidcUser.class.php b/plugins/arOidcPlugin/lib/oidcUser.class.php index 0d33cad256..4b98a447e2 100644 --- a/plugins/arOidcPlugin/lib/oidcUser.class.php +++ b/plugins/arOidcPlugin/lib/oidcUser.class.php @@ -36,9 +36,18 @@ public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $o parent::initialize($dispatcher, $storage, $options); - if (null === $this->oidcClient) { - $this->setOidcClient(arOidc::getOidcInstance()); + $this->setOidcClient(arOidc::getOidcInstance()); + + $this->setRedirectURL(); + } + + public function setRedirectUrl() + { + $redirectUrl = sfConfig::get('app_oidc_redirect_url', ''); + if (empty($redirectUrl)) { + throw new Exception('Invalid OIDC redirect URL. Please review the app_oidc_redirect_url parameter in plugin app.yml.'); } + $this->oidcClient->setRedirectURL($redirectUrl); } /**