ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSamlIdpXmlMetadataParser Class Reference

Class ilSamlIdpXmlMetadataParser. More...

+ Collaboration diagram for ilSamlIdpXmlMetadataParser:

Public Member Functions

 parse ($xml)
 
 hasErrors ()
 
 getErrors ()
 
 getEntityId ()
 

Protected Attributes

 $errors = []
 
 $entityId = ''
 

Private Member Functions

 pushError ($error)
 

Detailed Description

Member Function Documentation

◆ getEntityId()

ilSamlIdpXmlMetadataParser::getEntityId ( )
Returns
string

Definition at line 76 of file class.ilSamlIdpXmlMetadataParser.php.

References $entityId.

◆ getErrors()

ilSamlIdpXmlMetadataParser::getErrors ( )
Returns
string[]

Definition at line 68 of file class.ilSamlIdpXmlMetadataParser.php.

References $errors.

Referenced by hasErrors().

+ Here is the caller graph for this function:

◆ hasErrors()

ilSamlIdpXmlMetadataParser::hasErrors ( )
Returns
bool

Definition at line 60 of file class.ilSamlIdpXmlMetadataParser.php.

61 {
62 return count($this->getErrors()) > 0;
63 }

References getErrors().

+ Here is the call graph for this function:

◆ parse()

ilSamlIdpXmlMetadataParser::parse (   $xml)
Parameters
string$xml

Definition at line 23 of file class.ilSamlIdpXmlMetadataParser.php.

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 }

References $xml, and pushError().

+ Here is the call graph for this function:

◆ pushError()

ilSamlIdpXmlMetadataParser::pushError (   $error)
private
Parameters
string$error

Definition at line 52 of file class.ilSamlIdpXmlMetadataParser.php.

53 {
54 $this->errors[] = $error;
55 }

Referenced by parse().

+ Here is the caller graph for this function:

Field Documentation

◆ $entityId

ilSamlIdpXmlMetadataParser::$entityId = ''
protected

Definition at line 18 of file class.ilSamlIdpXmlMetadataParser.php.

Referenced by getEntityId().

◆ $errors

ilSamlIdpXmlMetadataParser::$errors = []
protected

Definition at line 13 of file class.ilSamlIdpXmlMetadataParser.php.

Referenced by getErrors().


The documentation for this class was generated from the following file: