예제 #1
0
파일: Scope.php 프로젝트: SysBind/saml2
 /**
  * Create a Scope.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  */
 public function __construct(\DOMElement $xml = null)
 {
     if ($xml === null) {
         return;
     }
     $this->scope = $xml->textContent;
     $this->regexp = Utils::parseBoolean($xml, 'regexp', null);
 }
예제 #2
0
 /**
  * Initialize an RequestedAttribute.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  */
 public function __construct(\DOMElement $xml = null)
 {
     parent::__construct($xml);
     if ($xml === null) {
         return;
     }
     $this->isRequired = Utils::parseBoolean($xml, 'isRequired', null);
 }
예제 #3
0
 /**
  * Initialize an IndexedEndpointType.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  * @throws \Exception
  */
 public function __construct(\DOMElement $xml = null)
 {
     parent::__construct($xml);
     if ($xml === null) {
         return;
     }
     if (!$xml->hasAttribute('index')) {
         throw new \Exception('Missing index on ' . $xml->tagName);
     }
     $this->index = (int) $xml->getAttribute('index');
     $this->isDefault = Utils::parseBoolean($xml, 'isDefault', null);
 }
예제 #4
0
 /**
  * Initialize a SPSSODescriptor.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  */
 public function __construct(\DOMElement $xml = null)
 {
     parent::__construct('md:SPSSODescriptor', $xml);
     if ($xml === null) {
         return;
     }
     $this->AuthnRequestsSigned = Utils::parseBoolean($xml, 'AuthnRequestsSigned', null);
     $this->WantAssertionsSigned = Utils::parseBoolean($xml, 'WantAssertionsSigned', null);
     foreach (Utils::xpQuery($xml, './saml_metadata:AssertionConsumerService') as $ep) {
         $this->AssertionConsumerService[] = new IndexedEndpointType($ep);
     }
     foreach (Utils::xpQuery($xml, './saml_metadata:AttributeConsumingService') as $acs) {
         $this->AttributeConsumingService[] = new AttributeConsumingService($acs);
     }
 }
예제 #5
0
 /**
  * Initialize / parse an AttributeConsumingService.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  * @throws \Exception
  */
 public function __construct(\DOMElement $xml = null)
 {
     if ($xml === null) {
         return;
     }
     if (!$xml->hasAttribute('index')) {
         throw new \Exception('Missing index on AttributeConsumingService.');
     }
     $this->index = (int) $xml->getAttribute('index');
     $this->isDefault = Utils::parseBoolean($xml, 'isDefault', null);
     $this->ServiceName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceName');
     if (empty($this->ServiceName)) {
         throw new \Exception('Missing ServiceName in AttributeConsumingService.');
     }
     $this->ServiceDescription = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceDescription');
     foreach (Utils::xpQuery($xml, './saml_metadata:RequestedAttribute') as $ra) {
         $this->RequestedAttribute[] = new RequestedAttribute($ra);
     }
 }
예제 #6
0
 /**
  * Initialize an IDPSSODescriptor.
  *
  * @param \DOMElement|null $xml The XML element we should load.
  */
 public function __construct(\DOMElement $xml = null)
 {
     parent::__construct('md:IDPSSODescriptor', $xml);
     if ($xml === null) {
         return;
     }
     $this->WantAuthnRequestsSigned = Utils::parseBoolean($xml, 'WantAuthnRequestsSigned', null);
     foreach (Utils::xpQuery($xml, './saml_metadata:SingleSignOnService') as $ep) {
         $this->SingleSignOnService[] = new EndpointType($ep);
     }
     foreach (Utils::xpQuery($xml, './saml_metadata:NameIDMappingService') as $ep) {
         $this->NameIDMappingService[] = new EndpointType($ep);
     }
     foreach (Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
         $this->AssertionIDRequestService[] = new EndpointType($ep);
     }
     $this->AttributeProfile = Utils::extractStrings($xml, Constants::NS_MD, 'AttributeProfile');
     foreach (Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
         $this->Attribute[] = new Attribute($a);
     }
 }
예제 #7
0
 /**
  * @param \DOMElement $xml
  *
  * @throws \Exception
  */
 protected function parseNameIdPolicy(\DOMElement $xml)
 {
     $nameIdPolicy = Utils::xpQuery($xml, './saml_protocol:NameIDPolicy');
     if (empty($nameIdPolicy)) {
         return;
     }
     $nameIdPolicy = $nameIdPolicy[0];
     if ($nameIdPolicy->hasAttribute('Format')) {
         $this->nameIdPolicy['Format'] = $nameIdPolicy->getAttribute('Format');
     }
     if ($nameIdPolicy->hasAttribute('SPNameQualifier')) {
         $this->nameIdPolicy['SPNameQualifier'] = $nameIdPolicy->getAttribute('SPNameQualifier');
     }
     if ($nameIdPolicy->hasAttribute('AllowCreate')) {
         $this->nameIdPolicy['AllowCreate'] = Utils::parseBoolean($nameIdPolicy, 'AllowCreate', false);
     }
 }