You are here

public function LinkedinAuthController::__construct in Social Auth LinkedIn 8

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

LinkedinLoginController constructor.

Parameters

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

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

\Drupal\social_auth_linkedin\LinkedinAuthManager $linkedin_manager: Used to manage authentication methods.

\Symfony\Component\HttpFoundation\RequestStack $request: Used to access GET parameters.

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

File

src/Controller/LinkedinAuthController.php, line 69

Class

LinkedinAuthController
Manages requests to Linkedin API.

Namespace

Drupal\social_auth_linkedin\Controller

Code

public function __construct(NetworkManager $network_manager, SocialAuthUserManager $user_manager, LinkedinAuthManager $linkedin_manager, RequestStack $request, SessionInterface $session) {
  $this->request = $request;
  $this->networkManager = $network_manager;
  $this->userManager = $user_manager;
  $this->linkedinManager = $linkedin_manager;
  $this->session = $session;

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

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