abstract class AuthManager in Open Social 8.4
Same name and namespace in other branches
- 8.9 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.2 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.3 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.5 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.6 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.7 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
- 8.8 modules/custom/social_auth_extra/src/AuthManager.php \Drupal\social_auth_extra\AuthManager
Class AuthManager.
@package Drupal\social_auth_extra
Hierarchy
- class \Drupal\social_auth_extra\AuthManager implements AuthManagerInterface
Expanded class hierarchy of AuthManager
4 files declare their use of AuthManager
- FacebookAuthManager.php in modules/
custom/ social_auth_facebook/ src/ FacebookAuthManager.php - GoogleAuthManager.php in modules/
custom/ social_auth_google/ src/ GoogleAuthManager.php - LinkedInAuthManager.php in modules/
custom/ social_auth_linkedin/ src/ LinkedInAuthManager.php - TwitterAuthManager.php in modules/
custom/ social_auth_twitter/ src/ TwitterAuthManager.php
File
- modules/
custom/ social_auth_extra/ src/ AuthManager.php, line 15
Namespace
Drupal\social_auth_extraView source
abstract class AuthManager implements AuthManagerInterface {
protected $urlGenerator;
protected $entityFieldManager;
protected $loggerFactory;
/**
* Object of SDK to work with API of social network.
*
* @var object
*/
protected $sdk;
/**
* Contains object of a profile received from a social network.
*
* @var mixed
*/
protected $profile;
/**
* Contains the field definition with a profile picture.
*
* @var \Drupal\Core\Field\FieldDefinitionInterface
*/
protected $fieldPicture;
/**
* AuthManager constructor.
*/
public function __construct(UrlGeneratorInterface $urlGenerator, EntityFieldManagerInterface $entity_field_manager, LoggerChannelFactoryInterface $logger_factory) {
$this->urlGenerator = $urlGenerator;
$this->entityFieldManager = $entity_field_manager;
$this->loggerFactory = $logger_factory;
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl($type) {
$key = $this
->getSocialNetworkKey();
return $this->urlGenerator
->generateFromRoute("social_auth_{$key}.user_{$type}_callback", [], [
'absolute' => TRUE,
]);
}
/**
* {@inheritdoc}
*/
public function getPreferredResolution() {
// Check whether field is exists.
if (!$this->fieldPicture instanceof FieldDefinitionInterface) {
return FALSE;
}
$max_resolution = $this->fieldPicture
->getSetting('max_resolution');
$min_resolution = $this->fieldPicture
->getSetting('min_resolution');
// Return order: max resolution, min resolution, FALSE.
if ($max_resolution) {
$resolution = $max_resolution;
}
elseif ($min_resolution) {
$resolution = $min_resolution;
}
else {
return FALSE;
}
$dimensions = explode('x', $resolution);
return array_combine([
'width',
'height',
], $dimensions);
}
/**
* {@inheritdoc}
*/
public function getUsername() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function setFieldPicture(FieldDefinitionInterface $field) {
$this->fieldPicture = $field;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AuthManager:: |
protected | property | ||
AuthManager:: |
protected | property | Contains the field definition with a profile picture. | |
AuthManager:: |
protected | property | ||
AuthManager:: |
protected | property | Contains object of a profile received from a social network. | |
AuthManager:: |
protected | property | Object of SDK to work with API of social network. | |
AuthManager:: |
protected | property | ||
AuthManager:: |
public | function |
Determines preferred profile pic resolution from account settings. Overrides AuthManagerInterface:: |
|
AuthManager:: |
public | function |
Returns URL to authorize/registration depending on type. Overrides AuthManagerInterface:: |
|
AuthManager:: |
public | function |
Returns user on a social network if it possible. Overrides AuthManagerInterface:: |
1 |
AuthManager:: |
public | function |
Set an instance of a field definition that contains picture. Overrides AuthManagerInterface:: |
|
AuthManager:: |
public | function | AuthManager constructor. | |
AuthManagerInterface:: |
public | function | Reads user's access token from social network. | 4 |
AuthManagerInterface:: |
public | function | Returns an account ID on a social network. | 4 |
AuthManagerInterface:: |
public | function | Returns the login URL where user will be redirected for authentication. | 4 |
AuthManagerInterface:: |
public | function | Returns first name on a social network if it possible. | 4 |
AuthManagerInterface:: |
public | function | Returns last name on a social network if it possible. | 4 |
AuthManagerInterface:: |
public | function | Returns object of a user profile. | 4 |
AuthManagerInterface:: |
public | function | Returns URL of a profile picture. | 4 |
AuthManagerInterface:: |
public | function | Returns key-name of a social network. | 4 |
AuthManagerInterface:: |
public | function | Set access token to AuthManager to use it for API calls. | 4 |
AuthManagerInterface:: |
public | function | Set instance of SDK. | 4 |