SessionRemoteUser.php (mrbs-1.9.4) | : | SessionRemoteUser.php (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
// $auth['type'] = 'none'; | // $auth['type'] = 'none'; | |||
// | // | |||
// If you want to display a login link, set in config.inc.php: | // If you want to display a login link, set in config.inc.php: | |||
// | // | |||
// $auth['remote_user']['login_link'] = '/login/link.html'; | // $auth['remote_user']['login_link'] = '/login/link.html'; | |||
// | // | |||
// If you want to display a logout link, set in config.inc.php: | // If you want to display a logout link, set in config.inc.php: | |||
// | // | |||
// $auth['remote_user']['logout_link'] = '/logout/link.html'; | // $auth['remote_user']['logout_link'] = '/logout/link.html'; | |||
use MRBS\User; | ||||
class SessionRemoteUser extends SessionWithLogin | class SessionRemoteUser extends SessionWithLogin | |||
{ | { | |||
// User is expected to already be authenticated by the web server, so do nothi ng | // User is expected to already be authenticated by the web server, so do nothi ng | |||
public function authGet($target_url=null, $returl=null, $error=null, $raw=fals e) | public function authGet(?string $target_url=null, ?string $returl=null, ?strin g $error=null, bool $raw=false) : void | |||
{ | { | |||
} | } | |||
public function getCurrentUser() | public function getCurrentUser() : ?User | |||
{ | { | |||
global $server; | global $server; | |||
if ((!isset($server['REMOTE_USER'])) || | if ((!isset($server['REMOTE_USER'])) || | |||
(!is_string($server['REMOTE_USER'])) || | (!is_string($server['REMOTE_USER'])) || | |||
(($server['REMOTE_USER'] === ''))) | (($server['REMOTE_USER'] === ''))) | |||
{ | { | |||
return null; | return null; | |||
} | } | |||
return \MRBS\auth()->getUser($server['REMOTE_USER']); | return \MRBS\auth()->getUser($server['REMOTE_USER']); | |||
} | } | |||
public function getLogonFormParams() | public function getLogonFormParams() : ?array | |||
{ | { | |||
global $auth; | global $auth; | |||
if (isset($auth['remote_user']['login_link'])) | if (isset($auth['remote_user']['login_link'])) | |||
{ | { | |||
return array( | return array( | |||
'action' => $auth['remote_user']['login_link'], | 'action' => $auth['remote_user']['login_link'], | |||
'method' => 'get' | 'method' => 'get' | |||
); | ); | |||
} | } | |||
else | else | |||
{ | { | |||
return null; | return null; | |||
} | } | |||
} | } | |||
public function getLogoffFormParams() | public function getLogoffFormParams() : ?array | |||
{ | { | |||
global $auth; | global $auth; | |||
if (isset($auth['remote_user']['logout_link'])) | if (isset($auth['remote_user']['logout_link'])) | |||
{ | { | |||
return array( | return array( | |||
'action' => $auth['remote_user']['logout_link'], | 'action' => $auth['remote_user']['logout_link'], | |||
'method' => 'get' | 'method' => 'get' | |||
); | ); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added |