diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-06 18:13:49 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-06 18:13:49 -0500 |
commit | 756e8697c04dc0d4ba053f81a99022273377be35 (patch) | |
tree | 2cb892dae61260d45e158185efe6a5c305da6162 /app/Api/Auth.php | |
parent | 46dfd453a9572d4d655631ef0a03dfaa42f4394d (diff) |
Add the possibility to define API token in config file
Diffstat (limited to 'app/Api/Auth.php')
-rw-r--r-- | app/Api/Auth.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/Api/Auth.php b/app/Api/Auth.php index 0a911796..a9d1617c 100644 --- a/app/Api/Auth.php +++ b/app/Api/Auth.php @@ -60,6 +60,21 @@ class Auth extends Base */ private function isAppAuthenticated($username, $password) { - return $username === 'jsonrpc' && $password === $this->config->get('api_token'); + return $username === 'jsonrpc' && $password === $this->getApiToken(); + } + + /** + * Get API Token + * + * @access private + * @return string + */ + private function getApiToken() + { + if (defined('API_AUTHENTICATION_TOKEN')) { + return API_AUTHENTICATION_TOKEN; + } + + return $this->config->get('api_token'); } } |