new: Add authorization header for Cortex 2 integration

pull/3106/head
iglocska 2018-03-26 17:36:58 +02:00
parent 6e7def472b
commit 4e6f57dcf3
2 changed files with 14 additions and 0 deletions

View File

@ -160,6 +160,11 @@ class Module extends AppModel {
'Content-Type' => 'application/json',
)
);
if ($moduleFamily == 'Cortex') {
if (!empty(Configure::read('Plugin.' . $moduleFamily . '_authkey'))) {
$request['header']['Authorization'] = Configure::read('Plugin.' . $moduleFamily . '_authkey');
}
}
try {
if ($post) $response = $httpSocket->post($url . $uri, $post, $request);
else $response = $httpSocket->get($url . $uri);

View File

@ -1517,6 +1517,15 @@ class Server extends AppModel {
'test' => 'testBool',
'type' => 'boolean'
),
'Cortex_authkey' => array(
'level' => 1,
'description' => 'Set an authentication key to be passed to Cortex',
'value' => '',
'errorMessage' => '',
'test' => 'testForEmpty',
'type' => 'string',
'null' => true
),
'Cortex_timeout' => array(
'level' => 1,
'description' => 'Set a timeout for the import services',