class HttpClientBasicAuth in Http Client 7.2
Hierarchy
- class \HttpClientBasicAuth implements HttpClientAuthentication
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HttpClientBasicAuth:: |
public | function |
Used by the HttpClient to authenticate requests. Overrides HttpClientAuthentication:: |
|
HttpClientBasicAuth:: |
function |