Get remote user from $_SERVER if env does not have it in external auth

refs #11391
This commit is contained in:
Eric Lippmann 2016-04-11 14:07:44 +02:00
parent 2ac54d7c3e
commit 99d08bf03b
2 changed files with 5 additions and 5 deletions

View File

@ -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();
}
}

View File

@ -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) {