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; + } } }