Skip to content

Commit

Permalink
+ Basic authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrajina committed Sep 25, 2012
1 parent 985a2a2 commit c5d3fa3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions oneapi/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ private function executeRequest(
$sendHeaders[] = $key . ': ' . $value;
}

if($this->oneApiAuthentication && $this->oneApiAuthentication->ibssoToken)
$sendHeaders[] = 'Authorization: IBSSO ' . $this->oneApiAuthentication->ibssoToken;

if($httpMethod === 'GET') {
if(sizeof($queryParams) > 0)
$url .= '?' . $this->buildQuery($queryParams);
Expand All @@ -204,6 +201,14 @@ private function executeRequest(
CURLOPT_HTTPHEADER => $sendHeaders,
);

if($this->oneApiAuthentication && $this->oneApiAuthentication->ibssoToken) {
// Token based authentication (one request per login request):
$opts[CURLOPT_HTTPHEADER][] = 'Authorization: IBSSO ' . $this->oneApiAuthentication->ibssoToken;
} else {
// Basic authorization:
$opts[CURLOPT_USERPWD] = $this->username . ':' . $this->password;
}

Logs::debug('Executing ', $httpMethod, ' to ', $url);

if (sizeof($queryParams) > 0 && ($httpMethod == 'POST' || $httpMethod == 'PUT')) {
Expand Down

0 comments on commit c5d3fa3

Please sign in to comment.