Get remote user from $_SERVER if env does not have it in external auth
refs #11391
This commit is contained in:
parent
2ac54d7c3e
commit
99d08bf03b
|
@ -240,10 +240,10 @@ class Auth
|
|||
public function authenticateFromSession()
|
||||
{
|
||||
$this->user = Session::getSession()->get('user');
|
||||
if ($this->user !== null && $this->user->isExternalUser() === true) {
|
||||
if ($this->user !== null && $this->user->isExternalUser()) {
|
||||
list($originUsername, $field) = $this->user->getExternalUserInformation();
|
||||
$username = getenv($field); // usually REMOTE_USER here
|
||||
if ( !$username || $username !== $originUsername) {
|
||||
$username = ExternalBackend::getRemoteUser($field);
|
||||
if ($username === null || $username !== $originUsername) {
|
||||
$this->removeAuthorization();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ class ExternalBackend implements UserBackendInterface
|
|||
*/
|
||||
public function authenticate(User $user, $password = null)
|
||||
{
|
||||
$username = getenv('REMOTE_USER');
|
||||
if ($username !== false) {
|
||||
$username = static::getRemoteUser();
|
||||
if ($username !== null) {
|
||||
$user->setExternalUserInformation($username, 'REMOTE_USER');
|
||||
|
||||
if ($this->stripUsernameRegexp) {
|
||||
|
|
Loading…
Reference in New Issue