Skip to content

Commit

Permalink
Merge pull request #24 from lightSAML/maintenance
Browse files Browse the repository at this point in the history
Remove service locator to support Symfony 4
  • Loading branch information
tmilos authored May 23, 2018
2 parents 9b64b2e + fd418cd commit cd6eadf
Show file tree
Hide file tree
Showing 33 changed files with 688 additions and 506 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@
/composer.lock
/*.phar
/*.cache

tests/LightSaml/SymfonyBridgeBundle/Tests/Functional/cache/*
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
},
"require": {
"php": ">=5.5.1",
"symfony/framework-bundle": "~2.3|~3.0|~4.0",
"symfony/dependency-injection": "~2.3|~3.0|~4.0",
"symfony/yaml": "~2.3|~3.0|~4.0",
"symfony/framework-bundle": "~2.7|~3.0|~4.0",
"symfony/dependency-injection": "~2.7|~3.0|~4.0",
"symfony/yaml": "~2.7|~3.0|~4.0",
"lightsaml/lightsaml": "~1.1"
},
"require-dev": {
"phpunit/phpunit": "~4.5",
"satooshi/php-coveralls": "~0.6"
"symfony/browser-kit": "~2.7|~3.0|~4.0",
"symfony/finder": "~2.7|~3.0|~4.0",
"symfony/filesystem": "~2.7|~3.0|~4.0",
"symfony/routing": "~2.7|~3.0|~4.0",
"phpunit/phpunit": "^5.7",
"php-coveralls/php-coveralls": "~2.0"
},
"suggest": {
"lightsaml/lightsamp-idp": "If you will be using IDP LightSAML services"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,78 +20,109 @@
use LightSaml\Build\Container\StoreContainerInterface;
use LightSaml\Build\Container\SystemContainerInterface;

class BuildContainer extends AbstractContainer implements BuildContainerInterface
class BuildContainer implements BuildContainerInterface
{
/** @var AbstractContainer[] */
private $containers = [];
/** @var SystemContainerInterface */
private $systemsystemContainer;

/** @var PartyContainerInterface */
private $partypartyContainer;

/** @var StoreContainerInterface */
private $storeContainer;

/** @var OwnContainerInterface */
private $ownContainer;

/** @var ProviderContainerInterface */
private $providerContainer;

/** @var ServiceContainerInterface */
private $serviceContainer;

/** @var CredentialContainerInterface */
private $credentialContainer;

/**
* @param SystemContainerInterface $systemContainer
* @param PartyContainerInterface $partyContainer
* @param StoreContainerInterface $storeContainer
* @param ProviderContainerInterface $providerContainer
* @param CredentialContainerInterface $credentialContainer
* @param ServiceContainerInterface $serviceContainer
* @param OwnContainerInterface $ownContainer
*/
public function __construct(
SystemContainerInterface $systemContainer,
PartyContainerInterface $partyContainer,
StoreContainerInterface $storeContainer,
ProviderContainerInterface $providerContainer,
CredentialContainerInterface $credentialContainer,
ServiceContainerInterface $serviceContainer,
OwnContainerInterface $ownContainer
) {
$this->systemsystemContainer = $systemContainer;
$this->partypartyContainer = $partyContainer;
$this->storeContainer = $storeContainer;
$this->providerContainer = $providerContainer;
$this->credentialContainer = $credentialContainer;
$this->serviceContainer = $serviceContainer;
$this->ownContainer = $ownContainer;
}

/**
* @return SystemContainerInterface
*/
public function getSystemContainer()
{
return $this->getContainer(SystemContainer::class);
return $this->systemsystemContainer;
}

/**
* @return PartyContainerInterface
*/
public function getPartyContainer()
{
return $this->getContainer(PartyContainer::class);
return $this->partypartyContainer;
}

/**
* @return StoreContainerInterface
*/
public function getStoreContainer()
{
return $this->getContainer(StoreContainer::class);
return $this->storeContainer;
}

/**
* @return ProviderContainerInterface
*/
public function getProviderContainer()
{
return $this->getContainer(ProviderContainer::class);
return $this->providerContainer;
}

/**
* @return CredentialContainerInterface
*/
public function getCredentialContainer()
{
return $this->getContainer(CredentialContainer::class);
return $this->credentialContainer;
}

/**
* @return ServiceContainerInterface
*/
public function getServiceContainer()
{
return $this->getContainer(ServiceContainer::class);
return $this->serviceContainer;
}

/**
* @return OwnContainerInterface
*/
public function getOwnContainer()
{
return $this->getContainer(OwnContainer::class);
}

