Skip to content

Commit

Permalink
PoC new Module system to SSP 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomez authored and tvdijen committed Mar 11, 2021
1 parent 717a609 commit a94d060
Show file tree
Hide file tree
Showing 25 changed files with 8,984 additions and 575 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/config/
/metadata/
/cert/
/var/
/www/assets/fonts/*
/www/assets/js/*.js
!/www/assets/js/post.js
Expand Down
39 changes: 34 additions & 5 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
#!/usr/bin/env php
<?php

use SimpleSAML\Console\Application;
use SimpleSAML\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}

umask(000);
set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';
require dirname(__DIR__).'/vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$input = new ArgvInput();
$module = $input->getParameterOption(['--modules', '-m'], 'core');
$kernel = new Kernel($module);
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/vendor/autoload.php';

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
36 changes: 24 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"files": ["tests/_autoload_modules.php"]
},
"require": {
"php": ">=7.4 || ^8.0 ",
"php": ">=7.4 || ^8.0",
"ext-SPL": "*",
"ext-zlib": "*",
"ext-pcre": "*",
Expand All @@ -53,25 +53,32 @@
"simplesamlphp/assert": "^0.1.0",
"simplesamlphp/saml2": "^4.1",
"simplesamlphp/twig-configurable-i18n": "^2.3",
"symfony/cache": "^4.0 || ^5.0",
"symfony/config": "^4.0 || ^5.0",
"symfony/console": "^4.0 || ^5.0",
"symfony/dependency-injection": "^4.0 || ^5.0",
"symfony/finder": "^4.0 || ^5.0",
"symfony/framework-bundle": "^4.0 || ^5.0",
"symfony/http-foundation": "^4.0 || ^5.0",
"symfony/http-kernel": "^4.0 || ^5.0",
"symfony/routing": "^4.0 || ^5.0",
"symfony/asset": "^4.4 || ^5,0",
"symfony/cache": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/finder": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/http-foundation": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/routing": "^4.4 || ^5.0",
"symfony/translation": "^4.4 || ^5.0",
"symfony/twig-bridge": "^4.4 || ^5.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/var-exporter": "^5.0",
"symfony/yaml": "^4.0 || ^5.0",
"symfony/yaml": "^4.4 || ^5.0",
"twig/twig": "~2.0"
},
"require-dev": {
"ext-curl": "*",
"mikey179/vfsstream": "~1.6",
"simplesamlphp/simplesamlphp-module-adfs": "dev-master",
"simplesamlphp/simplesamlphp-test-framework": "^1.0.5",
"simplesamlphp/xml-security": "^0.0.10"
"simplesamlphp/xml-security": "^0.0.10",
"symfony/web-profiler-bundle": "^4.4 || ^5.0",
"symfony/stopwatch": "^4.4 || ^5,0",
"sgomez/simplesamlphp-module-expirycheck": "dev-master"
},
"suggest": {
"predis/predis": "Needed if a Redis server is used to store session information",
Expand All @@ -86,5 +93,10 @@
"support": {
"issues": "https://github.com/simplesamlphp/simplesamlphp/issues",
"source": "https://github.com/simplesamlphp/simplesamlphp"
},
"scripts": {
"post-install-cmd": [
"bin/console cache:clear"
]
}
}
Loading

0 comments on commit a94d060

Please sign in to comment.