Skip to content
Snippets Groups Projects
Commit d3cc6944 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

prevent php-warnings, closes #3220

Closes #3220

Merge request studip/studip!2182
parent e2792ee8
No related branches found
No related tags found
No related merge requests found
...@@ -93,21 +93,22 @@ class StudipAuthShib extends StudipAuthSSO ...@@ -93,21 +93,22 @@ class StudipAuthShib extends StudipAuthSSO
return $this->getUser(); return $this->getUser();
} }
$remote_user = $_SERVER[$this->env_remote_user]; $remote_user = $_SERVER[$this->env_remote_user] ?? $_SERVER['REMOTE_USER'] ?? '';
if (empty($remote_user)) {
$remote_user = $_SERVER['REMOTE_USER'];
}
if (empty($remote_user) || isset($this->validate_url)) { if (empty($remote_user) || isset($this->validate_url)) {
if (Request::get('sso') === $this->plugin_name) { if (Request::get('sso') === $this->plugin_name) {
// force Shibboleth authentication (lazy session) // force Shibboleth authentication (lazy session)
$shib_url = $this->session_initiator; $shib_url = URLHelper::getURL(
$shib_url .= strpos($shib_url, '?') === false ? '?' : '&'; $this->session_initiator,
$shib_url .= 'target=' . urlencode($this->getURL()); ['target' => $this->getURL()],
true
);
// break redirection loop in case of misconfiguration // break redirection loop in case of misconfiguration
if (strstr($_SERVER['HTTP_REFERER'], 'target=') === false) { if (
isset($_SERVER['HTTP_REFERER'])
&& !str_contains($_SERVER['HTTP_REFERER'], 'target=')
) {
header('Location: ' . $shib_url); header('Location: ' . $shib_url);
echo '<html></html>'; echo '<html></html>';
exit(); exit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment