| <?php |
|
|
| namespace Kanboard\Auth; |
|
|
| use Kanboard\Core\Base; |
| use Kanboard\Core\Security\PreAuthenticationProviderInterface; |
| use Kanboard\Core\Security\SessionCheckProviderInterface; |
| use Kanboard\User\ReverseProxyUserProvider; |
|
|
| |
| |
| |
| |
| |
| |
| class ReverseProxyAuth extends Base implements PreAuthenticationProviderInterface, SessionCheckProviderInterface |
| { |
| |
| |
| |
| |
| |
| |
| protected $userInfo = null; |
|
|
| |
| |
| |
| |
| |
| |
| public function getName() |
| { |
| return 'ReverseProxy'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function authenticate() |
| { |
| $username = $this->request->getRemoteUser(); |
| $email = $this->request->getRemoteEmail(); |
| $fullname = $this->request->getRemoteName(); |
|
|
| if (! empty($username)) { |
| $userProfile = $this->userCacheDecorator->getByUsername($username); |
| $this->userInfo = new ReverseProxyUserProvider($username, $email, $fullname, $userProfile ?: array()); |
| return true; |
| } |
|
|
| return false; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function isValidSession() |
| { |
| return $this->request->getRemoteUser() === $this->userSession->getUsername(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getUser() |
| { |
| return $this->userInfo; |
| } |
| } |
|
|