Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-08-17 13:23:56 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2018-08-17 13:23:56 +0300
commita7216adb43c8242b64863cb072d861f21ddcfb54 (patch)
treed49b9735218a11460b86636c8c17e60504274df1 /core/Session/SessionAuth.php
parent7b584f9a788fd044d886c18d699d0bf778c63e6b (diff)
Always set Auth interface in DI to the correct plugin's Auth implementation (#13279)
* Make sure Auth interface is always set even if session auth succeeds. * Add failing test. * Fix FrontControllerTest * Put hash token authentication back since it is still in use in plugins.
Diffstat (limited to 'core/Session/SessionAuth.php')
-rw-r--r--core/Session/SessionAuth.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/Session/SessionAuth.php b/core/Session/SessionAuth.php
index 9a0c47f258..0c23f13cc2 100644
--- a/core/Session/SessionAuth.php
+++ b/core/Session/SessionAuth.php
@@ -34,6 +34,13 @@ class SessionAuth implements Auth
*/
private $userModel;
+ /**
+ * Set internally so it can be queried in FrontController.
+ *
+ * @var string
+ */
+ private $user;
+
public function __construct(UsersModel $userModel = null, $shouldDestroySession = true)
{
$this->userModel = $userModel ?: new UsersModel();
@@ -52,7 +59,7 @@ class SessionAuth implements Auth
public function getLogin()
{
- // empty
+ return $this->user['login'];
}
public function getTokenAuthSecret()
@@ -129,7 +136,7 @@ class SessionAuth implements Auth
private function makeAuthSuccess($user)
{
- $this->setTokenAuth($user['token_auth']);
+ $this->user = $user;
$isSuperUser = (int) $user['superuser_access'];
$code = $isSuperUser ? AuthResult::SUCCESS_SUPERUSER_AUTH_CODE : AuthResult::SUCCESS;
@@ -165,4 +172,9 @@ class SessionAuth implements Auth
Session::regenerateId();
}
}
+
+ public function getTokenAuth()
+ {
+ return $this->user['token_auth'];
+ }
}