Add the possibility to define API token in config file
This commit is contained in:
@@ -23,6 +23,7 @@ New features:
|
|||||||
* Add new project role Viewer (Work in progress)
|
* Add new project role Viewer (Work in progress)
|
||||||
* Add generic LDAP client library
|
* Add generic LDAP client library
|
||||||
* Add search query attribute for task link
|
* Add search query attribute for task link
|
||||||
|
* Add the possibility to define API token in config file
|
||||||
|
|
||||||
Version 1.0.21
|
Version 1.0.21
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
@@ -60,6 +60,21 @@ class Auth extends Base
|
|||||||
*/
|
*/
|
||||||
private function isAppAuthenticated($username, $password)
|
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,4 +294,7 @@ define('API_AUTHENTICATION_HEADER', '');
|
|||||||
|
|
||||||
// Hide login form, useful if all your users use Google/Github/ReverseProxy authentication
|
// Hide login form, useful if all your users use Google/Github/ReverseProxy authentication
|
||||||
define('HIDE_LOGIN_FORM', false);
|
define('HIDE_LOGIN_FORM', false);
|
||||||
|
|
||||||
|
// Override API token stored in the database, useful for automated tests
|
||||||
|
define('API_AUTHENTICATION_TOKEN', 'My unique API Token');
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user