You are here

public function ServicesClientConnectionBasicAuth::prepareRequest in Services Client 7.2

Same name and namespace in other branches
  1. 7 services_client_connection/plugins/ServicesClientConnectionBasicAuth.inc \ServicesClientConnectionBasicAuth::prepareRequest()

Implements prepareRequest().

Parameters

ServicesClientConnectionHttpRequest $request:

Overrides ServicesClientConnectionPlugin::prepareRequest

File

services_client_connection/plugins/ServicesClientConnectionBasicAuth.inc, line 42
Session authentication for 3.x version

Class

ServicesClientConnectionBasicAuth
@file Session authentication for 3.x version

Code

public function prepareRequest(ServicesClientConnectionHttpRequest &$request) {
  parent::prepareRequest($request);
  $credentials = $this->config['username'] . ':' . $this->config['password'];
  $credentials = base64_encode($credentials);
  $request->http_headers['Authorization'] = 'Basic ' . $credentials;
}