ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

71  : string
72  {
73  return $this->entityId;
74  }

◆ getErrors()

ilSamlIdpXmlMetadataParser::getErrors ( )
Returns
string[]

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

References $errors.

Referenced by hasErrors().

63  : array
64  {
65  return $this->errors;
66  }
+ Here is the caller graph for this function:

◆ hasErrors()

ilSamlIdpXmlMetadataParser::hasErrors ( )
Returns
bool

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

References getErrors().

55  : bool
56  {
57  return count($this->getErrors()) > 0;
58  }
+ 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.

References pushError().

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
+ 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.

Referenced by parse().

47  : void
48  {
49  $this->errors[] = $error;
50  }
+ 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: