You are here

public function SamlController::login in SAML Authentication 8.2

Same name and namespace in other branches
  1. 8.3 src/Controller/SamlController.php \Drupal\samlauth\Controller\SamlController::login()
  2. 8 src/Controller/SamlController.php \Drupal\samlauth\Controller\SamlController::login()
  3. 4.x src/Controller/SamlController.php \Drupal\samlauth\Controller\SamlController::login()

Initiates a SAML2 authentication flow.

This should redirect to the Login service on the IDP and then to our ACS. It does not actually log us in (yet).

1 string reference to 'SamlController::login'
samlauth.routing.yml in ./samlauth.routing.yml
samlauth.routing.yml

File

src/Controller/SamlController.php, line 106

Class

SamlController
Returns responses for samlauth module routes.

Namespace

Drupal\samlauth\Controller

Code

public function login() {
  try {
    $url = $this->saml
      ->login($this
      ->getUrlFromDestination());
  } catch (Exception $e) {
    $this
      ->handleException($e, 'initiating SAML login');
    $url = Url::fromRoute('<front>');
  }
  return $this
    ->createRedirectResponse($url);
}