You are here

public function IdentityProviders::__construct in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

File

includes/MetadataReader.php, line 46

Class

IdentityProviders

Code

public function __construct(DOMElement $xml = NULL) {
  $this->idpName = '';
  $this->loginDetails = array();
  $this->logoutDetails = array();
  $this->signingCertificate = array();
  $this->encryptionCertificate = array();
  if ($xml
    ->hasAttribute('entityID')) {
    $this->entityID = $xml
      ->getAttribute('entityID');
  }
  if ($xml
    ->hasAttribute('WantAuthnRequestsSigned')) {
    $this->signedRequest = $xml
      ->getAttribute('WantAuthnRequestsSigned');
  }
  $idpSSODescriptor = Utilities::xpQuery($xml, './saml_metadata:IDPSSODescriptor');
  if (count($idpSSODescriptor) > 1) {
    throw new Exception('More than one <IDPSSODescriptor> in <EntityDescriptor>.');
  }
  elseif (empty($idpSSODescriptor)) {
    throw new Exception('Missing required <IDPSSODescriptor> in <EntityDescriptor>.');
  }
  $idpSSODescriptorEL = $idpSSODescriptor[0];
  $info = Utilities::xpQuery($xml, './saml_metadata:Extensions');
  if ($info) {
    $this
      ->parseInfo($idpSSODescriptorEL);
  }
  $this
    ->parseSSOService($idpSSODescriptorEL);
  $this
    ->parseSLOService($idpSSODescriptorEL);
  $this
    ->parsex509Certificate($idpSSODescriptorEL);
}