class OpenIDConnectAutoDiscover in OpenID Connect / OAuth client 2.x
OpenID Connect well-known URI discovery service.
Hierarchy
- class \Drupal\openid_connect\OpenIDConnectAutoDiscover
Expanded class hierarchy of OpenIDConnectAutoDiscover
1 file declares its use of OpenIDConnectAutoDiscover
- OpenIDConnectClientBase.php in src/
Plugin/ OpenIDConnectClientBase.php
1 string reference to 'OpenIDConnectAutoDiscover'
1 service uses OpenIDConnectAutoDiscover
File
- src/
OpenIDConnectAutoDiscover.php, line 13
Namespace
Drupal\openid_connectView source
class OpenIDConnectAutoDiscover {
/**
* The Guzzle client object.
*
* @var \Drupal\Core\Http\ClientFactory
*/
protected $client;
/**
* The logger factory.
*
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $logger;
/**
* Constructs an OpenIDConnectAutoDiscover object.
*
* @param \Drupal\Core\Http\ClientFactory $http_client_factory
* A Guzzle client object.
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
* The logger factory service.
*/
public function __construct(ClientFactory $http_client_factory, LoggerChannelFactoryInterface $logger_factory) {
$this->client = $http_client_factory;
$this->logger = $logger_factory
->get('openid_connect');
}
/**
* Returns request response.
*
* @param string $base_url
* The well-known configuration base URL.
* @param string $path
* The relative path of the well-known configuration.
*
* @return array|bool
* A result array or FALSE.
*/
public function fetch(string $base_url, string $path = '.well-known/openid-configuration') {
try {
$response = $this->client
->fromOptions([
'base_uri' => $base_url,
])
->get($path);
return Json::decode($response
->getBody());
} catch (RequestException $e) {
$this->logger
->warning('The auto discover URL %url seems to be broken because of error "%error".', [
'%url' => $base_url,
'%error' => $e
->getMessage(),
]);
return FALSE;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenIDConnectAutoDiscover:: |
protected | property | The Guzzle client object. | |
OpenIDConnectAutoDiscover:: |
protected | property | The logger factory. | |
OpenIDConnectAutoDiscover:: |
public | function | Returns request response. | |
OpenIDConnectAutoDiscover:: |
public | function | Constructs an OpenIDConnectAutoDiscover object. |