Bearer support.
parent
98af0fdf85
commit
cbec8ceb53
|
@ -116,6 +116,7 @@ abstract class BaseIO implements IOInterface, LoggerInterface
|
||||||
$gitlabOauth = $config->get('gitlab-oauth') ?: array();
|
$gitlabOauth = $config->get('gitlab-oauth') ?: array();
|
||||||
$gitlabToken = $config->get('gitlab-token') ?: array();
|
$gitlabToken = $config->get('gitlab-token') ?: array();
|
||||||
$httpBasic = $config->get('http-basic') ?: array();
|
$httpBasic = $config->get('http-basic') ?: array();
|
||||||
|
$bearerToken = $config->get('bearer') ?: array();
|
||||||
|
|
||||||
// reload oauth tokens from config if available
|
// reload oauth tokens from config if available
|
||||||
|
|
||||||
|
@ -143,6 +144,10 @@ abstract class BaseIO implements IOInterface, LoggerInterface
|
||||||
$this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
|
$this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($bearerToken as $domain => $token) {
|
||||||
|
$this->checkAndSetAuthentication($domain, $token, 'bearer');
|
||||||
|
}
|
||||||
|
|
||||||
// setup process timeout
|
// setup process timeout
|
||||||
ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
|
ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -835,6 +835,8 @@ class RemoteFilesystem
|
||||||
$headers[] = 'Authorization: Bearer ' . $auth['password'];
|
$headers[] = 'Authorization: Bearer ' . $auth['password'];
|
||||||
$authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
|
$authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
|
||||||
}
|
}
|
||||||
|
} elseif ($auth['password'] === 'bearer' ) {
|
||||||
|
$headers[] = 'Authorization: Bearer '.$auth['username'];
|
||||||
} else {
|
} else {
|
||||||
$authStr = base64_encode($auth['username'] . ':' . $auth['password']);
|
$authStr = base64_encode($auth['username'] . ':' . $auth['password']);
|
||||||
$headers[] = 'Authorization: Basic '.$authStr;
|
$headers[] = 'Authorization: Basic '.$authStr;
|
||||||
|
|
Loading…
Reference in New Issue