From 756e8697c04dc0d4ba053f81a99022273377be35 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 6 Dec 2015 18:13:49 -0500 Subject: Add the possibility to define API token in config file --- app/Api/Auth.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'app/Api') 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'); } } -- cgit v1.2.3