From e604e47250e3b318d11a8c46635c29c11311ad1d Mon Sep 17 00:00:00 2001 From: Joep de Jong Date: Sat, 12 Aug 2023 18:20:36 +0300 Subject: [PATCH] Fix wiki auth --- src/plugins/authiapconnect2/auth.php | 31 ++++++++++++---------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/plugins/authiapconnect2/auth.php b/src/plugins/authiapconnect2/auth.php index 9c727a0..645eed9 100644 --- a/src/plugins/authiapconnect2/auth.php +++ b/src/plugins/authiapconnect2/auth.php @@ -55,29 +55,24 @@ public function trustExternal($user, $pass, $sticky = false) $_SERVER['REMOTE_USER'] = $_SESSION[DOKU_COOKIE]['auth']['user']; return true; } - - if (!empty($user)) { - $token = $this->getIapToken(); - - try { - $data = validate_jwt($token, $this->getConf('iap_expected_audience')); - $USERINFO = [ - 'name' => $data['gcip']['name'], - 'mail' => $data['gcip']['email'], - 'grps' => array_merge(explode(',',$data['gcip']['groups']), ['user']) - ]; - } catch (Exception $e) { - return false; - } + $token = $this->getIapToken(); + try { + $data = validate_jwt($token, $this->getConf('iap_expected_audience')); + $USERINFO = [ + 'name' => $data['gcip']['name'], + 'mail' => $data['gcip']['email'], + 'grps' => array_merge(explode(',',$data['gcip']['groups']), ['user']) + ]; + $_SERVER['REMOTE_USER'] = $USERINFO['name']; $_SESSION[DOKU_COOKIE]['auth']['user'] = $USERINFO['name']; $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO; - + return true; - } - - return false; + } catch (Exception $e) { + return false; + } } }