Skip to content

Commit

Permalink
Only use auth headers or cookies
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and skjnldsv committed Jan 19, 2022
1 parent d45f8c7 commit 16052db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions build/integration/features/bootstrap/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private function sendRequest($url, $method, $authHeader = null, $useCookies = fa
} else {
$options = [];
}
if ($authHeader) {
if ($authHeader && !$useCookies) {
$options['headers'] = [
'Authorization' => $authHeader
];
Expand Down Expand Up @@ -111,6 +111,11 @@ private function createClientToken($loginViaWeb = true) {
'cookies' => $this->cookieJar,
];

if ($loginViaWeb) {
// Session cookies are used instead
unset($options['auth']);
}

try {
$this->response = $client->request('POST', $fullUrl, $options);
} catch (\GuzzleHttp\Exception\ServerException $e) {
Expand Down Expand Up @@ -138,7 +143,6 @@ public function aNewRestrictedClientTokenIsAdded() {
'filesystem' => false,
],
],
'cookies' => $this->cookieJar,
];
$this->response = $client->request('PUT', $fullUrl, $options);
$this->restrictedClientToken = $tokenObj->token;
Expand Down

0 comments on commit 16052db

Please sign in to comment.