forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
refresh_idp_metadata.php
35 lines (29 loc) · 1.71 KB
/
refresh_idp_metadata.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once "db.inc.php";
require_once "facilities.inc.php";
define("TOOLKIT_PATH", './vendor/onelogin/php-saml/');
require_once(TOOLKIT_PATH . '_toolkit_loader.php');
require_once( "./saml/settings.php" );
$parser = new OneLogin\Saml2\IdPMetadataParser;
error_log( "Downloading new IdP Metadata from " . $config->ParameterArray["SAMLIdPMetadataURL"]);
$IdPSettings = $parser->parseRemoteXML($config->ParameterArray["SAMLIdPMetadataURL"]);
// Overcommunicate so that we can actually keep track of any changes in the logs
if ( $config->ParameterArray["SAMLidpentityId"] != $IdPSettings['idp']['entityId'] ) {
$config->ParameterArray["SAMLidpentityId"] = $IdPSettings['idp']['entityId'];
error_log( "SAMLidpentityId updated to " . $IdPSettings['idp']['entityId']);
}
if ( $config->ParameterArray["SAMLidpx509cert"] != $IdPSettings['idp']['x509cert'] ) {
$config->ParameterArray["SAMLidpx509cert"] = $IdPSettings['idp']['x509cert'];
error_log( "SAMLidpx509cert updated to " . $IdPSettings['idp']['x509cert']);
}
if ( $config->ParameterArray["SAMLidpslsURL"] != $IdPSettings['idp']['singleLogoutService']['url'] ) {
$config->ParameterArray["SAMLidpslsURL"] = $IdPSettings['idp']['singleLogoutService']['url'];
error_log( "SAMLidpslsURL updated to " . $IdPSettings['idp']['singleLogoutService']['url']);
}
if ( $config->ParameterArray["SAMLidpssoURL"] != $IdPSettings['idp']['singleSignOnService']['url'] ) {
$config->ParameterArray["SAMLidpssoURL"] = $IdPSettings['idp']['singleSignOnService']['url'];
error_log( "SAMLidpssoURL updated to " . $IdPSettings['idp']['singleSignOnService']['url']);
}
$config->UpdateConfig();
error_log( "Metadata refresh complete." );
?>