private function load()
 {
     try {
         $this->object = EntityDescriptor::load($this->filename);
     } catch (LightSamlXmlException $ex) {
         $this->object = EntitiesDescriptor::load($this->filename);
     }
 }
Exemple #2
0
 private function getBuildContainer($inResponseTo = null, TimeProviderInterface $timeProvider = null)
 {
     $buildContainer = new BuildContainer($pimple = new Container());
     // OWN
     $ownCredential = new \LightSaml\Credential\X509Credential(\LightSaml\Credential\X509Certificate::fromFile(__DIR__ . '/../../../../../../web/sp/saml.crt'), \LightSaml\Credential\KeyHelper::createPrivateKey(__DIR__ . '/../../../../../../web/sp/saml.key', null, true));
     $ownCredential->setEntityId(self::OWN_ENTITY_ID);
     $ownEntityDescriptor = new \LightSaml\Builder\EntityDescriptor\SimpleEntityDescriptorBuilder(self::OWN_ENTITY_ID, 'https://localhost/lightsaml/lightSAML/web/sp/acs.php', null, $ownCredential->getCertificate());
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\OwnContainerProvider($ownEntityDescriptor, [$ownCredential]));
     // SYSTEM
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\SystemContainerProvider(true));
     if ($timeProvider) {
         $pimple[SystemContainer::TIME_PROVIDER] = function () use($timeProvider) {
             return $timeProvider;
         };
     }
     // PARTY
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\PartyContainerProvider());
     $pimple[PartyContainer::IDP_ENTITY_DESCRIPTOR] = function () {
         $idpProvider = new \LightSaml\Store\EntityDescriptor\FixedEntityDescriptorStore();
         $idpProvider->add(\LightSaml\Model\Metadata\EntitiesDescriptor::load(__DIR__ . '/../../../../../../web/sp/testshib-providers.xml'));
         $idpProvider->add(\LightSaml\Model\Metadata\EntityDescriptor::load(__DIR__ . '/../../../../../../web/sp/localhost-lightsaml-lightsaml-idp.xml'));
         $idpProvider->add(\LightSaml\Model\Metadata\EntityDescriptor::load(__DIR__ . '/../../../../../../web/sp/openidp.feide.no.xml'));
         return $idpProvider;
     };
     // STORE
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\StoreContainerProvider($buildContainer->getSystemContainer()));
     if ($inResponseTo) {
         $pimple[StoreContainer::REQUEST_STATE_STORE] = function () use($inResponseTo) {
             $store = new RequestStateArrayStore();
             $store->set(new RequestState($inResponseTo));
             return $store;
         };
     }
     // PROVIDER
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\ProviderContainerProvider());
     // CREDENTIAL
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\CredentialContainerProvider($buildContainer->getPartyContainer(), $buildContainer->getOwnContainer()));
     // SERVICE
     $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\ServiceContainerProvider($buildContainer->getCredentialContainer(), $buildContainer->getStoreContainer(), $buildContainer->getSystemContainer()));
     return $buildContainer;
 }
Exemple #3
0
 /**
  * @return \LightSaml\Store\EntityDescriptor\FixedEntityDescriptorStore
  */
 private function buildIdpEntityStore()
 {
     $idpProvider = new \LightSaml\Store\EntityDescriptor\FixedEntityDescriptorStore();
     $idpProvider->add(\LightSaml\Model\Metadata\EntitiesDescriptor::load(__DIR__ . '/testshib-providers.xml'));
     $idpProvider->add(\LightSaml\Model\Metadata\EntityDescriptor::load(__DIR__ . '/localhost-lightsaml-lightsaml-idp.xml'));
     $idpProvider->add(\LightSaml\Model\Metadata\EntityDescriptor::load(__DIR__ . '/openidp.feide.no.xml'));
     return $idpProvider;
 }
 /**
  * @expectedException \LightSaml\Error\LightSamlXmlException
  * @expectedExceptionMessage Expected 'EntitiesDescriptor' xml node and 'urn:oasis:names:tc:SAML:2.0:metadata' namespace but got node 'EntityDescriptor' and namespace 'urn:oasis:names:tc:SAML:2.0:metadata'
  */
 public function test_throws_on_entity_descriptor()
 {
     EntitiesDescriptor::load(__DIR__ . '/../../../../../../resources/sample/EntityDescriptor/idp-ed.xml');
 }