Commit e40c4f02 authored by Jose Juan Calvo's avatar Jose Juan Calvo Committed by Markus Kalkbrenner

Basic authentication not working for Extract using HTTP Client #605 (#608)

parent 54c3b82d
......@@ -73,6 +73,18 @@ class Http extends Configurable implements AdapterInterface
]
);
// Try endpoint authentication first, fallback to request for backwards compatibility
$authData = $endpoint->getAuthentication();
if (empty($authData['username'])) {
$authData = $request->getAuthentication();
}
if (!empty($authData['username']) && !empty($authData['password'])) {
$request->addHeader(
'Authorization: Basic '.base64_encode($authData['username'].':'.$authData['password'])
);
}
if (Request::METHOD_POST == $method) {
if ($request->getFileUpload()) {
$boundary = '----------'.md5(time());
......@@ -114,18 +126,6 @@ class Http extends Configurable implements AdapterInterface
}
}
// Try endpoint authentication first, fallback to request for backwards compatibility
$authData = $endpoint->getAuthentication();
if (empty($authData['username'])) {
$authData = $request->getAuthentication();
}
if (!empty($authData['username']) && !empty($authData['password'])) {
$request->addHeader(
'Authorization: Basic '.base64_encode($authData['username'].':'.$authData['password'])
);
}
$headers = $request->getHeaders();
if (count($headers) > 0) {
stream_context_set_option(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment