aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-09-19 13:37:11 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-09-19 13:37:11 +0000
commit0f9838cee5c76b254e9be10b5e0de6ec4dc58029 (patch)
tree4c4cf8361c16f880f35de08e501f1bc51af939ed /lib
parente94126b188036d7258933ee536a1fbd2be04612f (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')
-rw-r--r--lib/classes/auth_plugins/StudipAuthShib.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/classes/auth_plugins/StudipAuthShib.php b/lib/classes/auth_plugins/StudipAuthShib.php
index 5548e92..f18f0c1 100644
--- a/lib/classes/auth_plugins/StudipAuthShib.php
+++ b/lib/classes/auth_plugins/StudipAuthShib.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']);
+ }
}
}
}