PHP Classes

File: web/SSO/modules/saml/www/idp/certs.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/saml/www/idp/certs.php   Download  
File: web/SSO/modules/saml/www/idp/certs.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 1,179 bytes
 

Contents

Class file image Download
<?php

/* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance();
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();

if (!
$config->getBoolean('enable.saml20-idp', false))
    throw new
SimpleSAML_Error_Error('NOACCESS');

/* Check if valid local session exists.. */
if ($config->getBoolean('admin.protectmetadata', false)) {
   
SimpleSAML_Utilities::requireAdmin();
}

$idpentityid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
$idpmeta = $metadata->getMetaDataConfig($idpentityid, 'saml20-idp-hosted');

switch(
$_SERVER['PATH_INFO']) {
    case
'/new_idp.crt':
       
$certInfo = SimpleSAML_Utilities::loadPublicKey($idpmeta, FALSE, 'new_');
        break;
    case
'/idp.crt':
       
$certInfo = SimpleSAML_Utilities::loadPublicKey($idpmeta, TRUE);
        break;
    case
'/https.crt':
       
$certInfo = SimpleSAML_Utilities::loadPublicKey($idpmeta, TRUE, 'https.');
        break;
    default:
        throw new
SimpleSAML_Error_NotFound('Unknown certificate.');
}

header('Content-Disposition: attachment; filename='.substr($_SERVER['PATH_INFO'], 1));
header('Content-Type: application/x-x509-ca-cert');
echo
$certInfo['PEM'];
exit(
0);

?>