public function Anonymous::getClient in Entity Share 8.3
Prepares a guzzle client for http operations with the supported auth.
Parameters
string $url: The url to set in the client.
Return value
\GuzzleHttp\Client The HTTP client.
Overrides ClientAuthorizationInterface::getClient
File
- modules/
entity_share_client/ src/ Plugin/ ClientAuthorization/ Anonymous.php, line 30
Class
- Anonymous
- Provides Anonymous authorization.
Namespace
Drupal\entity_share_client\Plugin\ClientAuthorizationCode
public function getClient($url) {
$options = [
'base_uri' => $url . '/',
'cookies' => TRUE,
'allow_redirects' => TRUE,
];
$credentials = $this->keyService
->getCredentials($this);
if (!empty($credentials['username']) && !empty($credentials['password'])) {
$options['auth'] = [
$credentials['username'],
$credentials['password'],
];
}
return $this->httpClientFactory
->fromOptions($options);
}