Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 30 additions & 26 deletions DependencyInjection/SSPGuardExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,39 @@ public function load(array $configs, ContainerBuilder $container)
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);

$container->setParameter('ssp_guard.installation_path', $config['installation_path']);
if (method_exists($container, 'resolveEnvPlaceholders')) {
$container->setParameter('ssp_guard.installation_path', $container->resolveEnvPlaceholders($container->getParameter('ssp_guard.installation_path'), true));
}

// Find SimpleSAMLphp _autoload.php file
$autoloadPath = sprintf('%s/lib/_autoload.php', rtrim($container->getParameter('ssp_guard.installation_path'), '/'));
if (false === file_exists($autoloadPath)) {
throw new InvalidConfigurationException('The path "ssp_guard.installation_path" doesn\'t contain a valid SimpleSAMLphp installation: '.$autoloadPath);
}
$this->autoloadPath = $autoloadPath;

$authSources = $config['auth_sources'];
$authSourcesKeys = [];

foreach ($authSources as $key => $authSource) {
$tree = new TreeBuilder();
$node = $tree->root('ssp_guard/auth_sources/'.$key);
$this->buildConfigurationForAuthSource($node, $key);
$processor = new Processor();
$config = $processor->process($tree->buildTree(), [$authSource]);

$authSourceKey = $this->configureAuthSource(
$container,
$key,
$config
);

$authSourcesKeys[$key] = $authSourceKey;
// Only configure the bundle if we have a configuration
if (count($authSources) > 0) {

$container->setParameter('ssp_guard.installation_path', $config['installation_path']);
if (method_exists($container, 'resolveEnvPlaceholders')) {
$container->setParameter('ssp_guard.installation_path', $container->resolveEnvPlaceholders($container->getParameter('ssp_guard.installation_path'), true));
}

// Find SimpleSAMLphp _autoload.php file
$autoloadPath = sprintf('%s/lib/_autoload.php', rtrim($container->getParameter('ssp_guard.installation_path'), '/'));
if (false === file_exists($autoloadPath)) {
throw new InvalidConfigurationException('The path "ssp_guard.installation_path" doesn\'t contain a valid SimpleSAMLphp installation: '.$autoloadPath);
}
$this->autoloadPath = $autoloadPath;

foreach ($authSources as $key => $authSource) {
$tree = new TreeBuilder();
$node = $tree->root('ssp_guard/auth_sources/'.$key);
$this->buildConfigurationForAuthSource($node, $key);
$processor = new Processor();
$config = $processor->process($tree->buildTree(), [$authSource]);

$authSourceKey = $this->configureAuthSource(
$container,
$key,
$config
);

$authSourcesKeys[$key] = $authSourceKey;
}
}

$container->getDefinition('ssp.guard.registry')
Expand Down