19 chdir(dirname(__FILE__));
33 if (!file_exists(getcwd() .
'/ilias.ini.php')) {
34 die(
'Please ensure ILIAS is installed!');
39 if (isset(
$_GET[
"client_id"])) {
49 require_once
'Services/Context/classes/class.ilContext.php';
52 require_once
'Services/Init/classes/class.ilInitialisation.php';
57 require_once
'Services/Saml/classes/class.ilSamlAuthFactory.php';
63 if (!array_key_exists(
'PATH_INFO',
$_SERVER)) {
65 $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.');
69 if (
$config->getBoolean(
'admin.protectmetadata',
false)) {
78 throw new AuthSource(
$sourceId,
'Could not find authentication source.');
84 'The authentication source is not a SAML Service Provider.' 95 Constants::BINDING_HTTP_REDIRECT,
96 Constants::BINDING_SOAP,
104 foreach (
$slob as $binding) {
105 if ($binding == Constants::BINDING_SOAP && !(
$store instanceof SQL)) {
110 'Binding' => $binding,
116 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
117 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
118 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact',
119 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01',
122 if (
$spconfig->getString(
'ProtocolBinding',
'') ==
'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser') {
132 $acsArray = [
'index' =>
$index];
134 case 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST':
135 $acsArray[
'Binding'] = Constants::BINDING_HTTP_POST;
143 case 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post':
144 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:1.0:profiles:browser-post';
152 case 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact':
153 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact';
161 case 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01':
162 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01';
170 case 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser':
171 $acsArray[
'Binding'] =
'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser';
175 $acsArray[
'hoksso:ProtocolBinding'] = Constants::BINDING_HTTP_REDIRECT;
195 'type' =>
'X509Certificate',
197 'encryption' =>
true,
198 'X509Certificate' =>
$certInfo[
'certData'],
209 'type' =>
'X509Certificate',
211 'encryption' => ($hasNewCert ? false :
true),
212 'X509Certificate' =>
$certInfo[
'certData'],
223 Constants::NAMEID_TRANSIENT
225 } elseif (is_string(
$format)) {
242 $description =
$spconfig->getArray(
'description', null);
243 if ($description !== null) {
247 $nameFormat =
$spconfig->getString(
'attributes.NameFormat', null);
248 if ($nameFormat !== null) {
252 if (
$spconfig->hasValue(
'attributes.index')) {
256 if (
$spconfig->hasValue(
'attributes.isDefault')) {
266 $metaArray20[
'OrganizationDisplayName'] =
$spconfig->getLocalizedString(
'OrganizationDisplayName', null);
273 throw new \SimpleSAML\Error\Exception(
'If OrganizationName is set, OrganizationURL must also be set.');
278 $contacts =
$spconfig->getArray(
'contacts');
279 foreach ($contacts as $contact) {
280 $metaArray20[
'contacts'][] = Metadata::getContact($contact);
287 $techcontact[
'emailAddress'] =
$email;
288 $techcontact[
'name'] =
$config->getString(
'technicalcontact_name', null);
289 $techcontact[
'contactType'] =
'technical';
290 $metaArray20[
'contacts'][] = Metadata::getContact($techcontact);
294 if (count(
$keys) === 1) {
296 } elseif (count(
$keys) > 1) {
301 if (
$spconfig->hasValue(
'EntityAttributes')) {
311 if (
$spconfig->hasValue(
'RegistrationInfo')) {
316 if (
$spconfig->hasValue(
'WantAssertionsSigned')) {
319 if (
$spconfig->hasValue(
'redirect.sign')) {
321 } elseif (
$spconfig->hasValue(
'sign.authnrequest')) {
346 if (array_key_exists(
'output', $_REQUEST) && $_REQUEST[
'output'] ==
'xhtml') {
349 $t->data[
'clipboard.js'] =
true;
350 $t->data[
'header'] =
'saml20-sp';
351 $t->data[
'headerString'] = Translate::noop(
'metadata_saml20-sp');
352 $t->data[
'metadata'] = htmlspecialchars(
$xml);
353 $t->data[
'metadataflat'] =
'$metadata[' . var_export(
$entityId,
true) .
'] = ' . var_export(
$metaArray20,
true) .
';';
359 header(
'Content-Type: application/samlmetadata+xml');
362 header(
"Content-Disposition:attachment; filename=\"" .
$ascii_filename .
"\"");
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static initILIAS()
ilias initialisation
static init($a_type)
Init context by type.