lib: Rename remote user to external user
We renamed our backend. Code now reflects this. refs #9660
This commit is contained in:
parent
257a9f9d1d
commit
1b5c5deace
|
@ -52,9 +52,11 @@ class AuthenticationController extends Controller
|
|||
if (! $auth->isAuthenticated()) {
|
||||
$this->redirectToLogin();
|
||||
}
|
||||
$isRemoteUser = $auth->getUser()->isRemoteUser();
|
||||
// Get info whether the user is externally authenticated before removing authorization which destroys the
|
||||
// session and the user object
|
||||
$isExternalUser = $auth->getUser()->isExternalUser();
|
||||
$auth->removeAuthorization();
|
||||
if ($isRemoteUser === true) {
|
||||
if ($isExternalUser) {
|
||||
$this->getResponse()->setHttpResponseCode(401);
|
||||
} else {
|
||||
$this->redirectToLogin();
|
||||
|
|
|
@ -147,8 +147,8 @@ class Auth
|
|||
public function authenticateFromSession()
|
||||
{
|
||||
$this->user = Session::getSession()->get('user');
|
||||
if ($this->user !== null && $this->user->isRemoteUser() === true) {
|
||||
list($originUsername, $field) = $this->user->getRemoteUserInformation();
|
||||
if ($this->user !== null && $this->user->isExternalUser() === true) {
|
||||
list($originUsername, $field) = $this->user->getExternalUserInformation();
|
||||
if (! array_key_exists($field, $_SERVER) || $_SERVER[$field] !== $originUsername) {
|
||||
$this->removeAuthorization();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class ExternalBackend implements UserBackendInterface
|
|||
{
|
||||
if (isset($_SERVER['REMOTE_USER'])) {
|
||||
$username = $_SERVER['REMOTE_USER'];
|
||||
$user->setRemoteUserInformation($username, 'REMOTE_USER');
|
||||
$user->setExternalUserInformation($username, 'REMOTE_USER');
|
||||
|
||||
if ($this->stripUsernameRegexp) {
|
||||
$stripped = preg_replace($this->stripUsernameRegexp, '', $username);
|
||||
|
|
|
@ -66,7 +66,7 @@ class User
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $remoteUserInformation = array();
|
||||
protected $externalUserInformation = array();
|
||||
|
||||
/**
|
||||
* Set of permissions
|
||||
|
@ -380,34 +380,34 @@ class User
|
|||
}
|
||||
|
||||
/**
|
||||
* Set additional remote user information
|
||||
* Set additional external user information
|
||||
*
|
||||
* @param stirng $username
|
||||
* @param string $field
|
||||
*/
|
||||
public function setRemoteUserInformation($username, $field)
|
||||
public function setExternalUserInformation($username, $field)
|
||||
{
|
||||
$this->remoteUserInformation = array($username, $field);
|
||||
$this->externalUserInformation = array($username, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get additional remote user information
|
||||
* Get additional external user information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRemoteUserInformation()
|
||||
public function getExternalUserInformation()
|
||||
{
|
||||
return $this->remoteUserInformation;
|
||||
return $this->externalUserInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if user has remote user information set
|
||||
* Return true if user has external user information set
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRemoteUser()
|
||||
public function isExternalUser()
|
||||
{
|
||||
return ! empty($this->remoteUserInformation);
|
||||
return ! empty($this->externalUserInformation);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue