abstract class Base in DRD Agent 4.0.x
Same name in this branch
- 4.0.x src/Crypt/Base.php \Drupal\drd_agent\Crypt\Base
- 4.0.x src/Agent/Action/Base.php \Drupal\drd_agent\Agent\Action\Base
- 4.0.x src/Agent/Remote/Base.php \Drupal\drd_agent\Agent\Remote\Base
- 4.0.x src/Agent/Auth/Base.php \Drupal\drd_agent\Agent\Auth\Base
Same name and namespace in other branches
- 8.3 src/Agent/Auth/Base.php \Drupal\drd_agent\Agent\Auth\Base
Base class for Remote DRD Auth Methods.
Hierarchy
- class \Drupal\drd_agent\Agent\Auth\Base implements BaseInterface
Expanded class hierarchy of Base
File
- src/
Agent/ Auth/ Base.php, line 14
Namespace
Drupal\drd_agent\Agent\AuthView source
abstract class Base implements BaseInterface {
/**
* All the settings of the implementing authentication method.
*
* @var array
*/
protected $storedSettings;
/**
* @var \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* @var \Drupal\user\UserAuthInterface
*/
protected $userAuth;
/**
* Base constructor.
*
* @param \Drupal\Core\Session\AccountInterface $current_User
* @param \Drupal\Core\State\StateInterface $state
* @param \Drupal\user\UserAuthInterface $user_auth
*/
public function __construct(AccountInterface $current_User, StateInterface $state, UserAuthInterface $user_auth) {
$this->currentUser = $current_User;
$this->state = $state;
$this->userAuth = $user_auth;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('current_user'), $container
->get('state'), $container
->get('user.auth'));
}
/**
* {@inheritdoc}
*/
public static function getMethods(ContainerInterface $container) : array {
$methods = array(
'username_password' => 'UsernamePassword',
'shared_secret' => 'SharedSecret',
);
foreach ($methods as $key => $class) {
$classname = "\\Drupal\\drd_agent\\Agent\\Auth\\{$class}";
/** @noinspection PhpUndefinedMethodInspection */
$methods[$key] = $classname::create($container);
}
return $methods;
}
/**
* {@inheritdoc}
*/
public final function validateUuid($uuid) : bool {
$authorised = $this->state
->get('drd_agent.authorised', []);
if (empty($authorised[$uuid])) {
return FALSE;
}
$this->storedSettings = (array) $authorised[$uuid]['authsetting'];
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | All the settings of the implementing authentication method. | |
Base:: |
protected | property | ||
Base:: |
public static | function | ||
Base:: |
public static | function |
Get a list of all implemented authentication methods. Overrides BaseInterface:: |
|
Base:: |
final public | function |
Verify if the given UUID is authorised to access this site. Overrides BaseInterface:: |
|
Base:: |
public | function | Base constructor. | |
BaseInterface:: |
public | function | Validate authentication of the current request with the given settings. | 2 |