You are here

public function GoogleAuthController::__construct in Social Auth Google 8

Same name and namespace in other branches
  1. 8.2 src/Controller/GoogleAuthController.php \Drupal\social_auth_google\Controller\GoogleAuthController::__construct()
  2. 3.x src/Controller/GoogleAuthController.php \Drupal\social_auth_google\Controller\GoogleAuthController::__construct()

GoogleLoginController constructor.

Parameters

\Drupal\social_api\Plugin\NetworkManager $network_manager: Used to get an instance of social_auth_google network plugin.

\Drupal\social_auth\SocialAuthUserManager $user_manager: Manages user login/registration.

\Drupal\social_auth_google\GoogleAuthManager $google_manager: Used to manage authentication methods.

\Symfony\Component\HttpFoundation\Session\SessionInterface $session: Used to store the access token into a session variable.

File

src/Controller/GoogleAuthController.php, line 58

Class

GoogleAuthController
Manages requests to Google API.

Namespace

Drupal\social_auth_google\Controller

Code

public function __construct(NetworkManager $network_manager, SocialAuthUserManager $user_manager, GoogleAuthManager $google_manager, SessionInterface $session) {
  $this->networkManager = $network_manager;
  $this->userManager = $user_manager;
  $this->googleManager = $google_manager;
  $this->session = $session;

  // Sets the plugin id.
  $this->userManager
    ->setPluginId('social_auth_google');

  // Sets the session keys to nullify if user could not logged in.
  $this->userManager
    ->setSessionKeysToNullify([
    'social_auth_google_access_token',
  ]);
}