You are here

public static function OauthResponse::create in OAuth2 Client 8.3

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ControllerBase::create

File

src/Controller/OauthResponse.php, line 53

Class

OauthResponse
Controller to process an authorization code request.

Namespace

Drupal\oauth2_client\Controller

Code

public static function create(ContainerInterface $container) {
  $instance = parent::create($container);
  $instance->grantService = $container
    ->get('oauth2_client.service.grant.authorization_code');
  $instance->messenger = $container
    ->get('messenger');
  $instance->routeMatch = $container
    ->get('current_route_match');
  $requestStack = $container
    ->get('request_stack');
  $instance->currentRequest = $requestStack
    ->getCurrentRequest();
  $instance->tempstore = $container
    ->get('tempstore.private')
    ->get('oauth2_client');
  return $instance;
}