class Jwks in Simple OAuth (OAuth2) & OpenID Connect 5.x
Controller for the User Info endpoint.
Hierarchy
- class \Drupal\simple_oauth\Controller\Jwks implements ContainerInjectionInterface
Expanded class hierarchy of Jwks
File
- src/
Controller/ Jwks.php, line 18
Namespace
Drupal\simple_oauth\ControllerView source
class Jwks implements ContainerInjectionInterface {
/**
* The authenticated user.
*
* @var \Drupal\Core\Session\AccountInterface
*/
private $user;
/**
* The configuration object.
*
* @var \Drupal\Core\Config\ImmutableConfig
*/
private $config;
/**
* Jwks constructor.
*
* @param \Drupal\Core\Session\AccountProxyInterface $user
* The user.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
*/
private function __construct(AccountProxyInterface $user, ConfigFactoryInterface $config_factory) {
$this->user = $user
->getAccount();
$this->config = $config_factory
->get('simple_oauth.settings');
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('current_user'), $container
->get('config.factory'));
}
/**
* The controller.
*
* @return \Symfony\Component\HttpFoundation\Response
* The response.
*/
public function handle() {
if (!$this->user instanceof TokenAuthUser) {
throw new AccessDeniedHttpException('This route is only available for authenticated requests using OAuth2.');
}
if ($this->config
->get('disable_openid_connect')) {
throw new NotFoundHttpException('Not Found');
}
return JsonResponse::create((new JwksEntity())
->getKeys());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Jwks:: |
private | property | The configuration object. | |
Jwks:: |
private | property | The authenticated user. | |
Jwks:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Jwks:: |
public | function | The controller. | |
Jwks:: |
private | function | Jwks constructor. |