/**
* @param string $class
*
* @return AbstractContainer
*/
private function getContainer($class)
{
if (false === isset($this->containers[$class])) {
$this->containers[$class] = new $class($this->container);
}

return $this->containers[$class];
return $this->ownContainer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@
use LightSaml\Build\Container\CredentialContainerInterface;
use LightSaml\Store\Credential\CredentialStoreInterface;

class CredentialContainer extends AbstractContainer implements CredentialContainerInterface
class CredentialContainer implements CredentialContainerInterface
{
/** @var CredentialStoreInterface */
private $credentialStore;

/**
* @param CredentialStoreInterface $credentialStore
*/
public function __construct(CredentialStoreInterface $credentialStore)
{
$this->credentialStore = $credentialStore;
}

/**
* @return CredentialStoreInterface
*/
public function getCredentialStore()
{
return $this->container->get('lightsaml.credential.credential_store');
return $this->credentialStore;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,49 @@
use LightSaml\Build\Container\OwnContainerInterface;
use LightSaml\Credential\CredentialInterface;
use LightSaml\Provider\EntityDescriptor\EntityDescriptorProviderInterface;
use LightSaml\Store\Credential\CredentialStoreInterface;

class OwnContainer extends AbstractContainer implements OwnContainerInterface
class OwnContainer implements OwnContainerInterface
{
/** @var EntityDescriptorProviderInterface */
private $entityDescriptorProvider;

/** @var CredentialStoreInterface */
private $credentialStore;

/** @var string */
private $entityId;

/**
* @param EntityDescriptorProviderInterface $entityDescriptorProvider
* @param CredentialStoreInterface $credentialStore
* @param string $entityId
*/
public function __construct(
EntityDescriptorProviderInterface $entityDescriptorProvider,
CredentialStoreInterface $credentialStore,
$entityId
) {
$this->entityDescriptorProvider = $entityDescriptorProvider;
$this->credentialStore = $credentialStore;
$this->entityId = $entityId;
}

/**
* @return EntityDescriptorProviderInterface
*/
public function getOwnEntityDescriptorProvider()
{
return $this->container->get('lightsaml.own.entity_descriptor_provider');
return $this->entityDescriptorProvider;
}

/**
* @return CredentialInterface[]
*/
public function getOwnCredentials()
{
return $this->container->get('lightsaml.own.credential_store')->getByEntityId(
$this->container->getParameter('lightsaml.own.entity_id')
return $this->credentialStore->getByEntityId(
$this->entityId
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,53 @@
use LightSaml\Store\EntityDescriptor\EntityDescriptorStoreInterface;
use LightSaml\Store\TrustOptions\TrustOptionsStoreInterface;

class PartyContainer extends AbstractContainer implements PartyContainerInterface
class PartyContainer implements PartyContainerInterface
{
/** @var EntityDescriptorStoreInterface */
private $idpEntityDescriptorStore;

/** @var EntityDescriptorStoreInterface */
private $spEntityDescriptorStore;

/** @var TrustOptionsStoreInterface */
private $trustOptionsStore;

/**
* @param EntityDescriptorStoreInterface $idpEntityDescriptorStore
* @param EntityDescriptorStoreInterface $spEntityDescriptorStore
* @param TrustOptionsStoreInterface $trustOptionsStore
*/
public function __construct(
EntityDescriptorStoreInterface $idpEntityDescriptorStore,
EntityDescriptorStoreInterface $spEntityDescriptorStore,
TrustOptionsStoreInterface $trustOptionsStore
) {
$this->idpEntityDescriptorStore = $idpEntityDescriptorStore;
$this->spEntityDescriptorStore = $spEntityDescriptorStore;
$this->trustOptionsStore = $trustOptionsStore;
}

/**
* @return EntityDescriptorStoreInterface
*/
public function getIdpEntityDescriptorStore()
{
return $this->container->get('lightsaml.party.idp_entity_descriptor_store');
return $this->idpEntityDescriptorStore;
}

/**
* @return EntityDescriptorStoreInterface
*/
public function getSpEntityDescriptorStore()
{
return $this->container->get('lightsaml.party.sp_entity_descriptor_store');
return $this->spEntityDescriptorStore;
}

/**
* @return TrustOptionsStoreInterface
*/
public function getTrustOptionsStore()
{
return $this->container->get('lightsaml.party.trust_options_store');
return $this->trustOptionsStore;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,53 @@
use LightSaml\Provider\NameID\NameIdProviderInterface;
use LightSaml\Provider\Session\SessionInfoProviderInterface;

class ProviderContainer extends AbstractContainer implements ProviderContainerInterface
class ProviderContainer implements ProviderContainerInterface
{
/** @var AttributeValueProviderInterface */
private $attributeValueProvider;

/** @var SessionInfoProviderInterface */
private $sessionInfoProvider;

/** @var NameIdProviderInterface */
private $nameIdProvider;

/**
* @param AttributeValueProviderInterface $attributeValueProvider
* @param SessionInfoProviderInterface $sessionInfoProvider
* @param NameIdProviderInterface $nameIdProvider
*/
public function __construct(
AttributeValueProviderInterface $attributeValueProvider,
SessionInfoProviderInterface $sessionInfoProvider,
NameIdProviderInterface $nameIdProvider
) {
$this->attributeValueProvider = $attributeValueProvider;
$this->sessionInfoProvider = $sessionInfoProvider;
$this->nameIdProvider = $nameIdProvider;
}

/**
* @return AttributeValueProviderInterface
*/
public function getAttributeValueProvider()
{
return $this->container->get('lightsaml.provider.attribute_value');
return $this->attributeValueProvider;
}

/**
* @return SessionInfoProviderInterface
*/
public function getSessionInfoProvider()
{
return $this->container->get('lightsaml.provider.session_info');
return $this->sessionInfoProvider;
}

/**
* @return NameIdProviderInterface
*/
public function getNameIdProvider()
{
return $this->container->get('lightsaml.provider.name_id');
}

public function getAttributeNameProvider()
{
return $this->container->get('lightsaml.provider.attribute_name');
return $this->nameIdProvider;
}
}
Loading

0 comments on commit cd6eadf

Please sign in to comment.