class JwtAuthValidEvent in JSON Web Token Authentication (JWT) 8.0
Same name and namespace in other branches
- 8 src/Authentication/Event/JwtAuthValidEvent.php \Drupal\jwt\Authentication\Event\JwtAuthValidEvent
Class JwtAuthValidEvent.
@package Drupal\jwt\Authentication\Provider
Hierarchy
- class \Drupal\jwt\Authentication\Event\JwtAuthBaseEvent extends \Symfony\Component\EventDispatcher\Event
- class \Drupal\jwt\Authentication\Event\JwtAuthValidEvent
Expanded class hierarchy of JwtAuthValidEvent
2 files declare their use of JwtAuthValidEvent
- JwtAuth.php in src/
Authentication/ Provider/ JwtAuth.php - JwtAuthConsumerSubscriber.php in modules/
jwt_auth_consumer/ src/ EventSubscriber/ JwtAuthConsumerSubscriber.php
File
- src/
Authentication/ Event/ JwtAuthValidEvent.php, line 14
Namespace
Drupal\jwt\Authentication\EventView source
class JwtAuthValidEvent extends JwtAuthBaseEvent {
/**
* Variable holding the user authenticated by the token in the payload.
*
* @var \Drupal\user\UserInterface
*/
protected $user;
/**
* {@inheritdoc}
*/
public function __construct(JsonWebTokenInterface $token) {
$this->user = User::getAnonymousUser();
parent::__construct($token);
}
/**
* Sets the authenticated user that will be used for this request.
*
* @param \Drupal\user\UserInterface $user
* A loaded user object.
*/
public function setUser(UserInterface $user) {
$this->user = $user;
}
/**
* Returns a loaded user to use if the token is validated.
*
* @return \Drupal\user\UserInterface
* A loaded user object
*/
public function getUser() {
return $this->user;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JwtAuthBaseEvent:: |
protected | property | The JsonWebToken. | |
JwtAuthBaseEvent:: |
public | function | Returns the JWT. | |
JwtAuthValidEvent:: |
protected | property | Variable holding the user authenticated by the token in the payload. | |
JwtAuthValidEvent:: |
public | function | Returns a loaded user to use if the token is validated. | |
JwtAuthValidEvent:: |
public | function | Sets the authenticated user that will be used for this request. | |
JwtAuthValidEvent:: |
public | function |
Constructs a JwtAuthEvent with a JsonWebToken. Overrides JwtAuthBaseEvent:: |