You are here

public function SamlController::acs in SAML Authentication 8

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

Attribute Consumer Service

Return value

\Symfony\Component\HttpFoundation\RedirectResponse

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

File

src/Controller/SamlController.php, line 92
Contains Drupal\samlauth\Controller\SamlController.

Class

SamlController
Class SamlController.

Namespace

Drupal\samlauth\Controller

Code

public function acs() {
  $errors = $this->saml
    ->acs();
  if (!empty($errors)) {
    drupal_set_message($this
      ->t('An error occured.'), 'error');
    return new RedirectResponse('/');
  }
  try {
    $saml_data = $this->saml
      ->getData();
    $this->saml_user
      ->handleSamlData($saml_data);
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
  $route = $this->saml_user
    ->getPostLoginDestination();
  $url = \Drupal::urlGenerator()
    ->generateFromRoute($route);
  return new RedirectResponse($url);
}