function samlauth_metadata in SAML Authentication 7
Menu callback for /saml/metadata.
1 string reference to 'samlauth_metadata'
- samlauth_menu in ./
samlauth.module - Implements hook_menu().
File
- ./
samlauth.module, line 216 - Provides SAML authentication capabilities.
Code
function samlauth_metadata() {
$auth = samlauth_get_saml2_auth();
$settings = $auth
->getSettings();
$metadata = $settings
->getSPMetadata();
$errors = $settings
->validateMetadata($metadata);
if (!empty($errors)) {
throw new Exception('Invalid SP metadata: ' . implode(', ', $errors));
}
drupal_add_http_header('Content-Type', 'text/xml');
// @TODO: This is gross. Investigate using a delivery callback instead.
print $metadata;
drupal_exit();
}