ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilSamlIdpXmlMetadataParser.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8
class
ilSamlIdpXmlMetadataParser
9
{
13
protected
$errors
= [];
14
18
protected
$entityId
=
''
;
19
23
public
function
parse
(
$xml
)
24
{
25
\libxml_use_internal_errors(
true
);
26
27
$xml
= new \SimpleXMLElement(
$xml
);
28
29
$xml
->registerXPathNamespace(
'md'
,
'urn:oasis:names:tc:SAML:2.0:metadata'
);
30
$xml
->registerXPathNamespace(
'mdui'
,
'urn:oasis:names:tc:SAML:metadata:ui'
);
31
32
$idps =
$xml
->xpath(
'//md:EntityDescriptor[//md:IDPSSODescriptor]'
);
33
$entityid = null;
34
if
($idps && isset($idps[0])) {
35
$entityid = (
string
) $idps[0]->attributes(
''
,
true
)->entityID[0];
36
}
37
38
foreach
(\libxml_get_errors() as
$error
) {
39
$this->
pushError
(
$error
->line .
': '
.
$error
->message);
40
}
41
42
if
($entityid) {
43
$this->entityId = $entityid;
44
}
45
46
\libxml_clear_errors();
47
}
48
52
private
function
pushError
(
$error
)
53
{
54
$this->errors[] =
$error
;
55
}
56
60
public
function
hasErrors
()
61
{
62
return
count($this->
getErrors
()) > 0;
63
}
64
68
public
function
getErrors
()
69
{
70
return
$this->errors
;
71
}
72
76
public
function
getEntityId
()
77
{
78
return
$this->entityId
;
79
}
80
}
string
Add rich text string
Definition:
05featuredemo.inc.php:117
ilSamlIdpXmlMetadataParser\$errors
$errors
Definition:
class.ilSamlIdpXmlMetadataParser.php:13
ilSamlIdpXmlMetadataParser
Class ilSamlIdpXmlMetadataParser.
Definition:
class.ilSamlIdpXmlMetadataParser.php:8
ilSamlIdpXmlMetadataParser\hasErrors
hasErrors()
Definition:
class.ilSamlIdpXmlMetadataParser.php:60
ilSamlIdpXmlMetadataParser\$entityId
$entityId
Definition:
class.ilSamlIdpXmlMetadataParser.php:18
$xml
$xml
Definition:
metadata.php:240
$error
$error
Definition:
Error.php:17
ilSamlIdpXmlMetadataParser\parse
parse($xml)
Definition:
class.ilSamlIdpXmlMetadataParser.php:23
ilSamlIdpXmlMetadataParser\pushError
pushError($error)
Definition:
class.ilSamlIdpXmlMetadataParser.php:52
ilSamlIdpXmlMetadataParser\getErrors
getErrors()
Definition:
class.ilSamlIdpXmlMetadataParser.php:68
ilSamlIdpXmlMetadataParser\getEntityId
getEntityId()
Definition:
class.ilSamlIdpXmlMetadataParser.php:76
Services
Saml
classes
class.ilSamlIdpXmlMetadataParser.php
Generated on Tue Sep 2 2025 19:02:46 for ILIAS by
1.8.13 (using
Doxyfile
)