You are here

public function SamlController::metadata in SAML Authentication 8.2

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

Displays service provider metadata XML for iDP autoconfiguration.

Return value

\Symfony\Component\HttpFoundation\Response

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

File

src/Controller/SamlController.php, line 141

Class

SamlController
Returns responses for samlauth module routes.

Namespace

Drupal\samlauth\Controller

Code

public function metadata() {
  try {
    $metadata = $this->saml
      ->getMetadata();
  } catch (Exception $e) {
    $this
      ->handleException($e, 'processing SAML SP metadata');
    return $this
      ->createRedirectResponse(Url::fromRoute('<front>'));
  }
  return new Response($metadata, 200, [
    'Content-Type' => 'text/xml',
  ]);
}