abstract class OAuth2Manager in Social Auth 8.2
Same name and namespace in other branches
- 8 src/AuthManager/OAuth2Manager.php \Drupal\social_auth\AuthManager\OAuth2Manager
- 3.x src/AuthManager/OAuth2Manager.php \Drupal\social_auth\AuthManager\OAuth2Manager
Defines a basic OAuth2Manager.
@package Drupal\social_auth
Hierarchy
- class \Drupal\social_api\AuthManager\OAuth2Manager implements OAuth2ManagerInterface
- class \Drupal\social_auth\AuthManager\OAuth2Manager implements OAuth2ManagerInterface
Expanded class hierarchy of OAuth2Manager
File
- src/
AuthManager/ OAuth2Manager.php, line 12
Namespace
Drupal\social_auth\AuthManagerView source
abstract class OAuth2Manager extends BaseOAuth2Manager implements OAuth2ManagerInterface {
/**
* The scopes to be requested.
*
* @var string|null
*/
protected $scopes;
/**
* The end points to be requested.
*
* @var string|null
*/
protected $endPoints;
/**
* The user returned by the provider.
*
* @var \League\OAuth2\Client\Provider\GenericResourceOwner|array|mixed
*/
protected $user;
/**
* {@inheritdoc}
*/
public function getExtraDetails($method = 'GET', $domain = NULL) {
$endpoints = $this
->getEndPoints();
// Stores the data mapped with endpoints define in settings.
$data = [];
if ($endpoints) {
// Iterates through endpoints define in settings and retrieves them.
foreach (explode(PHP_EOL, $endpoints) as $endpoint) {
// Endpoint is set as path/to/endpoint|name.
$parts = explode('|', $endpoint);
$data[$parts[1]] = $this
->requestEndPoint($method, $parts[0], $domain);
}
return $data;
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function getScopes() {
if ($this->scopes === NULL) {
$this->scopes = $this->settings
->get('scopes');
}
return $this->scopes;
}
/**
* {@inheritdoc}
*/
public function getEndPoints() {
if ($this->endPoints === NULL) {
$this->endPoints = $this->settings
->get('endpoints');
}
return $this->endPoints;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OAuth2Manager:: |
protected | property | Access token for OAuth2 authentication. | |
OAuth2Manager:: |
protected | property | The service client. | |
OAuth2Manager:: |
protected | property | The end points to be requested. | |
OAuth2Manager:: |
protected | property | The logger factory. | |
OAuth2Manager:: |
protected | property | The current request. | |
OAuth2Manager:: |
protected | property | The scopes to be requested. | |
OAuth2Manager:: |
protected | property | Social Auth implementer settings. | |
OAuth2Manager:: |
protected | property |
The user returned by the provider. Overrides OAuth2Manager:: |
|
OAuth2Manager:: |
public | function |
Gets the access token after authentication. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Gets the service client object. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Gets the API endpoints to be requested. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Request data from the declared endpoints. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Gets the scopes defined in the settings form. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Sets the access token. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function |
Sets the provider client. Overrides OAuth2ManagerInterface:: |
|
OAuth2Manager:: |
public | function | OAuth2Manager Constructor. | |
OAuth2ManagerInterface:: |
public | function | Authenticates the user. | |
OAuth2ManagerInterface:: |
public | function | Returns the authorization URL where user will be redirected. | |
OAuth2ManagerInterface:: |
public | function | Returns OAuth2 state. | |
OAuth2ManagerInterface:: |
public | function | Gets data about the user. | |
OAuth2ManagerInterface:: |
public | function | Request and end point. |