You are here

public function SamlSPController::metadata in SAML Service Provider 4.x

Same name and namespace in other branches
  1. 8.3 src/Controller/SamlSPController.php \Drupal\saml_sp\Controller\SamlSPController::metadata()
  2. 8.2 src/Controller/SamlSPController.php \Drupal\saml_sp\Controller\SamlSPController::metadata()
  3. 3.x src/Controller/SamlSPController.php \Drupal\saml_sp\Controller\SamlSPController::metadata()

Generate the XMl metadata for the given IdP.

1 string reference to 'SamlSPController::metadata'
saml_sp.routing.yml in ./saml_sp.routing.yml
saml_sp.routing.yml

File

src/Controller/SamlSPController.php, line 21

Class

SamlSPController
Provides route responses for the SAML SP module.

Namespace

Drupal\saml_sp\Controller

Code

public function metadata($return_string = FALSE) {
  list($metadata, $errors) = saml_sp__get_metadata();
  $output = $metadata;
  if ($return_string) {
    return $output;
  }
  $response = new Response();
  $response
    ->setContent($metadata);
  $response->headers
    ->set('Content-Type', 'text/xml');
  return $response;
}