SAML2\SignedElementHelper::__construct PHP Method

__construct() protected method

Initialize the helper class.
protected __construct ( DOMElement $xml = null )
$xml DOMElement The XML element which may be signed.
    protected function __construct(\DOMElement $xml = null)
    {
        $this->certificates = array();
        $this->validators = array();
        if ($xml === null) {
            return;
        }
        /* Validate the signature element of the message. */
        try {
            $sig = Utils::validateElement($xml);
            if ($sig !== false) {
                $this->certificates = $sig['Certificates'];
                $this->validators[] = array('Function' => array('\\SAML2\\Utils', 'validateSignature'), 'Data' => $sig);
            }
        } catch (\Exception $e) {
            /* Ignore signature validation errors. */
        }
    }

Usage Example

Example #1
0
 /**
  * Initialize an EntitiesDescriptor.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  */
 public function __construct(\DOMElement $xml = null)
 {
     parent::__construct($xml);
     if ($xml === null) {
         return;
     }
     if ($xml->hasAttribute('ID')) {
         $this->ID = $xml->getAttribute('ID');
     }
     if ($xml->hasAttribute('validUntil')) {
         $this->validUntil = Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
     }
     if ($xml->hasAttribute('cacheDuration')) {
         $this->cacheDuration = $xml->getAttribute('cacheDuration');
     }
     if ($xml->hasAttribute('Name')) {
         $this->Name = $xml->getAttribute('Name');
     }
     $this->Extensions = Extensions::getList($xml);
     foreach (Utils::xpQuery($xml, './saml_metadata:EntityDescriptor|./saml_metadata:EntitiesDescriptor') as $node) {
         if ($node->localName === 'EntityDescriptor') {
             $this->children[] = new EntityDescriptor($node);
         } else {
             $this->children[] = new EntitiesDescriptor($node);
         }
     }
 }
All Usage Examples Of SAML2\SignedElementHelper::__construct