diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-09-19 13:37:11 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-09-19 15:37:29 +0200 |
| commit | 1764095f12061381345d2294fc554ccae5c55def (patch) | |
| tree | 9c40feb58953d54612e2c98f21f20b9f8d6aa281 /lib/classes/auth_plugins | |
| parent | 8493c9ef4ee03eb989d14ca928f98d13a2f985f8 (diff) | |
ensure data is present before using it in Shib auth plugin, fixes #4616
Closes #4616
Merge request studip/studip!3429
Diffstat (limited to 'lib/classes/auth_plugins')
| -rw-r--r-- | lib/classes/auth_plugins/StudipAuthShib.class.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/classes/auth_plugins/StudipAuthShib.class.php b/lib/classes/auth_plugins/StudipAuthShib.class.php index bc29c3f..67aa7a8 100644 --- a/lib/classes/auth_plugins/StudipAuthShib.class.php +++ b/lib/classes/auth_plugins/StudipAuthShib.class.php @@ -42,12 +42,14 @@ class StudipAuthShib extends StudipAuthSSO $this->userdata = json_decode($auth, true); - if ($this->username_attribute !== 'username') { - $this->userdata['username'] = $this->userdata[$this->username_attribute]; - } - if (isset($this->local_domain)) { - $this->userdata['username'] = - str_replace('@' . $this->local_domain, '', $this->userdata['username']); + if ($this->userdata) { + if ($this->username_attribute !== 'username') { + $this->userdata['username'] = $this->userdata[$this->username_attribute]; + } + if (isset($this->local_domain)) { + $this->userdata['username'] = + str_replace('@' . $this->local_domain, '', $this->userdata['username']); + } } } } |
