Update por le dev
This commit is contained in:
parent
9db2ad1a68
commit
f1a62c55df
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace MVC\Classe;
|
||||
|
||||
|
||||
class Dumper{
|
||||
|
||||
public static function dump($var){
|
||||
class Dumper
|
||||
{
|
||||
public static function dump($var)
|
||||
{
|
||||
echo "<pre>";
|
||||
if (is_bool($var)) {
|
||||
echo ($var) ? "true" : "false";
|
||||
|
@ -21,7 +21,6 @@ class Dumper{
|
|||
*/
|
||||
public static function setPHPvalues()
|
||||
{
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('memory_limit', -1);
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
|
||||
namespace MVC\Classe;
|
||||
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Date;
|
||||
|
||||
class Logger
|
||||
{
|
||||
|
||||
static function addLog($type = 'default', $what = "")
|
||||
public static function addLog($type = 'default', $what = "")
|
||||
{
|
||||
$file = LOG_PATH . DIRECTORY_SEPARATOR . 'app.' . $type . '.log';
|
||||
$browser = new Browser();
|
||||
|
@ -41,5 +39,4 @@ class Logger
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,8 +15,11 @@ define("PUBLIC_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR
|
|||
define("CONSOLE_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "console");
|
||||
define("DATA_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "data");
|
||||
|
||||
<<<<<<< HEAD:application/config/define-constantes.php
|
||||
// De base laisser vide,
|
||||
// sauf si l'application est hebergé sur de multiples sous-repertoire en ajoutant le slash_final
|
||||
// par exemple : "my-app/"
|
||||
// ou : "my-app/dev/
|
||||
define("BASE_SERVER_DIRECTORY", "");
|
||||
=======
|
||||
>>>>>>> master-dev:application/config/app-constantes.php
|
11
application/config/app-parameters.php
Normal file
11
application/config/app-parameters.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
|
||||
// De base laisser vide,
|
||||
// sauf si l'application est hebergé sur de multiples sous-repertoire en ajoutant le slash_final
|
||||
// par exemple : "my-app/"
|
||||
// ou : "my-app/dev/
|
||||
define("BASE_SERVER_DIRECTORY", "");
|
||||
|
||||
// Optionnel! il n'est nécessaire que si vous l'utilisez dans les fichier de traitement
|
||||
define('PATH_URL', $_SERVER['REQUEST_SCHEME'] . "://www.domain.org");
|
14
application/config/bdd-parameters.php
Normal file
14
application/config/bdd-parameters.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
|
||||
define('DSN_BDD_DEFAULT', "mysql:host=localhost;dbname=default");
|
||||
define('USER_BDD_DEFAULT', "user_default");
|
||||
define('PASS_BDD_DEFAULT', "pass_default");
|
||||
|
||||
define('DSN_BDD1', "mysql:host=localhost;dbname=db1");
|
||||
define('USER_BDD1', "user1");
|
||||
define('PASS_BDD1', "pass1");
|
||||
|
||||
define('DSN_BDD2', "mysql:host=localhost;dbname=db2");
|
||||
define('USER_BDD2', "user2");
|
||||
define('PASS_BDD2', "pass2");
|
102
application/config/cas-authentification-config-example.php
Normal file
102
application/config/cas-authentification-config-example.php
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The purpose of this central config file is configuring all examples
|
||||
* in one place with minimal work for your working environment
|
||||
* Just configure all the items in this config according to your environment
|
||||
* and rename the file to config.php
|
||||
*
|
||||
* PHP Version 5
|
||||
*
|
||||
* @file config.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
$phpcas_path = '../../source/';
|
||||
|
||||
///////////////////////////////////////
|
||||
// Basic Config of the phpCAS client //
|
||||
///////////////////////////////////////
|
||||
|
||||
// Full Hostname of your CAS Server
|
||||
$cas_host = 'cas.domain.fr';
|
||||
// Context of the CAS Server
|
||||
$cas_context = 'cas';
|
||||
// Port of your CAS server. Normally for a https server it's 443
|
||||
$cas_port = 443;
|
||||
// Path to the ca chain that issued the cas server certificate
|
||||
$cas_server_ca_cert_path = '';
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Advanced Config for special purposes //
|
||||
//////////////////////////////////////////
|
||||
/*
|
||||
// The "real" hosts of clustered cas server that send SAML logout messages
|
||||
// Assumes the cas server is load balanced across multiple hosts
|
||||
$cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com');
|
||||
|
||||
// Client config for cookie hardening
|
||||
$client_domain = '127.0.0.1';
|
||||
$client_path = 'phpcas';
|
||||
$client_secure = true;
|
||||
$client_httpOnly = true;
|
||||
$client_lifetime = 0;
|
||||
|
||||
// Database config for PGT Storage
|
||||
$db = 'pgsql:host=localhost;dbname=phpcas';
|
||||
//$db = 'mysql:host=localhost;dbname=phpcas';
|
||||
$db_user = 'phpcasuser';
|
||||
$db_password = 'mysupersecretpass';
|
||||
$db_table = 'phpcastabel';
|
||||
$driver_options = '';
|
||||
|
||||
///////////////////////////////////////////
|
||||
// End Configuration -- Don't edit below //
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Generating the URLS for the local cas example services for proxy testing
|
||||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
|
||||
$curbase = 'https://' . $_SERVER['SERVER_NAME'];
|
||||
} else {
|
||||
$curbase = 'http://' . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
||||
$curbase .= ':' . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
$curdir = dirname($_SERVER['REQUEST_URI']) . "/";
|
||||
|
||||
// CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest
|
||||
$rebroadcast_node_1 = 'http://cas-client-1.example.com';
|
||||
$rebroadcast_node_2 = 'http://cas-client-2.example.com';
|
||||
|
||||
// access to a single service
|
||||
$serviceUrl = $curbase . $curdir . 'example_service.php';
|
||||
// access to a second service
|
||||
$serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php';
|
||||
|
||||
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/');
|
||||
$pgtUrlRegexp = '/^' . $pgtBase . '.*$/';
|
||||
|
||||
$cas_url = 'https://' . $cas_host;
|
||||
if ($cas_port != '443') {
|
||||
$cas_url = $cas_url . ':' . $cas_port;
|
||||
}
|
||||
$cas_url = $cas_url . $cas_context;
|
||||
|
||||
// Set the session-name to be unique to the current script so that the client script
|
||||
// doesn't share its session with a proxied script.
|
||||
// This is just useful when running the example code, but not normally.
|
||||
session_name(
|
||||
'session_for-'
|
||||
. preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME']))
|
||||
);
|
||||
// Set an UTF-8 encoding header for internation characters (User attributes)
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
?>
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
home_route:
|
||||
path: /
|
||||
defaults: { controller: 'FooController::indexAction' }
|
||||
defaults: { controller: '' }
|
||||
|
||||
foo_route:
|
||||
path: /foo
|
||||
|
@ -11,11 +11,3 @@ foo_placeholder_route:
|
|||
defaults: { controller: 'FooConduit::load' }
|
||||
requirements:
|
||||
id: '[0-9]+'
|
||||
|
||||
docs_route:
|
||||
path: /docs
|
||||
defaults: { controller: 'DocConduit::index' }
|
||||
|
||||
docs_name_route:
|
||||
path: /docs/file/{name}
|
||||
defaults: { controller: 'DocConduit::readfile' }
|
|
@ -14,22 +14,22 @@ $config = [
|
|||
'providers' => [
|
||||
'GitHub' => [
|
||||
'enabled' => true,
|
||||
'keys' => ['id' => '4cc55bcafbf8ea77ae14', 'secret' => 'e0b7c5091d7af4f4e5ced843f2e8ce1f38f02578'],
|
||||
'keys' => ['id' => '4cc55bcafbf8ea77ae14', 'secret' => ''],
|
||||
],
|
||||
|
||||
'Google' => [
|
||||
'enabled' => true,
|
||||
'keys' => ['id' => '686670374445-mhktaj9gp08p6oiu8e1aue3ckua6e3s3.apps.googleusercontent.com', 'secret' => '4yOeNxYuYE4H8DFhVzQlOb_U'],
|
||||
'keys' => ['id' => '686670374445-mhktaj9gp08p6oiu8e1aue3ckua6e3s3.apps.googleusercontent.com', 'secret' => ''],
|
||||
],
|
||||
|
||||
'Facebook' => [
|
||||
'enabled' => true,
|
||||
'keys' => ['id' => '432266300978748', 'secret' => '43815184db62771fce19b64cdd80110a'],
|
||||
'keys' => ['id' => '432266300978748', 'secret' => ''],
|
||||
],
|
||||
|
||||
'Twitter' => [
|
||||
'enabled' => true,
|
||||
'keys' => ['key' => 'gnsmsVW0EkdpSVeqwCOG7V1H5', 'secret' => 'cdv71bFMUV4OBpkjFIwPNOlbRBQhrAaWBTmLF8aPzZBeMf3PyQ'],
|
||||
'keys' => ['key' => 'gnsmsVW0EkdpSVeqwCOG7V1H5', 'secret' => ''],
|
||||
]
|
||||
],
|
||||
//optional : set debug mode
|
|
@ -55,7 +55,6 @@ class DefaultAction extends Action
|
|||
|
||||
public function makeHttp11($data)
|
||||
{
|
||||
|
||||
$data = array('myval' => 25);
|
||||
//Dumper::dump($data);
|
||||
\MVC\Classe\Logger::addLog('action', 'http11 make request');
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
use MVC\Classe\HttpMethodRequete;
|
||||
use MVC\Classe\Implement\Action;
|
||||
use MVC\Classe\Url;
|
||||
use MVC\Classe\Response;
|
||||
|
||||
class MenudocsAction extends Action
|
||||
{
|
||||
public function default($data)
|
||||
{
|
||||
|
||||
|
||||
$files = array();
|
||||
|
||||
if ($handle = opendir(DATA_PATH.'/docs')) {
|
||||
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
|
||||
if ($entry != "." && $entry != "..") {
|
||||
|
||||
$files[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
asort($files);
|
||||
|
||||
return $this->render('menu-docs', array('files'=>$files));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Michelf\MarkdownExtra;
|
||||
use MVC\Classe\Implement\Conduit;
|
||||
|
||||
class DocConduit extends Conduit
|
||||
{
|
||||
// Route('/docs')
|
||||
public function index()
|
||||
{
|
||||
|
||||
$files = array();
|
||||
|
||||
if ($handle = opendir(DATA_PATH.'/docs')) {
|
||||
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
|
||||
if ($entry != "." && $entry != "..") {
|
||||
|
||||
$files[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
asort($files);
|
||||
|
||||
return $this->render('docs', array('page_title' => 'Foo', 'description' => 'DocConduit','files' => $files));
|
||||
}
|
||||
// Route('/docs/file/{name}')
|
||||
public function readfile(){
|
||||
|
||||
$markdown = file_get_contents(DATA_PATH.'/docs/'.$this->name);
|
||||
|
||||
$my_html = MarkdownExtra::defaultTransform($markdown);
|
||||
|
||||
return $this->render('docs', array('page_title' => 'Foo', 'description' => 'DocConduit','data' => $my_html));
|
||||
|
||||
}
|
||||
}
|
|
@ -17,6 +17,5 @@ class FooConduit extends Conduit
|
|||
{
|
||||
echo "load of foo";
|
||||
return $this->render('foo', array('page_title' => 'Foo', 'description' => 'FooConduit', 'id' => $this->id));
|
||||
|
||||
}
|
||||
}
|
14
application/include/conduits/IndexConduit.php
Normal file
14
application/include/conduits/IndexConduit.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
|
||||
use MVC\Classe\Implement\Conduit;
|
||||
|
||||
class IndexConduit extends Conduit
|
||||
{
|
||||
// Route('/')
|
||||
public function homepage()
|
||||
{
|
||||
echo "IndexControlleur";
|
||||
return $this->render('index', array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge'));
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
use MVC\Classe\Implement\RestReponse;
|
||||
use MVC\Classe\Logger;
|
||||
|
||||
class AccueilHttpReponse extends RestReponse
|
||||
{
|
||||
|
||||
public function put()
|
||||
{
|
||||
ob_start();
|
||||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('http11.put', '____Hello Put____' . PHP_EOL . $text);
|
||||
}
|
||||
public function delete()
|
||||
{
|
||||
ob_start();
|
||||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('http11.delete', '____Hello Delete:____' . PHP_EOL . $text);
|
||||
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
ob_start();
|
||||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('http11.get', '____Hello GET____' . PHP_EOL . $text);
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
ob_start();
|
||||
Dumper::dump($this->params);
|
||||
Dumper::dump($this->data);
|
||||
$text = ob_get_clean();
|
||||
Logger::addLog('http11.post', '____Hello POST____' . PHP_EOL . $text);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Implement\RestReponse;
|
||||
use MVC\Classe\Logger;
|
||||
|
||||
class ErrorHttpReponse extends RestReponse
|
||||
{
|
||||
public function put()
|
||||
{
|
||||
Logger::addLog('put', 'Error PUT');
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
Logger::addLog('delete', 'Error DELETE');
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
Logger::addLog('get', 'Error GET');
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
Logger::addLog('post', 'Error POST');
|
||||
}
|
||||
}
|
1
application/include/controlleurs/admin.php
Normal file
1
application/include/controlleurs/admin.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
try {
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$storage = new Hybridauth\Storage\Session();
|
||||
$error = false;
|
||||
|
||||
//
|
||||
// Event 1: User clicked SIGN-IN link
|
||||
//
|
||||
if (isset($url_params['provider'])) {
|
||||
// Validate provider exists in the $config
|
||||
if (in_array($url_params['provider'], $hybridauth->getProviders())) {
|
||||
// Store the provider for the callback event
|
||||
$storage->set('provider', $url_params['provider']);
|
||||
\MVC\Classe\Session::setStorage($storage);
|
||||
\MVC\Classe\Session::setUserProfile(array());
|
||||
} else {
|
||||
$error = $url_params['provider'];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Event 2: User clicked LOGOUT link
|
||||
//
|
||||
if (isset($url_params['logout'])) {
|
||||
if (in_array($url_params['logout'], $hybridauth->getProviders())) {
|
||||
// Disconnect the adapter
|
||||
$adapter = $hybridauth->getAdapter($url_params['logout']);
|
||||
$adapter->disconnect();
|
||||
} else {
|
||||
$error = $url_params['logout'];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Event 3: Provider returns via CALLBACK
|
||||
//
|
||||
if ($url_params['provider'] = $storage->get('provider')) {
|
||||
|
||||
\MVC\Classe\Session::setHybridAuth($hybridauth);
|
||||
$hybridauth->authenticate($url_params['provider']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$adapters = $hybridauth->getConnectedAdapters();
|
||||
|
||||
$templateData['hybridauth'] = $hybridauth;
|
||||
$templateData['adapters'] = $adapters;
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
use MVC\Classe\Logger;
|
||||
|
||||
$templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge');
|
||||
Logger::addLog('ok', 'Hello world');
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
\MVC\Classe\Session::redirectIfNotRegistered();
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$hybridauth->authenticate(\MVC\Classe\Session::getStorage()->get('provider'));
|
||||
$adapters = $hybridauth->getConnectedAdapters();
|
||||
foreach ($adapters as $adapter){
|
||||
$userProfile[] = $adapter->getUserProfile();
|
||||
\MVC\Classe\Session::setId($adapter->getUserProfile()->identifier);
|
||||
\MVC\Classe\Session::setUserName($adapter->getUserProfile()->displayName);
|
||||
}
|
||||
\MVC\Classe\Session::setUserProfile($userProfile);
|
||||
|
||||
//Dumper::dump($_SESSION);
|
||||
|
||||
$templateData['adapters'] = $adapters;
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use MVC\Classe\Dumper;
|
||||
|
||||
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
|
||||
|
||||
try {
|
||||
|
||||
\MVC\Classe\Session::start();
|
||||
|
||||
$hybridauth = new Hybridauth\Hybridauth($config);
|
||||
$storage = new Hybridauth\Storage\Session();
|
||||
$error = false;
|
||||
|
||||
//
|
||||
// Event 2: User clicked LOGOUT link
|
||||
//
|
||||
if (isset($url_params['logout'])) {
|
||||
if (in_array($url_params['logout'], $hybridauth->getProviders())) {
|
||||
// Disconnect the adapter
|
||||
$adapter = $hybridauth->getAdapter($url_params['logout']);
|
||||
$adapter->disconnect();
|
||||
\MVC\Classe\Session::destroy();
|
||||
header("location: ".MVC\Classe\Url::link_rewrite(false,'accueil'));
|
||||
} else {
|
||||
$error = $url_params['logout'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
}
|
6
application/include/modeles/admin.model
Normal file
6
application/include/modeles/admin.model
Normal file
|
@ -0,0 +1,6 @@
|
|||
name : admin
|
||||
page_title : Administration de l'application
|
||||
description : Administration de l'application
|
||||
engine : blade
|
||||
params : params
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
name : authentificate
|
||||
page_title: Hybrid Authentification de l'application
|
||||
description : La page d'authentification
|
||||
params : params
|
|
@ -1,4 +0,0 @@
|
|||
name : authentification
|
||||
page_title: Hybrid Authentification de l'application
|
||||
description : La page d'authentification
|
||||
params : params
|
|
@ -1,5 +0,0 @@
|
|||
name : beers
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
params : module_params
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
name : cgu
|
||||
page_title: Conditions Générale d'Utilisation de l'application
|
||||
description : abracadabla
|
||||
engine : blade
|
||||
params : params
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
name : compte
|
||||
page_title: Compte(s) utilisateurs de l'application
|
||||
description : La page d'accès privé
|
||||
params : params
|
|
@ -1,4 +1,5 @@
|
|||
name : error
|
||||
page_title: Erreurs de l'application
|
||||
description : abracadabla
|
||||
engine : blade
|
||||
params : params
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
name : accueil
|
||||
name : index
|
||||
page_title : Accueil de l'application
|
||||
description : zatou stra bracadabla
|
||||
engine : blade
|
||||
params : params
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
name : logout
|
||||
page_title: Hybrid Authentification de l'application
|
||||
description : La page d'authentification
|
||||
params : params
|
|
@ -1,4 +1,5 @@
|
|||
name : policy
|
||||
page_title: Politique de Confidentialité de l'application
|
||||
description : abracadabla
|
||||
engine : blade
|
||||
params : params
|
||||
|
|
|
@ -7,33 +7,11 @@
|
|||
<div id="topbar" class="d-none d-xl-block d-lg-block topbar-transparent topbar-fullwidth dark"
|
||||
style="background: rgba(0, 0, 0, 0.59);">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<ul class="top-menu">
|
||||
<li><a href="#">About</a></li>
|
||||
<li><a href="#">Features</a></li>
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Beers', []) }}">Pricing</a></li>
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Policy', []) }}">Policy</a></li>
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'CGU', []) }}"> CGU Terms</a></li>
|
||||
<li @if($name == 'policy') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Policy', []) }}">Policy</a></li>
|
||||
<li @if($name == 'cgu') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'CGU', []) }}"> CGU Terms</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6 d-none d-sm-block">
|
||||
<div class="social-icons social-icons-colored-hover">
|
||||
<ul>
|
||||
<li class="social-facebook"><a href="#"><i class="fab fa-facebook-f"></i></a></li>
|
||||
<li class="social-twitter"><a href="#"><i class="fab fa-twitter"></i></a></li>
|
||||
<li class="social-google"><a href="#"><i class="fab fa-google-plus-g"></i></a></li>
|
||||
<li class="social-pinterest"><a href="#"><i class="fab fa-pinterest"></i></a></li>
|
||||
<li class="social-vimeo"><a href="#"><i class="fab fa-vimeo"></i></a></li>
|
||||
<li class="social-linkedin"><a href="#"><i class="fab fa-linkedin"></i></a></li>
|
||||
<li class="social-dribbble"><a href="#"><i class="fab fa-dribbble"></i></a></li>
|
||||
<li class="social-youtube"><a href="#"><i class="fab fa-youtube"></i></a></li>
|
||||
<li class="social-rss"><a href="#"><i class="fa fa-rss"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end: Topbar -->
|
||||
<!-- Header -->
|
||||
|
@ -43,40 +21,12 @@
|
|||
<div class="container">
|
||||
<!--Logo-->
|
||||
<div id="logo">
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'accueil', []) }}">
|
||||
<span class="logo-default">SAND framework</span>
|
||||
<span class="logo-dark">SAND framework</span>
|
||||
<a href="#">
|
||||
<span class="logo-default"></span>
|
||||
<span class="logo-dark"></span>
|
||||
</a>
|
||||
</div>
|
||||
<!--End: Logo-->
|
||||
<!-- Search -->
|
||||
<div id="search"><a id="btn-search-close" class="btn-search-close" aria-label="Close search form"><i
|
||||
class="icon-x"></i></a>
|
||||
<form class="search-form" action="#" method="get">
|
||||
<input class="form-control" name="q" type="search" placeholder="Type & Search..."/>
|
||||
<span class="text-muted">Start typing & press "Enter" or "ESC" to close</span>
|
||||
</form>
|
||||
</div>
|
||||
<!-- end: search -->
|
||||
<!--Header Extras-->
|
||||
<div class="header-extras">
|
||||
<ul>
|
||||
<li>
|
||||
<a id="btn-search" href="#"> <i class="icon-search"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="p-dropdown">
|
||||
<a href="#"><i class="icon-globe"></i><span>FR</span></a>
|
||||
<ul class="p-dropdown-content">
|
||||
<li><a href="#">Français</a></li>
|
||||
<li><a href="#">Deutsch</a></li>
|
||||
<li><a href="#">English</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--end: Header Extras-->
|
||||
<!--Navigation Resposnive Trigger-->
|
||||
<div id="mainMenu-trigger">
|
||||
<a class="lines-button x"><span class="lines"></span></a>
|
||||
|
@ -87,30 +37,8 @@
|
|||
<div class="container">
|
||||
<nav>
|
||||
<ul>
|
||||
@if (\MVC\Classe\Session::isRegistered())
|
||||
<li>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'prestashop', ['admin-dev']) }}">E-commerce</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ \MVC\Classe\Url::module_link_rewrite( 'wordpress', ['wp-admin']) }}">Blog</a>
|
||||
</li>
|
||||
<li><a href="{{ \MVC\Classe\Url::module_link_rewrite( 'phplist', ['admin']) }}">Newsletter</a>
|
||||
</li>
|
||||
@else
|
||||
<li><a href="{{ \MVC\Classe\Url::module_link_rewrite( 'prestashop', ['']) }}">E-commerce</a>
|
||||
</li>
|
||||
<li><a href="{{ \MVC\Classe\Url::module_link_rewrite( 'wordpress', ['']) }}">Blog</a>
|
||||
</li>
|
||||
<li><a href="{{ \MVC\Classe\Url::module_link_rewrite( 'phplist', ['']) }}">Newsletter</a>
|
||||
</li>
|
||||
@endif
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'symfony', []) }}">Symfony
|
||||
5.1</a></li>
|
||||
|
||||
<li class="dropdown"><a
|
||||
href="#">Documentation</a>
|
||||
{{\MVC\Classe\ControlleurAction::inserer('menudocs.default',[])}}
|
||||
</li>
|
||||
<li @if($name == 'search') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Index', []) }}">Index</a></li>
|
||||
<li @if($name == 'admin') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Admin', []) }}">Admin</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -134,68 +62,18 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<div class="widget">
|
||||
<div class="widget-title">SAND Framework</div>
|
||||
<p class="mb-5">Built with love in Besançon, Doubs, France<br>
|
||||
All rights reserved. Copyright © 2020. Info[ARTS]Media</p>
|
||||
<a href="#"
|
||||
class="btn btn-inverted">Purchase Now</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="widget">
|
||||
<div class="widget-title">Discover</div>
|
||||
<ul class="list">
|
||||
<li><a href="#">Features</a></li>
|
||||
<li><a href="#">Layouts</a></li>
|
||||
<li><a href="#">Corporate</a></li>
|
||||
<li><a href="#">Updates</a></li>
|
||||
<li><a href="#">Pricing</a></li>
|
||||
<li><a href="#">Customers</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="widget">
|
||||
<div class="widget-title">Features</div>
|
||||
<ul class="list">
|
||||
<li><a href="#">Layouts</a></li>
|
||||
<li><a href="#">Headers</a></li>
|
||||
<li><a href="#">Widgets</a></li>
|
||||
<li><a href="#">Footers</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="widget">
|
||||
<div class="widget-title">Pages</div>
|
||||
<ul class="list">
|
||||
<li><a href="#">Portfolio</a></li>
|
||||
<li><a href="#">Blog</a></li>
|
||||
<li><a href="#">Shop</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="widget">
|
||||
<div class="widget-title">Support</div>
|
||||
<ul class="list">
|
||||
<li><a href="#">Help Desk</a></li>
|
||||
<li><a href="#">Documentation</a></li>
|
||||
<li><a href="#">Contact Us</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-title"></div>
|
||||
<p class="mb-5">
|
||||
<img src="{{ \MVC\Classe\Url::asset_rewrite('assets/img/beer.svg') }}" width="150">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copyright-content">
|
||||
<div class="container">
|
||||
<div class="copyright-text text-center">© 2020 SAND Framework - Responsive FrameWork Template.
|
||||
All Rights Reserved.<a href="http://infoartsmedia.fr" target="_blank"> Info[ARTS]Media</a></div>
|
||||
<div class="copyright-text text-center">© 2020-2021 Built with SAND Framework - Responsive FrameWork Template.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -9,9 +9,14 @@
|
|||
<meta name="description" lang="fr" content="{{$description}}"/>
|
||||
|
||||
@section('top-css')
|
||||
<<<<<<< HEAD
|
||||
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/css/main.css')}}">
|
||||
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/css/plugins.css')}}">
|
||||
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/css/style.css')}}">
|
||||
=======
|
||||
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/bootstrap-5.0.0-beta1-dist/css/bootstrap.min.css')}}">
|
||||
<link rel="stylesheet" href="{{ \MVC\Classe\Url::asset_rewrite('assets/css/custom.css')}}">
|
||||
>>>>>>> master-dev
|
||||
@show
|
||||
|
||||
</head>
|
||||
|
@ -24,11 +29,16 @@
|
|||
@yield('body')
|
||||
|
||||
@section('bottom-javascript')
|
||||
<<<<<<< HEAD
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/script.js')}}" defer="defer"></script>
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/jquery.js')}}"></script>
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/plugins.js')}}"></script>
|
||||
<!--Template functions-->
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/functions.js')}}"></script>
|
||||
=======
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/bootstrap-5.0.0-beta1-dist/js/bootstrap.min.js')}}"></script>
|
||||
<script src="{{ \MVC\Classe\Url::asset_rewrite('assets/js/custom.js')}}"></script>
|
||||
>>>>>>> master-dev
|
||||
@show
|
||||
|
||||
</body>
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
|
||||
@parent
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
@endsection
|
||||
|
||||
@section('top-javascript')
|
||||
<h1>Admin</h1>
|
||||
<br /><br /><br />
|
||||
|
||||
@endsection
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h1>Sign in</h1>
|
||||
|
||||
<ul>
|
||||
@foreach ($hybridauth->getProviders() as $name)
|
||||
@if (!isset($adapters[$name]))
|
||||
<li>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite(false, 'authentificate', ['provider' => $name]) }}">
|
||||
Sign in with {{ $name }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
@endsection
|
||||
|
||||
@section('top-javascript')
|
||||
@endsection
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'authentification', []) }}">Authentification</a>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<h1>Compte utilisateur</h1>
|
||||
|
||||
@if ($adapters)
|
||||
<h1>You are logged in:</h1>
|
||||
<ul>
|
||||
@foreach ($adapters as $name => $adapter)
|
||||
<li>
|
||||
from <i>{{ $name }}</i>
|
||||
{{ \MVC\Classe\Dumper::dump($adapter->getUserProfile()) }}
|
||||
<!--<span>(<a href="{{ \MVC\Classe\Url::link_rewrite( true, 'authentification-callback-example', ['logout'=>$name ]) }}"
|
||||
">Log Out</a>)</span>-->
|
||||
<span>(<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'logout', ['logout'=>$name ]) }}">Log Out</a>)</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
|
||||
@endsection
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@if (isset($files))
|
||||
|
||||
<h1>Sommaire:</h1>
|
||||
|
||||
@foreach( $files as $file)
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$file]) }}">{{ $file }}</a> <br/>
|
||||
@endforeach
|
||||
@endif
|
||||
@if (isset($data))
|
||||
{{$data}}
|
||||
@endif
|
||||
@endsection
|
|
@ -1,11 +1,80 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>App Name</title>
|
||||
</head>
|
||||
<body>
|
||||
@extends('body')
|
||||
|
||||
@section('top-css')
|
||||
@parent
|
||||
<style>
|
||||
#countUp {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
#countUp .number {
|
||||
font-size: 4rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
#countUp .number + .text {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
#countUp .text {
|
||||
font-weight: 300;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
ERROR
|
||||
<div class="row">
|
||||
<div class="xs-12 md-6 mx-auto">
|
||||
<div id="countUp">
|
||||
<div class="number" data-count="404">0</div>
|
||||
<div class="text">Page not found</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('bottom-javascript')
|
||||
@parent
|
||||
<script src="https://cdn.3up.dk/in-view@0.6.1"></script>
|
||||
<script type="text/javascript">
|
||||
var formatThousandsNoRounding = function(n, dp){
|
||||
var e = '', s = e+n, l = s.length, b = n < 0 ? 1 : 0,
|
||||
i = s.lastIndexOf(','), j = i == -1 ? l : i,
|
||||
r = e, d = s.substr(j+1, dp);
|
||||
while ( (j-=3) > b ) { r = '.' + s.substr(j, 3) + r; }
|
||||
return s.substr(0, j + 3) + r +
|
||||
(dp ? ',' + d + ( d.length < dp ?
|
||||
('00000').substr(0, dp - d.length):e):e);
|
||||
};
|
||||
|
||||
var hasRun = false;
|
||||
|
||||
inView('#countUp').on('enter', function() {
|
||||
if (hasRun == false) {
|
||||
$('.number').each(function() {
|
||||
var $this = $(this),
|
||||
countTo = $this.attr('data-count');
|
||||
|
||||
$({ countNum: $this.text()}).animate({
|
||||
countNum: countTo
|
||||
},
|
||||
{
|
||||
duration: 2000,
|
||||
easing:'linear',
|
||||
step: function() {
|
||||
$this.text(formatThousandsNoRounding(Math.floor(this.countNum)));
|
||||
},
|
||||
complete: function() {
|
||||
$this.text(formatThousandsNoRounding(this.countNum));
|
||||
}
|
||||
});
|
||||
});
|
||||
hasRun = true;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -1,16 +0,0 @@
|
|||
@extends('body')
|
||||
|
||||
@section('sidebar')
|
||||
@parent
|
||||
|
||||
<p>This is appended to the master sidebar.</p>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
Foo Controlleur
|
||||
@if (isset($id))
|
||||
{{$id}}
|
||||
@else
|
||||
id not exist
|
||||
@endif
|
||||
@endsection
|
|
@ -7,7 +7,8 @@
|
|||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h1>Accueil</h1>
|
||||
<h1>Accueil de l'url</h1>
|
||||
<h2> {{$_SERVER['SERVER_NAME']}}</h2>
|
||||
<br /><br /><br />
|
||||
<a href="{{ \MVC\Classe\Url::link_rewrite(false, 'authentification', []) }}">S'authentifier ?</a>
|
||||
<hr/>
|
1
application/include/vues/view/index.html.twig
Normal file
1
application/include/vues/view/index.html.twig
Normal file
|
@ -0,0 +1 @@
|
|||
INDEX
|
|
@ -1,8 +0,0 @@
|
|||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', []) }}">Summary</a></li>
|
||||
@if (isset($files))
|
||||
@foreach( $files as $file)
|
||||
<li><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$file]) }}">{{ $file }}</a><li>
|
||||
@endforeach
|
||||
@endif
|
||||
</ul>
|
|
@ -1,15 +1,13 @@
|
|||
<?php
|
||||
|
||||
require OBJETS_PATH.DIRECTORY_SEPARATOR."dns.class.php";
|
||||
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
$bdd = new Bdd();
|
||||
$dns = Dns::getDNS($bdd,$url_params['ip']);
|
||||
$dns = \MVC\Domain\Dns::getDNS($bdd, $url_params['ip']);
|
||||
$alias = array();
|
||||
$reverseDns = Dns::getReverseDNS($bdd,$url_params['ip']);
|
||||
$reverseDns = \MVC\Domain\Dns::getReverseDNS($bdd, $url_params['ip']);
|
||||
foreach ($reverseDns as $row) {
|
||||
$tab = Dns::getAliasFromDNS($bdd,$row['valeur2_dns']);
|
||||
$tab = \MVC\Domain\Dns::getAliasFromDNS($bdd, $row['valeur2_dns']);
|
||||
$alias[] = $tab;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
<?php
|
||||
|
||||
require OBJETS_PATH.DIRECTORY_SEPARATOR."host.class.php";
|
||||
|
||||
$path = PATH_URL;
|
||||
$bdd = new Bdd();
|
||||
$bdd = new \MVC\Classe\Bdd();
|
||||
|
||||
Host::addHost($bdd,$_POST['ip'],$_POST['nom']);
|
||||
\MVC\Domain\Host::addHost($bdd, $_POST['ip'], $_POST['nom']);
|
||||
|
||||
switch ($_POST['from']) {
|
||||
case "vlan-zone+":
|
||||
|
|
|
@ -1,28 +1,42 @@
|
|||
{
|
||||
|
||||
"autoload": {
|
||||
"files": [
|
||||
"./application/config/define-constantes.php"
|
||||
"./application/config/app-constantes.php",
|
||||
"./application/config/app-parameters.php",
|
||||
"./application/config/bdd-parameters.php"
|
||||
],
|
||||
|
||||
"psr-4": {
|
||||
"MVC\\Classe\\" : "./application/class",
|
||||
"MVC\\Domain\\" : "./domain",
|
||||
"MVC\\Command\\": "./console/command"
|
||||
}
|
||||
},
|
||||
|
||||
"require": {
|
||||
<<<<<<< HEAD
|
||||
"php": "^7.4",
|
||||
=======
|
||||
"php": "^8",
|
||||
>>>>>>> master-dev
|
||||
"ext-json": "*",
|
||||
"ext-pdo": "*",
|
||||
"ext-curl": "*",
|
||||
"windwalker/renderer": "3.*",
|
||||
"illuminate/view": "4.*",
|
||||
"hybridauth/hybridauth": "^3.2",
|
||||
"neitanod/forceutf8": "^2.0",
|
||||
"symfony/routing": "3.4.36",
|
||||
"symfony/http-foundation": "~2.8",
|
||||
"symfony/yaml": "~4.0",
|
||||
"symfony/expression-language": "~3.0",
|
||||
"symfony/config": "3.3.2",
|
||||
"twig/twig": "1.*"
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
"apereo/phpcas": "^1.3",
|
||||
"hybridauth/hybridauth": "^3.2",
|
||||
"michelf/php-markdown": "^1.9"
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<?php
|
||||
global $argv;
|
||||
|
||||
require dirname(__FILE__) . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "autoload.php";
|
||||
require dirname(__DIR__) . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "autoload.php";
|
||||
|
||||
\MVC\Classe\Dumper::setPHPvalues();
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@ namespace MVC\Command;
|
|||
|
||||
class Cache
|
||||
{
|
||||
|
||||
static public function help(){
|
||||
public static function help()
|
||||
{
|
||||
print "explaination of the command\n\n";
|
||||
}
|
||||
|
||||
static public function clear(){
|
||||
public static function clear()
|
||||
{
|
||||
$git_cache_rm = system('rm -f '.VIEW_PATH.'/cache/*', $git_cache_rm_retval);
|
||||
print $git_cache_rm_retval;
|
||||
$git_logs_rm = system('rm -f '.LOG_PATH.'/*', $git_logs_rm_retval);
|
||||
|
@ -18,10 +19,10 @@ class Cache
|
|||
print "logs && cache cleared ! \n\n";
|
||||
}
|
||||
|
||||
static public function stabilize(){
|
||||
public static function stabilize()
|
||||
{
|
||||
$git_cache_rm = system('rm -f '.VIEW_PATH.'/cache/*', $git_cache_rm_retval);
|
||||
print $git_cache_rm_retval;
|
||||
print "cache stabilized ! \n\n";
|
||||
}
|
||||
|
||||
}
|
|
@ -4,11 +4,13 @@ namespace MVC\Command;
|
|||
|
||||
class Module
|
||||
{
|
||||
static public function help(){
|
||||
public static function help()
|
||||
{
|
||||
print "explaination of the command\n\n";
|
||||
}
|
||||
|
||||
static public function add(){
|
||||
public static function add()
|
||||
{
|
||||
print "adding module...\n\n";
|
||||
print "Quel est le module a ajouter ?\n1.Symfony\n2.Wordpress\n3.Prestashop\n4.PhpList\n5.Wanewsletter\n6.PHPmyNewletter\n>";
|
||||
$module = trim(fgets(STDIN));
|
||||
|
@ -71,7 +73,8 @@ class Module
|
|||
}
|
||||
}
|
||||
|
||||
static public function remove(){
|
||||
public static function remove()
|
||||
{
|
||||
print "removing module...\n\n";
|
||||
print "Quel est le module a supprimer?\n1.Symfony\n2.Wordpress\n3.Prestashop\n4.PhpList\n5.Wanewsletter\n6.PHPmyNewletter\n>";
|
||||
$module = trim(fgets(STDIN));
|
||||
|
@ -104,8 +107,8 @@ class Module
|
|||
}
|
||||
}
|
||||
|
||||
static private function addSymfony($name = 'symfony'){
|
||||
|
||||
private static function addSymfony($name = 'symfony')
|
||||
{
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && composer create-project symfony/website-skeleton '.$name);
|
||||
print $git_clone;
|
||||
$git_chmod = shell_exec('sudo chmod 775 '.MODULES_PATH.'/'.$name.' -R');
|
||||
|
@ -141,10 +144,9 @@ class Module
|
|||
."\n'.$name.' : Application permettant d'intégrer un module avec symfony"
|
||||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
|
||||
}
|
||||
static public function removeSymfony($name = 'symfony'){
|
||||
|
||||
public static function removeSymfony($name = 'symfony')
|
||||
{
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/'.$name, $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/'.$name, $git_ln_1_retval);
|
||||
|
@ -157,8 +159,8 @@ class Module
|
|||
print $git_view_retval;
|
||||
}
|
||||
|
||||
static public function addWordpress($version = '5.4'){
|
||||
|
||||
public static function addWordpress($version = '5.4')
|
||||
{
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/WordPress/WordPress.git wordpress');
|
||||
print $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/wordpress && git fetch --all --tags');
|
||||
|
@ -194,10 +196,9 @@ class Module
|
|||
."\nwordpress : Application permettant de générer un blog wordpress"
|
||||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
|
||||
}
|
||||
static public function removeWordpress(){
|
||||
|
||||
public static function removeWordpress()
|
||||
{
|
||||
$git_clone = system('sudo rm -Rf '.MODULES_PATH.'/wordpress', $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/wordpress', $git_ln_1_retval);
|
||||
|
@ -210,8 +211,8 @@ class Module
|
|||
print $git_view_retval;
|
||||
}
|
||||
|
||||
static public function addPrestashop($version = '1.7.5.0'){
|
||||
|
||||
public static function addPrestashop($version = '1.7.5.0')
|
||||
{
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/PrestaShop/PrestaShop.git prestashop');
|
||||
print $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/prestashop && git fetch --all --tags');
|
||||
|
@ -249,8 +250,8 @@ class Module
|
|||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
}
|
||||
static public function removePrestashop(){
|
||||
|
||||
public static function removePrestashop()
|
||||
{
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/prestashop', $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/prestashop', $git_ln_1_retval);
|
||||
|
@ -263,7 +264,8 @@ class Module
|
|||
print $git_view_retval;
|
||||
}
|
||||
|
||||
static public function addPhplist($version = '3.5.2'){
|
||||
public static function addPhplist($version = '3.5.2')
|
||||
{
|
||||
|
||||
/*$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/phpList/phplist3.git phplist');
|
||||
print $git_clone;
|
||||
|
@ -347,8 +349,8 @@ class Module
|
|||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
}
|
||||
static public function removePhplist(){
|
||||
|
||||
public static function removePhplist()
|
||||
{
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/phplist', $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/phplist', $git_ln_1_retval);
|
||||
|
@ -362,8 +364,8 @@ class Module
|
|||
$git_view = system('rm -f '.VIEW_PATH.'/view/phplist.blade.php', $git_view_retval);
|
||||
print $git_view_retval;
|
||||
}
|
||||
static public function addWanewsletter($version = 'release-3.0.1'){
|
||||
|
||||
public static function addWanewsletter($version = 'release-3.0.1')
|
||||
{
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/wascripts/wanewsletter.git wanewsletter');
|
||||
print $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/wanewsletter && git fetch --all --tags');
|
||||
|
@ -437,8 +439,8 @@ class Module
|
|||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
}
|
||||
static public function removeWanewsletter(){
|
||||
|
||||
public static function removeWanewsletter()
|
||||
{
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/wanewsletter', $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/wanewsletter', $git_ln_1_retval);
|
||||
|
@ -450,8 +452,8 @@ class Module
|
|||
$git_view = system('rm -f '.VIEW_PATH.'/view/wanewsletter.blade.php', $git_view_retval);
|
||||
print $git_view_retval;
|
||||
}
|
||||
static public function addPHPMyNewsletter($version = 'v2.0.5'){
|
||||
|
||||
public static function addPHPMyNewsletter($version = 'v2.0.5')
|
||||
{
|
||||
$git_clone = shell_exec('cd '.MODULES_PATH.' && git clone https://github.com/Arnaud69/phpmynewsletter-2.0.git phpmynewsletter');
|
||||
print $git_clone;
|
||||
$git_fetch = shell_exec('cd '.MODULES_PATH.'/phpmynewsletter && git fetch --all --tags');
|
||||
|
@ -525,8 +527,8 @@ class Module
|
|||
."\n "
|
||||
."\n et de créer la base de données!\n";
|
||||
}
|
||||
static public function removePHPMyNewsletter(){
|
||||
|
||||
public static function removePHPMyNewsletter()
|
||||
{
|
||||
$git_clone = system('rm -Rf '.MODULES_PATH.'/phpmynewsletter', $git_clone_retval);
|
||||
print $git_clone_retval;
|
||||
$git_ln_1 = system('rm -Rf '.PUBLIC_PATH.'/phpmynewsletter', $git_ln_1_retval);
|
||||
|
|
|
@ -4,12 +4,16 @@ namespace MVC\Command;
|
|||
|
||||
class Page
|
||||
{
|
||||
|
||||
static public function help(){
|
||||
public static function help()
|
||||
{
|
||||
print "explaination of the command\n\n";
|
||||
}
|
||||
|
||||
static public function add(){
|
||||
/**
|
||||
* TODO: ajouter en fonction du type de template (blade ou twig)
|
||||
*/
|
||||
public static function add()
|
||||
{
|
||||
print "adding page...\n\n";
|
||||
print "Quel est le nom de la page a ajouter? ";
|
||||
$page = trim(fgets(STDIN));
|
||||
|
@ -31,7 +35,11 @@ class Page
|
|||
print $git_view;
|
||||
}
|
||||
|
||||
static public function remove(){
|
||||
/**
|
||||
* Supprimer en fonction du template contenu dans le model
|
||||
*/
|
||||
public static function remove()
|
||||
{
|
||||
print "removing page...\n\n";
|
||||
print "Quel est le nom de la page a supprimer? ";
|
||||
$handle = fopen("php://stdin", "r");
|
||||
|
@ -43,5 +51,4 @@ class Page
|
|||
$git_view = system('rm -f '.VIEW_PATH.'/view/'.$page.'.blade.php', $git_view_retval);
|
||||
print $git_view_retval;
|
||||
}
|
||||
|
||||
}
|
|
@ -4,14 +4,14 @@ namespace MVC\Command;
|
|||
|
||||
class Symfony
|
||||
{
|
||||
|
||||
static public function help(){
|
||||
public static function help()
|
||||
{
|
||||
print "explaination of the command\n\n";
|
||||
}
|
||||
|
||||
static public function stabilize(){
|
||||
public static function stabilize()
|
||||
{
|
||||
print "stabilize symfony module...\n\n";
|
||||
$symfony_module = shell_exec('sudo cp '.CONSOLE_PATH.'/skel/symfony '.VENDOR_PATH.' -Rf');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
name : PAGE
|
||||
page_title : module_title
|
||||
description : module_description
|
||||
engine : blade
|
||||
params : module_params
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
|
|
|
@ -7,32 +7,35 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
||||
class OnAuthenticationFailureEvent extends Event {
|
||||
|
||||
class OnAuthenticationFailureEvent extends Event
|
||||
{
|
||||
const NAME = "session_auth.event.on_authentication_failure";
|
||||
|
||||
public function __construct(Request $request, AuthenticationException $exception) {
|
||||
public function __construct(Request $request, AuthenticationException $exception)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->exception = $exception;
|
||||
$this->response = new Response($exception->getMessage(), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
public function getRequest() {
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getException() {
|
||||
public function getException()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
public function getResponse() {
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function setResponse($response) {
|
||||
public function setResponse($response)
|
||||
{
|
||||
$this->response = $response;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,27 +5,29 @@ use Symfony\Component\EventDispatcher\Event;
|
|||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class OnAuthenticationSuccessEvent extends Event {
|
||||
|
||||
class OnAuthenticationSuccessEvent extends Event
|
||||
{
|
||||
const NAME = "session_auth.event.on_authentication_success";
|
||||
|
||||
public function __construct(Request $request, TokenInterface $token, $providerKey) {
|
||||
public function __construct(Request $request, TokenInterface $token, $providerKey)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->token = $token;
|
||||
$this->providerKey = $providerKey;
|
||||
}
|
||||
|
||||
public function getRequest() {
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getToken() {
|
||||
public function getToken()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
public function getProviderKey() {
|
||||
public function getProviderKey()
|
||||
{
|
||||
return $this->providerKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ class AccessDeniedHandler implements AccessDeniedHandlerInterface
|
|||
public function handle(Request $request, AccessDeniedException $accessDeniedException)
|
||||
{
|
||||
$content = $this->twig->render(
|
||||
'default/unauthorized.html.twig', array()
|
||||
'default/unauthorized.html.twig',
|
||||
array()
|
||||
);
|
||||
$response = new Response($content, Response::HTTP_FORBIDDEN);
|
||||
return $response;
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace App\Security;
|
|||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class AuthUser implements UserInterface{
|
||||
|
||||
class AuthUser implements UserInterface
|
||||
{
|
||||
private $id;
|
||||
private $username;
|
||||
private $status;
|
||||
|
@ -43,7 +43,8 @@ class AuthUser implements UserInterface{
|
|||
return $this->username;
|
||||
}
|
||||
|
||||
public function getUser(){
|
||||
public function getUser()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -93,5 +94,4 @@ class AuthUser implements UserInterface{
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,6 @@ use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
|||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
|
||||
|
||||
class AuthUserProvider implements UserProviderInterface
|
||||
{
|
||||
|
||||
|
@ -24,7 +23,8 @@ class AuthUserProvider implements UserProviderInterface
|
|||
*
|
||||
* @throws UsernameNotFoundException if the user is not found
|
||||
*/
|
||||
public function loadUserByUsername($username) {
|
||||
public function loadUserByUsername($username)
|
||||
{
|
||||
$entity_user = $this->entity_user;
|
||||
|
||||
return $this->authService->getUser($username);
|
||||
|
@ -49,13 +49,15 @@ class AuthUserProvider implements UserProviderInterface
|
|||
* @return UserInterface
|
||||
*/
|
||||
|
||||
public function refreshUser(UserInterface $user) {
|
||||
public function refreshUser(UserInterface $user)
|
||||
{
|
||||
$user = $this->_ctrlInstanceUser($user);
|
||||
|
||||
return $this->loadUserByUsername($user->getUsername());
|
||||
}
|
||||
|
||||
private function _ctrlInstanceUser(UserInterface $user) {
|
||||
private function _ctrlInstanceUser(UserInterface $user)
|
||||
{
|
||||
$entity_user = $this->entity_user;
|
||||
|
||||
if (!$user instanceof $entity_user) {
|
||||
|
|
|
@ -17,7 +17,6 @@ use Symfony\Component\Security\Core\User\UserProviderInterface;
|
|||
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
|
||||
use Twig\Environment;
|
||||
|
||||
|
||||
class SessionAuthenticator extends AbstractGuardAuthenticator
|
||||
{
|
||||
public $router;
|
||||
|
@ -104,12 +103,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
// $url = $this->router->generate('unauthorized');
|
||||
// return new RedirectResponse($url);
|
||||
$content = $this->twig->render(
|
||||
'default/unauthorized.html.twig', array()
|
||||
'default/unauthorized.html.twig',
|
||||
array()
|
||||
);
|
||||
$response = new Response($content, Response::HTTP_FORBIDDEN);
|
||||
return $response;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,13 +126,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
// return new RedirectResponse($url);
|
||||
|
||||
$content = $this->twig->render(
|
||||
'default/unauthorized.html.twig', array()
|
||||
'default/unauthorized.html.twig',
|
||||
array()
|
||||
);
|
||||
$response = new Response($content, Response::HTTP_FORBIDDEN);
|
||||
return $response;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function supportsRememberMe()
|
||||
|
@ -142,11 +138,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
return false;
|
||||
}
|
||||
|
||||
public function onLogoutSuccess(Request $request) {
|
||||
public function onLogoutSuccess(Request $request)
|
||||
{
|
||||
//$homepage = $this->config["homepage"];
|
||||
//return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL));
|
||||
header('Location: /index.php');
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,12 +11,14 @@ use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
|||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface {
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder() {
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('session_auth');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
$rootNode
|
||||
|
@ -57,8 +59,8 @@ class Configuration implements ConfigurationInterface {
|
|||
return $treeBuilder;
|
||||
}
|
||||
|
||||
private function _addCasConfig(ArrayNodeDefinition $node) {
|
||||
|
||||
private function _addCasConfig(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('cas')->info('A déclarer si authentification pas CAS.')
|
||||
|
@ -85,7 +87,8 @@ class Configuration implements ConfigurationInterface {
|
|||
->end();
|
||||
}
|
||||
|
||||
private function _addRsaConfig(ArrayNodeDefinition $node) {
|
||||
private function _addRsaConfig(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('rsa')->addDefaultsIfNotSet()->info('A déclarer si authentification pas RSA.')
|
||||
|
|
|
@ -14,13 +14,14 @@ use Symfony\Component\DependencyInjection\ChildDefinition;
|
|||
*
|
||||
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
|
||||
*/
|
||||
class SessionAuthExtension extends Extension {
|
||||
class SessionAuthExtension extends Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container) {
|
||||
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configs[0]['environment'] = $container->getParameter("kernel.environment");
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
@ -75,8 +76,8 @@ class SessionAuthExtension extends Extension {
|
|||
]);
|
||||
}
|
||||
|
||||
public function getNamespace() {
|
||||
public function getNamespace()
|
||||
{
|
||||
return 'http://ac-besancon.fr/schema/dic/' . $this->getAlias();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,30 +5,34 @@ namespace App\Session\AuthBundle\Events;
|
|||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class CheckCredentialsEvent extends Event {
|
||||
|
||||
class CheckCredentialsEvent extends Event
|
||||
{
|
||||
const NAME = "besancon_auth.event.check_credentials";
|
||||
private $access = true;
|
||||
|
||||
public function __construct($credentials, UserInterface $user_interface) {
|
||||
public function __construct($credentials, UserInterface $user_interface)
|
||||
{
|
||||
$this->credentials = $credentials;
|
||||
$this->user_interface = $user_interface;
|
||||
}
|
||||
|
||||
public function getCredentials() {
|
||||
public function getCredentials()
|
||||
{
|
||||
return $this->credentials;
|
||||
}
|
||||
|
||||
public function getUserInterface() {
|
||||
public function getUserInterface()
|
||||
{
|
||||
return $this->user_interface;
|
||||
}
|
||||
|
||||
public function getAccess() {
|
||||
public function getAccess()
|
||||
{
|
||||
return $this->access;
|
||||
}
|
||||
public function setAccess($access) {
|
||||
public function setAccess($access)
|
||||
{
|
||||
$this->access = $access;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,32 +7,35 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
||||
class OnAuthenticationFailureEvent extends Event {
|
||||
|
||||
class OnAuthenticationFailureEvent extends Event
|
||||
{
|
||||
const NAME = "session_auth.event.on_authentication_failure";
|
||||
|
||||
public function __construct(Request $request, AuthenticationException $exception) {
|
||||
public function __construct(Request $request, AuthenticationException $exception)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->exception = $exception;
|
||||
$this->response = new Response($exception->getMessage(), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
public function getRequest() {
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getException() {
|
||||
public function getException()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
public function getResponse() {
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function setResponse($response) {
|
||||
public function setResponse($response)
|
||||
{
|
||||
$this->response = $response;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,27 +5,29 @@ use Symfony\Component\EventDispatcher\Event;
|
|||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class OnAuthenticationSuccessEvent extends Event {
|
||||
|
||||
class OnAuthenticationSuccessEvent extends Event
|
||||
{
|
||||
const NAME = "session_auth.event.on_authentication_success";
|
||||
|
||||
public function __construct(Request $request, TokenInterface $token, $providerKey) {
|
||||
public function __construct(Request $request, TokenInterface $token, $providerKey)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->token = $token;
|
||||
$this->providerKey = $providerKey;
|
||||
}
|
||||
|
||||
public function getRequest() {
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getToken() {
|
||||
public function getToken()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
public function getProviderKey() {
|
||||
public function getProviderKey()
|
||||
{
|
||||
return $this->providerKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace App\Session\AuthBundle\Security\Abstracts;
|
|||
use App\Session\AuthBundle\Utils\Config;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
abstract class AuthAbstract {
|
||||
abstract class AuthAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var App\Besancon\AuthBundle\Security\Interfaces\AttributesInterface $ai Instance de CasAttributes ou RsaAttributes
|
||||
|
@ -73,6 +74,4 @@ abstract class AuthAbstract {
|
|||
*
|
||||
*/
|
||||
abstract public function getUser($username);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace App\Session\AuthBundle\Security\Abstracts;
|
|||
use App\Session\AuthBundle\Utils\Config;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AuthFinal extends AuthAbstract {
|
||||
class AuthFinal extends AuthAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Intancie le getters en fonction de la configuration
|
||||
|
@ -33,7 +34,8 @@ class AuthFinal extends AuthAbstract {
|
|||
* @return void
|
||||
*
|
||||
* */
|
||||
public function setGetterAttributes($config) {
|
||||
public function setGetterAttributes($config)
|
||||
{
|
||||
$type_auth = Config::getDeclaredType($config);
|
||||
//dump('calls');
|
||||
$getters = "\App\Session\AuthBundle\Security\Getters\\" . $type_auth . "Attributes";
|
||||
|
@ -55,7 +57,8 @@ class AuthFinal extends AuthAbstract {
|
|||
* @return Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* */
|
||||
public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception) {
|
||||
public function onAuthenticationFailure(\Symfony\Component\Security\Core\Exception\AuthenticationException $exception)
|
||||
{
|
||||
return new Response($exception->getMessage(), Response::HTTP_FORBIDDEN);
|
||||
}
|
||||
|
||||
|
@ -76,12 +79,12 @@ class AuthFinal extends AuthAbstract {
|
|||
* @return \Symfony\Component\Security\Core\User\UserInterface
|
||||
*
|
||||
*/
|
||||
public function getUser($username) {
|
||||
public function getUser($username)
|
||||
{
|
||||
$roles_service = $this->getRoles();
|
||||
$roles = (!is_null($roles_service) && is_array($roles_service)) ? $roles_service : array();
|
||||
$user = new \App\Besancon\AuthBundle\Security\User\AuthUser($username, md5("8sQaz87dPPsdanYakq86f" . $username), $roles);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,29 +14,35 @@ namespace App\Session\AuthBundle\Security\Abstracts;
|
|||
*
|
||||
* @author belhadjali
|
||||
*/
|
||||
abstract class GetterAbstract {
|
||||
|
||||
public function isACP(){
|
||||
abstract class GetterAbstract
|
||||
{
|
||||
public function isACP()
|
||||
{
|
||||
return $this->getFrEduFonctAdm() == "ACP";
|
||||
}
|
||||
|
||||
public function isDIR(){
|
||||
public function isDIR()
|
||||
{
|
||||
return $this->getFrEduFonctAdm() == "DIR";
|
||||
}
|
||||
|
||||
public function isDEC(){
|
||||
public function isDEC()
|
||||
{
|
||||
return $this->getFrEduFonctAdm() == "DEC";
|
||||
}
|
||||
|
||||
public function isDIR1D(){
|
||||
public function isDIR1D()
|
||||
{
|
||||
return $this->isDEC();
|
||||
}
|
||||
|
||||
public function isIEN1D (){
|
||||
public function isIEN1D()
|
||||
{
|
||||
return $this->getFrEduFonctAdm() == "IEN1D";
|
||||
}
|
||||
|
||||
public function isDIO(){
|
||||
public function isDIO()
|
||||
{
|
||||
return $this->getFrEduFonctAdm() == "IEN1D";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|||
use App\Session\AuthBundle\Utils\Config;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class AuthenticatorFactory {
|
||||
|
||||
public static function getAuthenticator(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator,EventDispatcherInterface $dispatcher) {
|
||||
class AuthenticatorFactory
|
||||
{
|
||||
public static function getAuthenticator(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$type_auth = Config::getDeclaredType($config);
|
||||
|
||||
$authenticator_class = "App\Session\AuthBundle\Security\\" . $type_auth . "Authenticator";
|
||||
|
@ -23,5 +24,4 @@ class AuthenticatorFactory {
|
|||
|
||||
return $authenticator;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,12 +28,13 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|||
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface {
|
||||
|
||||
class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface
|
||||
{
|
||||
private $authService;
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) {
|
||||
public function __construct(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
//Récupérer le service déaclaré authService
|
||||
$this->authService = $authService;
|
||||
|
@ -51,22 +52,25 @@ class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
* Called on every request. Return whatever credentials you want,
|
||||
* or null to stop authentication.
|
||||
*/
|
||||
public function getCredentials(Request $request) {
|
||||
public function getCredentials(Request $request)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUser($credentials, UserProviderInterface $userProvider) {
|
||||
public function getUser($credentials, UserProviderInterface $userProvider)
|
||||
{
|
||||
$username = \phpCAS::getUser();
|
||||
$user = $userProvider->loadUserByUsername($username);
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function checkCredentials($credentials, UserInterface $user) {
|
||||
public function checkCredentials($credentials, UserInterface $user)
|
||||
{
|
||||
return $this->authService->ctrlAccess($user);
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) {
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
|
||||
{
|
||||
$event = new OnAuthenticationSuccessEvent($request, $token, $providerKey);
|
||||
$this->dispatcher->dispatch(OnAuthenticationSuccessEvent::NAME, $event);
|
||||
|
||||
|
@ -74,8 +78,8 @@ class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
// on success, let the request continue
|
||||
}
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception) {
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
|
||||
{
|
||||
$event = new OnAuthenticationFailureEvent($request, $exception);
|
||||
$this->dispatcher->dispatch(OnAuthenticationFailureEvent::NAME, $event);
|
||||
|
||||
|
@ -90,25 +94,28 @@ class CasAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
// return new RedirectResponse($url);
|
||||
// }
|
||||
|
||||
public function supportsRememberMe() {
|
||||
public function supportsRememberMe()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//implementation LogoutSuccessHandlerInterface
|
||||
public function onLogoutSuccess(Request $request) {
|
||||
public function onLogoutSuccess(Request $request)
|
||||
{
|
||||
$homepage = $this->config["homepage"];
|
||||
return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL));
|
||||
}
|
||||
|
||||
protected function getLoginUrl() {
|
||||
protected function getLoginUrl()
|
||||
{
|
||||
return \phpCas::getServerLoginURL();
|
||||
}
|
||||
|
||||
public function supports(Request $request) {
|
||||
public function supports(Request $request)
|
||||
{
|
||||
if (isset($this->config['environment']) && $this->config['environment'] == "test") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ use Symfony\Component\Security\Core\User\UserChecker;
|
|||
*
|
||||
* @author belhadjali
|
||||
*/
|
||||
class DefaultAuthentication extends AuthFinal implements AuthInterface {
|
||||
class DefaultAuthentication extends AuthFinal implements AuthInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string Uniquely identifies the secured area
|
||||
|
@ -48,9 +49,11 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface {
|
|||
'secured_area'
|
||||
);
|
||||
|
||||
$userProvider = new UserProvider( new Authentication(),
|
||||
$userProvider = new UserProvider(
|
||||
new Authentication(),
|
||||
array('user_entity' => 'App\Session\AuthBundle\Security\Auth\User',
|
||||
'type_auth' => 'Cas'));
|
||||
'type_auth' => 'Cas')
|
||||
);
|
||||
$userChecker = new UserChecker();
|
||||
|
||||
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
|
||||
|
@ -65,7 +68,8 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface {
|
|||
$userProvider,
|
||||
$userChecker,
|
||||
'secured_area',
|
||||
$encoderFactory);
|
||||
$encoderFactory
|
||||
);
|
||||
|
||||
|
||||
$authenticatedToken = $provider
|
||||
|
@ -76,11 +80,13 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface {
|
|||
//$tokenStorage->setToken($authenticatedToken);
|
||||
}
|
||||
|
||||
public function getRoles() {
|
||||
public function getRoles()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function onSuccess($token) {
|
||||
public function onSuccess($token)
|
||||
{
|
||||
|
||||
//dump($this->ai);
|
||||
//die('success');
|
||||
|
@ -95,12 +101,14 @@ class DefaultAuthentication extends AuthFinal implements AuthInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
public function ctrlAccess(\Symfony\Component\Security\Core\User\UserInterface $user) {
|
||||
public function ctrlAccess(\Symfony\Component\Security\Core\User\UserInterface $user)
|
||||
{
|
||||
//die('ctrlAccess');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUser($username) {
|
||||
public function getUser($username)
|
||||
{
|
||||
return parent::getUser($username);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,62 +15,75 @@ use App\Session\AuthBundle\Security\Interfaces\AttributesInterface;
|
|||
* renvoyé par CAS à partir des méthodes d'accès définies dans l'interface AttributesInterface
|
||||
*
|
||||
*/
|
||||
class CasAttributes implements AttributesInterface {
|
||||
|
||||
public function getFirstName() {
|
||||
class CasAttributes implements AttributesInterface
|
||||
{
|
||||
public function getFirstName()
|
||||
{
|
||||
return \phpCAS::getAttribute("prenom");
|
||||
}
|
||||
|
||||
public function getCompletName() {
|
||||
public function getCompletName()
|
||||
{
|
||||
return \phpCAS::getAttribute("nomcomplet");
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return \phpCAS::getAttribute("nom");
|
||||
}
|
||||
|
||||
public function getDiscipline() {
|
||||
public function getDiscipline()
|
||||
{
|
||||
return \phpCAS::getAttribute("discipline");
|
||||
}
|
||||
|
||||
public function getFonctM() {
|
||||
public function getFonctM()
|
||||
{
|
||||
return \phpCAS::getAttribute("fonctm");
|
||||
}
|
||||
|
||||
public function getRne() {
|
||||
public function getRne()
|
||||
{
|
||||
return \phpCAS::getAttribute("rne");
|
||||
}
|
||||
|
||||
public function getFreDuRne() {
|
||||
public function getFreDuRne()
|
||||
{
|
||||
return \phpCAS::getAttribute("FrEduRne");
|
||||
}
|
||||
|
||||
public function getFreDuRneResp() {
|
||||
public function getFreDuRneResp()
|
||||
{
|
||||
return \phpCAS::getAttribute("FrEduRneResp");
|
||||
}
|
||||
|
||||
public function getMail() {
|
||||
public function getMail()
|
||||
{
|
||||
return \phpCAS::getAttribute("mail");
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
public function getTitle()
|
||||
{
|
||||
return \phpCAS::getAttribute("title");
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
public function getUsername()
|
||||
{
|
||||
return \phpCAS::getUser();
|
||||
}
|
||||
|
||||
public function getFrEduResDel(){
|
||||
public function getFrEduResDel()
|
||||
{
|
||||
return \phpCAS::getAttribute("FrEduResDel");
|
||||
}
|
||||
|
||||
public function getFrEduFonctAdm() {
|
||||
public function getFrEduFonctAdm()
|
||||
{
|
||||
return \phpCAS::getAttribute("FrEduFonctAdm");
|
||||
}
|
||||
|
||||
public function getGrade() {
|
||||
public function getGrade()
|
||||
{
|
||||
return \phpCAS::getAttribute("grade");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,62 +19,75 @@ use App\Besancon\AuthBundle\Security\Interfaces\AttributesInterface;
|
|||
* renvoyé par RSA CT à partir des méthodes d'accès définies dans l'interface AttributesInterface
|
||||
*
|
||||
*/
|
||||
class RsaAttributes implements AttributesInterface {
|
||||
|
||||
public function getCompletName() {
|
||||
class RsaAttributes implements AttributesInterface
|
||||
{
|
||||
public function getCompletName()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_CN'])) ? $_SERVER['HTTP_CN'] : null;
|
||||
}
|
||||
|
||||
public function getDiscipline() {
|
||||
public function getDiscipline()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_DISCIPLINE'])) ? $_SERVER['HTTP_DISCIPLINE'] : null;
|
||||
}
|
||||
|
||||
public function getFonctM() {
|
||||
public function getFonctM()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_FONCTM'])) ? $_SERVER['HTTP_FONCTM'] : null;
|
||||
}
|
||||
|
||||
public function getRne() {
|
||||
public function getRne()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_RNE'])) ? $_SERVER['HTTP_FREDURNE'] : null;
|
||||
}
|
||||
|
||||
public function getFreDuRne() {
|
||||
public function getFreDuRne()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_FREDURNE'])) ? explode(',', $_SERVER['HTTP_FREDURNE']) : null;
|
||||
}
|
||||
|
||||
public function getFreDuRneResp() {
|
||||
public function getFreDuRneResp()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_FREDURNERESP'])) ? explode(',', $_SERVER['HTTP_FREDURNERESP']) : null;
|
||||
}
|
||||
|
||||
public function getMail() {
|
||||
public function getMail()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_CTEMAIL'])) ? $_SERVER['HTTP_CTEMAIL'] : null;
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
public function getTitle()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_TITLE'])) ? $_SERVER['HTTP_TITLE'] : null;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
public function getUsername()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_CT_REMOTE_USER'])) ? $_SERVER['HTTP_CT_REMOTE_USER'] : null;
|
||||
}
|
||||
|
||||
public function getFrEduResDel() {
|
||||
public function getFrEduResDel()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_FREDURESDEL'])) ? $_SERVER['HTTP_FREDURESDEL'] : null;
|
||||
}
|
||||
|
||||
public function getFrEduFonctAdm() {
|
||||
public function getFrEduFonctAdm()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_FREDUFONCTADM'])) ? $_SERVER['HTTP_FREDUFONCTADM'] : null;
|
||||
}
|
||||
|
||||
public function getFirstName() {
|
||||
public function getFirstName()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_CTFN'])) ? $_SERVER['HTTP_CTFN'] : null;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_CTLN'])) ? $_SERVER['HTTP_CTLN'] : null;
|
||||
}
|
||||
|
||||
public function getGrade() {
|
||||
public function getGrade()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_GRADE'])) ? $_SERVER['HTTP_GRADE'] : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,62 +15,75 @@ use App\Session\AuthBundle\Security\Interfaces\AttributesInterface;
|
|||
* renvoyé par CAS à partir des méthodes d'accès définies dans l'interface AttributesInterface
|
||||
*
|
||||
*/
|
||||
class SessionAttributes implements AttributesInterface {
|
||||
|
||||
public function getFirstName() {
|
||||
class SessionAttributes implements AttributesInterface
|
||||
{
|
||||
public function getFirstName()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getCompletName() {
|
||||
public function getCompletName()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getDiscipline() {
|
||||
public function getDiscipline()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getFonctM() {
|
||||
public function getFonctM()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getRne() {
|
||||
public function getRne()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getFreDuRne() {
|
||||
public function getFreDuRne()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getFreDuRneResp() {
|
||||
public function getFreDuRneResp()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getMail() {
|
||||
public function getMail()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
public function getTitle()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
public function getUsername()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getFrEduResDel(){
|
||||
public function getFrEduResDel()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getFrEduFonctAdm() {
|
||||
public function getFrEduFonctAdm()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function getGrade() {
|
||||
public function getGrade()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ namespace App\Session\AuthBundle\Security\Interfaces;
|
|||
*/
|
||||
interface AttributesInterface
|
||||
{
|
||||
|
||||
const NO_VALUE = "X";
|
||||
|
||||
const FREDURNE_OFFSET_RNE = 0;
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
*/
|
||||
namespace App\Session\AuthBundle\Security\Interfaces;
|
||||
|
||||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
interface AuthInterface {
|
||||
interface AuthInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Contrôle de l'accès à partir des attributs CAS ou RSA
|
||||
|
|
|
@ -30,13 +30,14 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface {
|
||||
|
||||
class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutSuccessHandlerInterface, AuthenticatorInterface
|
||||
{
|
||||
private $authService;
|
||||
private $urlGenerator;
|
||||
private $dispatcher;
|
||||
|
||||
public function __construct(AuthInterface $authService, Array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher) {
|
||||
public function __construct(AuthInterface $authService, array $config, UrlGeneratorInterface $urlGenerator, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
//Récupérer le service déaclaré authService
|
||||
$this->authService = $authService;
|
||||
|
@ -48,7 +49,8 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
* Called on every request. Return whatever credentials you want,
|
||||
* or null to stop authentication.
|
||||
*/
|
||||
public function getCredentials(Request $request) {
|
||||
public function getCredentials(Request $request)
|
||||
{
|
||||
if (!isset($_SERVER['HTTP_CT_REMOTE_USER']) || empty($_SERVER['HTTP_CT_REMOTE_USER'])) {
|
||||
$this->returnRequest = $request->getUri();
|
||||
throw new \LogicException("Impossible de continuer sous RSA : L'entête HTTP_CT_REMOTE_USER est vide ou manquante");
|
||||
|
@ -56,13 +58,15 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
return true;
|
||||
}
|
||||
|
||||
public function getUser($credentials, UserProviderInterface $userProvider) {
|
||||
public function getUser($credentials, UserProviderInterface $userProvider)
|
||||
{
|
||||
$username = $_SERVER['HTTP_CT_REMOTE_USER'];
|
||||
$user = $userProvider->loadUserByUsername($username);
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function checkCredentials($credentials, UserInterface $user) {
|
||||
public function checkCredentials($credentials, UserInterface $user)
|
||||
{
|
||||
$this->authService->ctrlAccess($user);
|
||||
// check credentials - e.g. make sure the password is valid
|
||||
// no credential check is needed in this case
|
||||
|
@ -70,8 +74,8 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
return true;
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) {
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
|
||||
{
|
||||
$event = new OnAuthenticationSuccessEvent($request, $token, $providerKey);
|
||||
$this->dispatcher->dispatch(OnAuthenticationSuccessEvent::NAME, $event);
|
||||
|
||||
|
@ -79,8 +83,8 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
// on success, let the request continue
|
||||
}
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception) {
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
|
||||
{
|
||||
$event = new OnAuthenticationFailureEvent($request, $exception);
|
||||
$this->dispatcher->dispatch(OnAuthenticationFailureEvent::NAME, $event);
|
||||
|
||||
|
@ -95,23 +99,27 @@ class RsaAuthenticator extends AbstractFormLoginAuthenticator implements LogoutS
|
|||
// return new RedirectResponse($url);
|
||||
// }
|
||||
|
||||
public function supportsRememberMe() {
|
||||
public function supportsRememberMe()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//implementation LogoutSuccessHandlerInterface
|
||||
public function onLogoutSuccess(Request $request) {
|
||||
public function onLogoutSuccess(Request $request)
|
||||
{
|
||||
$redirect = (isset($_SERVER['HTTP_FREDUURLRETOUR'])) ? $_SERVER['HTTP_FREDUURLRETOUR'] : $this->config['rsa']['logout_url'];
|
||||
return new RedirectResponse($redirect);
|
||||
}
|
||||
|
||||
protected function getLoginUrl() {
|
||||
protected function getLoginUrl()
|
||||
{
|
||||
$return_request = urlencode($this->returnRequest);
|
||||
$params = "?CT_ORIG_URL=" . $return_request;
|
||||
return $this->config['rsa']['login_url'] . $params;
|
||||
}
|
||||
|
||||
public function supports(Request $request) {
|
||||
public function supports(Request $request)
|
||||
{
|
||||
if (isset($this->config['environment']) && $this->config['environment'] == "test") {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
// return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
|
||||
$url = $this->router->generate('unauthorized');
|
||||
return new RedirectResponse($url);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,8 +107,6 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
|
||||
$url = $this->router->generate('unauthorized');
|
||||
return new RedirectResponse($url);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function supportsRememberMe()
|
||||
|
@ -117,11 +114,11 @@ class SessionAuthenticator extends AbstractGuardAuthenticator
|
|||
return false;
|
||||
}
|
||||
|
||||
public function onLogoutSuccess(Request $request) {
|
||||
public function onLogoutSuccess(Request $request)
|
||||
{
|
||||
//$homepage = $this->config["homepage"];
|
||||
//return \phpCAS::logoutWithRedirectService($this->urlGenerator->generate($homepage, array(), UrlGeneratorInterface::ABSOLUTE_URL));
|
||||
header('Location: /index.php');
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,47 +17,55 @@ namespace App\Session\AuthBundle\Security\User;
|
|||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\EquatableInterface;
|
||||
|
||||
class AuthUser implements UserInterface, EquatableInterface {
|
||||
|
||||
class AuthUser implements UserInterface, EquatableInterface
|
||||
{
|
||||
private $username;
|
||||
private $salt;
|
||||
private $roles = [];
|
||||
|
||||
public function __construct($username, $salt, array $roles = []) {
|
||||
public function __construct($username, $salt, array $roles = [])
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->salt = $salt;
|
||||
$this->roles = $roles;
|
||||
}
|
||||
|
||||
public function getRoles() {
|
||||
public function getRoles()
|
||||
{
|
||||
return $this->roles;
|
||||
}
|
||||
|
||||
public function setRoles($roles) {
|
||||
public function setRoles($roles)
|
||||
{
|
||||
return $this->roles = $roles;
|
||||
}
|
||||
|
||||
public function addRole($role) {
|
||||
public function addRole($role)
|
||||
{
|
||||
return $this->roles[] = $role;
|
||||
}
|
||||
|
||||
public function getPassword() {
|
||||
public function getPassword()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSalt() {
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function eraseCredentials() {
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
public function isEqualTo(UserInterface $user) {
|
||||
public function isEqualTo(UserInterface $user)
|
||||
{
|
||||
if (!$user instanceof AuthUser) {
|
||||
return false;
|
||||
}
|
||||
|
@ -72,5 +80,4 @@ class AuthUser implements UserInterface, EquatableInterface {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ use Symfony\Component\Security\Core\User\UserProviderInterface;
|
|||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
|
||||
class AuthUserProvider implements UserProviderInterface {
|
||||
|
||||
public function __construct(AuthInterface $authService, Array $config) {
|
||||
class AuthUserProvider implements UserProviderInterface
|
||||
{
|
||||
public function __construct(AuthInterface $authService, array $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
if (!is_null($this->config['user_entity'])) {
|
||||
|
@ -26,13 +27,15 @@ class AuthUserProvider implements UserProviderInterface {
|
|||
$this->authService = $authService;
|
||||
}
|
||||
|
||||
public function loadUserByUsername($username) {
|
||||
public function loadUserByUsername($username)
|
||||
{
|
||||
$entity_user = $this->entity_user;
|
||||
|
||||
return $this->authService->getUser($username);
|
||||
}
|
||||
|
||||
private function _ctrlInstanceUser(UserInterface $user) {
|
||||
private function _ctrlInstanceUser(UserInterface $user)
|
||||
{
|
||||
$entity_user = $this->entity_user;
|
||||
|
||||
if (!$user instanceof $entity_user) {
|
||||
|
@ -44,15 +47,16 @@ class AuthUserProvider implements UserProviderInterface {
|
|||
return $user;
|
||||
}
|
||||
|
||||
public function refreshUser(UserInterface $user) {
|
||||
public function refreshUser(UserInterface $user)
|
||||
{
|
||||
$user = $this->_ctrlInstanceUser($user);
|
||||
|
||||
return $this->loadUserByUsername($user->getUsername());
|
||||
}
|
||||
|
||||
public function supportsClass($class) {
|
||||
public function supportsClass($class)
|
||||
{
|
||||
$entity_user = $this->entity_user;
|
||||
return $this->entity_class === $class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
namespace App\Session\AuthBundle\Utils;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
|
@ -11,9 +12,10 @@ namespace App\Session\AuthBundle\Utils;
|
|||
*
|
||||
* @author belhadjali
|
||||
*/
|
||||
class Config {
|
||||
|
||||
public static function getDeclaredType($config) {
|
||||
class Config
|
||||
{
|
||||
public static function getDeclaredType($config)
|
||||
{
|
||||
if (!isset($config['type_auth'])) {
|
||||
throw new \LogicException('Paramètre type_auth manquant');
|
||||
}
|
||||
|
@ -25,11 +27,13 @@ class Config {
|
|||
return self::formatType($type);
|
||||
}
|
||||
|
||||
public static function formatType($type) {
|
||||
public static function formatType($type)
|
||||
{
|
||||
return ucfirst(strtolower($type));
|
||||
}
|
||||
|
||||
public static function typeIsSupported($type) {
|
||||
public static function typeIsSupported($type)
|
||||
{
|
||||
$type_auth = self::formatType($type);
|
||||
if (!in_array($type_auth, ['Rsa', 'Cas'])) {
|
||||
throw new \LogicException('Seuls Cas et Rsa sont supportés pour le moment');
|
||||
|
|
|
@ -14,9 +14,10 @@ namespace App\Utils;
|
|||
*
|
||||
* @author belhadjali
|
||||
*/
|
||||
class Config {
|
||||
|
||||
public static function getDeclaredType($config) {
|
||||
class Config
|
||||
{
|
||||
public static function getDeclaredType($config)
|
||||
{
|
||||
// if (!isset($config['type_auth'])) {
|
||||
// throw new \LogicException('Paramètre type_auth manquant');
|
||||
// }
|
||||
|
@ -29,12 +30,14 @@ namespace App\Utils;
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function formatType($type) {
|
||||
public static function formatType($type)
|
||||
{
|
||||
// return ucfirst(strtolower($type));
|
||||
return;
|
||||
}
|
||||
|
||||
public static function typeIsSupported($type) {
|
||||
public static function typeIsSupported($type)
|
||||
{
|
||||
// $type_auth = self::formatType($type);
|
||||
// if (!in_array($type_auth, ['Rsa', 'Cas'])) {
|
||||
// throw new \LogicException('Seuls Cas et Rsa sont supportés pour le moment');
|
||||
|
|
0
console/skel/symfony-app/templates/default/error.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/error.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/index.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/index.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/page.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/page.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/unauthorized.html.twig
Executable file → Normal file
0
console/skel/symfony-app/templates/default/unauthorized.html.twig
Executable file → Normal file
|
@ -52,7 +52,8 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
|
|||
return $ok;
|
||||
}
|
||||
|
||||
set_error_handler(static function () {});
|
||||
set_error_handler(static function () {
|
||||
});
|
||||
$chars = '+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
|
||||
try {
|
||||
|
@ -197,7 +198,8 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
|
|||
continue;
|
||||
}
|
||||
|
||||
set_error_handler(static function () {});
|
||||
set_error_handler(static function () {
|
||||
});
|
||||
|
||||
try {
|
||||
if (rename($tagFolder, $renamed = substr_replace($tagFolder, bin2hex(random_bytes(4)), -9))) {
|
||||
|
|
7
console/skel/symfony/cache/LockRegistry.php
vendored
7
console/skel/symfony/cache/LockRegistry.php
vendored
|
@ -118,7 +118,9 @@ final class LockRegistry
|
|||
}
|
||||
static $signalingException, $signalingCallback;
|
||||
$signalingException = $signalingException ?? unserialize("O:9:\"Exception\":1:{s:16:\"\0Exception\0trace\";a:0:{}}");
|
||||
$signalingCallback = $signalingCallback ?? function () use ($signalingException) { throw $signalingException; };
|
||||
$signalingCallback = $signalingCallback ?? function () use ($signalingException) {
|
||||
throw $signalingException;
|
||||
};
|
||||
|
||||
try {
|
||||
$value = $pool->get($item->getKey(), $signalingCallback, 0);
|
||||
|
@ -142,7 +144,8 @@ final class LockRegistry
|
|||
if (null !== $h = self::$openedFiles[$key] ?? null) {
|
||||
return $h;
|
||||
}
|
||||
set_error_handler(function () {});
|
||||
set_error_handler(function () {
|
||||
});
|
||||
try {
|
||||
$h = fopen(self::$files[$key], 'r+');
|
||||
} finally {
|
||||
|
|
|
@ -82,7 +82,9 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl
|
|||
}
|
||||
}
|
||||
|
||||
return $this->generateItems($keys, microtime(true), function ($k, $v, $hit) use ($default) { return $hit ? $v : $default; });
|
||||
return $this->generateItems($keys, microtime(true), function ($k, $v, $hit) use ($default) {
|
||||
return $hit ? $v : $default;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,7 +86,9 @@ trait MemcachedTrait
|
|||
if (!static::isSupported()) {
|
||||
throw new CacheException('Memcached >= 2.2.0 is required');
|
||||
}
|
||||
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
|
||||
set_error_handler(function ($type, $msg, $file, $line) {
|
||||
throw new \ErrorException($msg, 0, $type, $file, $line);
|
||||
});
|
||||
try {
|
||||
$options += static::$defaultClientOptions;
|
||||
$client = new \Memcached($options['persistent_id']);
|
||||
|
|
|
@ -61,7 +61,9 @@ trait RedisTrait
|
|||
|
||||
if ($redisClient instanceof \Predis\ClientInterface && $redisClient->getOptions()->exceptions) {
|
||||
$options = clone $redisClient->getOptions();
|
||||
\Closure::bind(function () { $this->options['exceptions'] = false; }, $options, $options)();
|
||||
\Closure::bind(function () {
|
||||
$this->options['exceptions'] = false;
|
||||
}, $options, $options)();
|
||||
$redisClient = new $redisClient($redisClient->getConnection(), $options);
|
||||
}
|
||||
|
||||
|
@ -177,7 +179,9 @@ trait RedisTrait
|
|||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn));
|
||||
}
|
||||
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
set_error_handler(function ($type, $msg) use (&$error) {
|
||||
$error = $msg;
|
||||
});
|
||||
$isConnected = $redis->isConnected();
|
||||
restore_error_handler();
|
||||
if (!$isConnected) {
|
||||
|
|
|
@ -44,7 +44,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function always(\Closure $then = null)
|
||||
{
|
||||
$this->ifPart = function ($v) { return true; };
|
||||
$this->ifPart = function ($v) {
|
||||
return true;
|
||||
};
|
||||
|
||||
if (null !== $then) {
|
||||
$this->thenPart = $then;
|
||||
|
@ -65,7 +67,9 @@ class ExprBuilder
|
|||
public function ifTrue(\Closure $closure = null)
|
||||
{
|
||||
if (null === $closure) {
|
||||
$closure = function ($v) { return true === $v; };
|
||||
$closure = function ($v) {
|
||||
return true === $v;
|
||||
};
|
||||
}
|
||||
|
||||
$this->ifPart = $closure;
|
||||
|
@ -80,7 +84,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifString()
|
||||
{
|
||||
$this->ifPart = function ($v) { return is_string($v); };
|
||||
$this->ifPart = function ($v) {
|
||||
return is_string($v);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -92,7 +98,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifNull()
|
||||
{
|
||||
$this->ifPart = function ($v) { return null === $v; };
|
||||
$this->ifPart = function ($v) {
|
||||
return null === $v;
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -104,7 +112,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifEmpty()
|
||||
{
|
||||
$this->ifPart = function ($v) { return empty($v); };
|
||||
$this->ifPart = function ($v) {
|
||||
return empty($v);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -116,7 +126,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifArray()
|
||||
{
|
||||
$this->ifPart = function ($v) { return is_array($v); };
|
||||
$this->ifPart = function ($v) {
|
||||
return is_array($v);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -130,7 +142,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifInArray(array $array)
|
||||
{
|
||||
$this->ifPart = function ($v) use ($array) { return in_array($v, $array, true); };
|
||||
$this->ifPart = function ($v) use ($array) {
|
||||
return in_array($v, $array, true);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -144,7 +158,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function ifNotInArray(array $array)
|
||||
{
|
||||
$this->ifPart = function ($v) use ($array) { return !in_array($v, $array, true); };
|
||||
$this->ifPart = function ($v) use ($array) {
|
||||
return !in_array($v, $array, true);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -156,8 +172,12 @@ class ExprBuilder
|
|||
*/
|
||||
public function castToArray()
|
||||
{
|
||||
$this->ifPart = function ($v) { return !is_array($v); };
|
||||
$this->thenPart = function ($v) { return array($v); };
|
||||
$this->ifPart = function ($v) {
|
||||
return !is_array($v);
|
||||
};
|
||||
$this->thenPart = function ($v) {
|
||||
return array($v);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -183,7 +203,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function thenEmptyArray()
|
||||
{
|
||||
$this->thenPart = function ($v) { return array(); };
|
||||
$this->thenPart = function ($v) {
|
||||
return array();
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -201,7 +223,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function thenInvalid($message)
|
||||
{
|
||||
$this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };
|
||||
$this->thenPart = function ($v) use ($message) {
|
||||
throw new \InvalidArgumentException(sprintf($message, json_encode($v)));
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -215,7 +239,9 @@ class ExprBuilder
|
|||
*/
|
||||
public function thenUnset()
|
||||
{
|
||||
$this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); };
|
||||
$this->thenPart = function ($v) {
|
||||
throw new UnsetKeyException('Unsetting key');
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ class EnumNode extends ScalarNode
|
|||
'The value %s is not allowed for path "%s". Permissible values: %s',
|
||||
json_encode($value),
|
||||
$this->getPath(),
|
||||
implode(', ', array_map('json_encode', $this->values))));
|
||||
implode(', ', array_map('json_encode', $this->values))
|
||||
));
|
||||
$ex->setPath($this->getPath());
|
||||
|
||||
throw $ex;
|
||||
|
|
|
@ -86,7 +86,8 @@ class FileLocator implements FileLocatorInterface
|
|||
private function isAbsolutePath($file)
|
||||
{
|
||||
if ($file[0] === '/' || $file[0] === '\\'
|
||||
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
||||
|| (
|
||||
strlen($file) > 3 && ctype_alpha($file[0])
|
||||
&& $file[1] === ':'
|
||||
&& ($file[2] === '\\' || $file[2] === '/')
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@ interface LoaderInterface
|
|||
*
|
||||
* @throws \Exception If something went wrong
|
||||
*/
|
||||
public function load($resource, string $type = NULL);
|
||||
public function load($resource, string $type = null);
|
||||
|
||||
/**
|
||||
* Returns whether this class supports the given resource.
|
||||
|
@ -36,7 +36,7 @@ interface LoaderInterface
|
|||
*
|
||||
* @return bool True if this class supports the given resource, false otherwise
|
||||
*/
|
||||
public function supports($resource, string $type = NULL);
|
||||
public function supports($resource, string $type = null);
|
||||
|
||||
/**
|
||||
* Gets the loader resolver.
|
||||
|
|
|
@ -101,7 +101,9 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface,
|
|||
$files = iterator_to_array(new \RecursiveIteratorIterator(
|
||||
new \RecursiveCallbackFilterIterator(
|
||||
new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
|
||||
function (\SplFileInfo $file) { return '.' !== $file->getBasename()[0]; }
|
||||
function (\SplFileInfo $file) {
|
||||
return '.' !== $file->getBasename()[0];
|
||||
}
|
||||
),
|
||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
||||
));
|
||||
|
|
|
@ -34,13 +34,17 @@ class ExprBuilderTest extends TestCase
|
|||
$this->assertFinalizedValueIs('new_value', $test, array('key' => true));
|
||||
|
||||
$test = $this->getTestBuilder()
|
||||
->ifTrue(function ($v) { return true; })
|
||||
->ifTrue(function ($v) {
|
||||
return true;
|
||||
})
|
||||
->then($this->returnClosure('new_value'))
|
||||
->end();
|
||||
$this->assertFinalizedValueIs('new_value', $test);
|
||||
|
||||
$test = $this->getTestBuilder()
|
||||
->ifTrue(function ($v) { return false; })
|
||||
->ifTrue(function ($v) {
|
||||
return false;
|
||||
})
|
||||
->then($this->returnClosure('new_value'))
|
||||
->end();
|
||||
$this->assertFinalizedValueIs('value', $test);
|
||||
|
|
|
@ -35,7 +35,10 @@ class XmlReferenceDumperTest extends TestCase
|
|||
|
||||
private function getConfigurationAsString()
|
||||
{
|
||||
return str_replace("\n", PHP_EOL, <<<'EOL'
|
||||
return str_replace(
|
||||
"\n",
|
||||
PHP_EOL,
|
||||
<<<'EOL'
|
||||
<!-- Namespace: http://example.org/schema/dic/acme_root -->
|
||||
<!-- scalar-required: Required -->
|
||||
<!-- enum-with-default: One of "this"; "that" -->
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue