You are here

class HttpClientBasicAuth in Http Client 7.2

Hierarchy

Expanded class hierarchy of HttpClientBasicAuth

File

includes/auth/basic/HttpClientBasicAuth.inc, line 3

View source
class HttpClientBasicAuth implements HttpClientAuthentication {
  function __construct($username, $password = NULL) {
    $this->username = $username;
    $this->password = $password;
  }
  public function authenticate($request) {

    // Some API require only API-key with empty password.
    $request->options['curlopts'][CURLOPT_USERPWD] = !empty($this->password) ? "{$this->username}:{$this->password}" : $this->username;
  }

}

Members