Allow email to be retrieve by SSO ReverseProxy
If REMOTE_EMAIL header is set, use it as user email. If REVERSE_PROXY_DEFAULT_DOMAIN is set but not REMOTE_EMAIL, use the current construct.
This commit is contained in:
@@ -21,6 +21,14 @@ class ReverseProxyUserProvider implements UserProviderInterface
|
||||
*/
|
||||
protected $username = '';
|
||||
|
||||
/**
|
||||
* Email
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $email = '';
|
||||
|
||||
/**
|
||||
* User profile if the user already exists
|
||||
*
|
||||
@@ -34,10 +42,12 @@ class ReverseProxyUserProvider implements UserProviderInterface
|
||||
*
|
||||
* @access public
|
||||
* @param string $username
|
||||
* @param string $email
|
||||
*/
|
||||
public function __construct($username, array $userProfile = array())
|
||||
public function __construct($username, $email, array $userProfile = array())
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->email = $email;
|
||||
$this->userProfile = $userProfile;
|
||||
}
|
||||
|
||||
@@ -134,7 +144,11 @@ class ReverseProxyUserProvider implements UserProviderInterface
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return REVERSE_PROXY_DEFAULT_DOMAIN !== '' ? $this->username.'@'.REVERSE_PROXY_DEFAULT_DOMAIN : '';
|
||||
if (REVERSE_PROXY_DEFAULT_DOMAIN !== '' && $this->email === '') {
|
||||
return $this->username.'@'.REVERSE_PROXY_DEFAULT_DOMAIN;
|
||||
}
|
||||
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user