4 chdir(dirname(__FILE__));
18 if (!file_exists(getcwd() .
'/ilias.ini.php')) {
19 die(
'Please ensure ILIAS is installed!');
24 if (isset(
$_GET[
"client_id"])) {
34 require_once
'Services/Context/classes/class.ilContext.php';
37 require_once
'Services/Init/classes/class.ilInitialisation.php';
42 require_once
'Services/Saml/classes/class.ilSamlAuthFactory.php';
48 if (!array_key_exists(
'PATH_INFO',
$_SERVER)) {
50 $DIC->logger()->root()->warning(
'Missing "PATH_INFO" variable. This could be a false positive log entry, but you have to ensure a valid "PATH_INFO" setting for your HTTP server.');
54 if (
$config->getBoolean(
'admin.protectmetadata',
false)) {
77 SAML2\Constants::BINDING_HTTP_REDIRECT,
78 SAML2\Constants::BINDING_SOAP,
92 'Binding' => $binding,
98 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
99 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
100 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact',
101 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01',
104 if (
$spconfig->getString(
'ProtocolBinding',
'') ==
'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser') {
113 $acsArray = array(
'index' =>
$index);
115 case 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST':
118 $acsArray[
'Location'] =
$iliasHttpPath .
"/saml2-acs.php/{$sourceId}/" . CLIENT_ID;
121 case 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post':
122 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:1.0:profiles:browser-post';
124 $acsArray[
'Location'] =
$iliasHttpPath .
"/saml1-acs.php/{$sourceId}/" . CLIENT_ID;
126 case 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact':
127 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact';
129 $acsArray[
'Location'] =
$iliasHttpPath .
"/saml2-acs.php/{$sourceId}/" . CLIENT_ID;
132 case 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01':
133 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01';
135 $acsArray[
'Location'] =
$iliasHttpPath .
"/saml1-acs.php/{$sourceId}/artifact/" . CLIENT_ID;
138 case 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser':
139 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser';
141 $acsArray[
'Location'] =
$iliasHttpPath .
"/saml2-acs.php/{$sourceId}/" . CLIENT_ID;
160 'type' =>
'X509Certificate',
162 'encryption' =>
true,
163 'X509Certificate' =>
$certInfo[
'certData'],
174 'type' =>
'X509Certificate',
176 'encryption' => ($hasNewCert ?
false :
true),
177 'X509Certificate' =>
$certInfo[
'certData'],
205 $nameFormat =
$spconfig->getString(
'attributes.NameFormat', null);
206 if ($nameFormat !== null) {
216 $metaArray20[
'OrganizationDisplayName'] =
$spconfig->getLocalizedString(
'OrganizationDisplayName', null);
228 $contacts =
$spconfig->getArray(
'contacts');
229 foreach ($contacts as $contact) {
230 $metaArray20[
'contacts'][] = \SimpleSAML\Utils\Config\Metadata::getContact($contact);
235 $email =
$config->getString(
'technicalcontact_email',
'na@example.org',
false);
237 $techcontact[
'emailAddress'] =
$email;
238 $techcontact[
'name'] =
$config->getString(
'technicalcontact_name', null);
239 $techcontact[
'contactType'] =
'technical';
240 $metaArray20[
'contacts'][] = \SimpleSAML\Utils\Config\Metadata::getContact($techcontact);
244 if (count(
$keys) === 1) {
246 } elseif (count(
$keys) > 1) {
251 if (
$spconfig->hasValue(
'EntityAttributes')) {
261 if (
$spconfig->hasValue(
'RegistrationInfo')) {
266 if (
$spconfig->hasValue(
'WantAssertionsSigned')) {
269 if (
$spconfig->hasValue(
'redirect.sign')) {
271 } elseif (
$spconfig->hasValue(
'sign.authnrequest')) {
298 if (array_key_exists(
'output', $_REQUEST) && $_REQUEST[
'output'] ==
'xhtml') {
301 $t->data[
'clipboard.js'] =
true;
302 $t->data[
'header'] =
'saml20-sp';
303 $t->data[
'metadata'] = htmlspecialchars(
$xml);
304 $t->data[
'metadataflat'] =
'$metadata[' . var_export(
$entityId,
true) .
'] = ' . var_export(
$metaArray20,
true) .
';';
306 $t->data[
'metaurl'] =
$iliasHttpPath .
"/metadata.php{$sourceId}/" . CLIENT_ID;
310 header(
'Content-Type: application/samlmetadata+xml');
312 header(
"Content-Disposition:attachment; filename=\"" .
$ascii_filename .
"\"");
static requireAdmin()
Require admin access to the current page.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static initILIAS()
ilias initialisation
Attribute-related utility methods.
static loadPublicKey(\SimpleSAML_Configuration $metadata, $required=false, $prefix='')
Get public key or certificate from metadata.
static init($a_type)
Init context by type.
const BINDING_HTTP_REDIRECT
The URN for the HTTP-Redirect binding.
const BINDING_HTTP_POST
The URN for the HTTP-POST binding.
static getById($authId, $type=null)
Retrieve authentication source.
static getInstance()
Retrieve our singleton instance.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.