ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilSamlIdpXmlMetadataParser Class Reference

Class ilSamlIdpXmlMetadataParser. More...

+ Collaboration diagram for ilSamlIdpXmlMetadataParser:

Public Member Functions

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

Protected Attributes

 $errors = []
 
 $entityId = ''
 

Private Member Functions

 pushError (string $error)
 

Detailed Description

Member Function Documentation

◆ getEntityId()

ilSamlIdpXmlMetadataParser::getEntityId ( )
Returns
string

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

References $entityId.

◆ getErrors()

ilSamlIdpXmlMetadataParser::getErrors ( )
Returns
string[]

Definition at line 63 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 55 of file class.ilSamlIdpXmlMetadataParser.php.

55 : bool
56 {
57 return count($this->getErrors()) > 0;
58 }

References getErrors().

+ Here is the call graph for this function:

◆ parse()

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

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

18 : void
19 {
20 libxml_use_internal_errors(true);
21
22 $xml = new SimpleXMLElement($xml);
23
24 $xml->registerXPathNamespace('md', 'urn:oasis:names:tc:SAML:2.0:metadata');
25 $xml->registerXPathNamespace('mdui', 'urn:oasis:names:tc:SAML:metadata:ui');
26
27 $idps = $xml->xpath('//md:EntityDescriptor[//md:IDPSSODescriptor]');
28 $entityid = null;
29 if ($idps && isset($idps[0])) {
30 $entityid = (string) $idps[0]->attributes('', true)->entityID[0];
31 }
32
33 foreach (libxml_get_errors() as $error) {
34 $this->pushError($error->line . ': ' . $error->message);
35 }
36
37 if ($entityid) {
38 $this->entityId = $entityid;
39 }
40
41 libxml_clear_errors();
42 }
$xml
Definition: metadata.php:332

References $xml, and pushError().

+ Here is the call graph for this function:

◆ pushError()

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

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

47 : void
48 {
49 $this->errors[] = $error;
50 }

Referenced by parse().

+ Here is the caller graph for this function:

Field Documentation

◆ $entityId

ilSamlIdpXmlMetadataParser::$entityId = ''
protected

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

Referenced by getEntityId().

◆ $errors

ilSamlIdpXmlMetadataParser::$errors = []
protected

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

Referenced by getErrors().


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