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; }
/** * @param \LightSaml\Bridge\Pimple\Container\BuildContainer $buildContainer */ private function buildCredentialContext(\LightSaml\Bridge\Pimple\Container\BuildContainer $buildContainer) { $buildContainer->getPimple()->register(new \LightSaml\Bridge\Pimple\Container\Factory\CredentialContainerProvider($buildContainer->getPartyContainer(), $buildContainer->getOwnContainer())); }