You are here

function saml_sp__get_metadata in SAML Service Provider 8.2

Same name and namespace in other branches
  1. 8.3 saml_sp.module \saml_sp__get_metadata()
  2. 7.8 saml_sp.module \saml_sp__get_metadata()
  3. 7.2 saml_sp.module \saml_sp__get_metadata()
  4. 7.3 saml_sp.module \saml_sp__get_metadata()
  5. 4.x saml_sp.module \saml_sp__get_metadata()
  6. 3.x saml_sp.module \saml_sp__get_metadata()

load the settings and get the metadata

2 calls to saml_sp__get_metadata()
SamlSpConfig::buildForm in src/Form/SamlSpConfig.php
Form constructor.
SamlSPController::metadata in src/Controller/SamlSPController.php
generate the XMl metadata for the given IDP

File

./saml_sp.module, line 230
SAML Service Provider

Code

function saml_sp__get_metadata($output_page = FALSE) {
  _saml_sp__prepare();
  $settings = saml_sp__get_settings();
  try {
    $auth = new \OneLogin_Saml2_Auth($settings);
    $settings = $auth
      ->getSettings();
    $metadata = $settings
      ->getSPMetadata();
    $errors = $settings
      ->validateMetadata($metadata);
  } catch (Exception $e) {
    $metadata = get_class($e) . ' - ' . $e
      ->getMessage();
  }
  return array(
    $metadata,
    isset($errors) ? $errors : array(),
  );
}