diff --git a/.env b/.env index 511b784..f4d7575 100755 --- a/.env +++ b/.env @@ -2,6 +2,7 @@ APP_ENV=dev APP_SECRET=changeme APP_SESSIONTIME=1440 +PROTOCOLE=https # Webpack APP_PUBLIC_PATH=/nineskeletor/build diff --git a/composer.json b/composer.json index 4fc17ba..04ff720 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "friendsofsymfony/ckeditor-bundle": "^2.4", "friendsofsymfony/rest-bundle": "^3.3", "gregwar/captcha-bundle": "^2.2", - "jasig/phpcas": "^1.5", + "jasig/phpcas": "^1.6", "mashape/unirest-php": "^3.0", "nelmio/api-doc-bundle": "^4.9", "oneup/uploader-bundle": "^3.2", diff --git a/composer.lock b/composer.lock index 9a412b1..d7708da 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dc1aeeadbcecb4aa48c52c26ec8b74bf", + "content-hash": "60bf16e083bd33ab708cf0568e170d7b", "packages": [ { "name": "aws/aws-crt-php", @@ -2492,16 +2492,16 @@ }, { "name": "jasig/phpcas", - "version": "1.5.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/apereo/phpCAS.git", - "reference": "d6f5797fb568726f34c8e48741776d81e4a2646b" + "reference": "c129708154852656aabb13d8606cd5b12dbbabac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/apereo/phpCAS/zipball/d6f5797fb568726f34c8e48741776d81e4a2646b", - "reference": "d6f5797fb568726f34c8e48741776d81e4a2646b", + "url": "https://api.github.com/repos/apereo/phpCAS/zipball/c129708154852656aabb13d8606cd5b12dbbabac", + "reference": "c129708154852656aabb13d8606cd5b12dbbabac", "shasum": "" }, "require": { @@ -2522,6 +2522,9 @@ } }, "autoload": { + "files": [ + "source/CAS.php" + ], "classmap": [ "source/" ] @@ -2554,9 +2557,10 @@ ], "support": { "issues": "https://github.com/apereo/phpCAS/issues", - "source": "https://github.com/apereo/phpCAS/tree/1.5.0" + "source": "https://github.com/apereo/phpCAS/tree/1.6.1" }, - "time": "2022-05-03T21:12:54+00:00" + "abandoned": "apereo/phpcas", + "time": "2023-02-19T19:52:35+00:00" }, { "name": "jean85/pretty-package-versions", @@ -13654,5 +13658,5 @@ "ext-iconv": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/config/services.yaml b/config/services.yaml index ff25a45..9bca076 100755 --- a/config/services.yaml +++ b/config/services.yaml @@ -2,6 +2,7 @@ parameters: appEnv: "%env(resolve:APP_ENV)%" appSecret: "%env(resolve:APP_SECRET)%" appSessiontime: "%env(resolve:APP_SESSIONTIME)%" + protocole: '%env(resolve:PROTOCOLE)%' appWeburl: "%env(resolve:APP_WEBURL)%" appAuth: "%env(resolve:APP_AUTH)%" diff --git a/misc/docker/Dockerfile b/misc/docker/Dockerfile index ce6fd17..b3a2483 100644 --- a/misc/docker/Dockerfile +++ b/misc/docker/Dockerfile @@ -10,10 +10,6 @@ COPY . . # Installation des dépendances composer RUN composer install --no-interaction -RUN mkdir -p /app/public/uploads -RUN chown apache /app/public/uploads -R -RUN chmod u+w /app/public/uploads -R - RUN mkdir -p /app/var RUN chown apache /app/var -R RUN chmod u+w /app/var -R diff --git a/misc/script/reconfigure.sh b/misc/script/reconfigure.sh index ae58dde..eac29ed 100755 --- a/misc/script/reconfigure.sh +++ b/misc/script/reconfigure.sh @@ -9,19 +9,9 @@ DIR=$(pwd) bin/console d:s:u --force --complete -# Si l'alias courrant est différent que celui généré = on compile encore -last_alias="" -if [ -f .alias ]; then - last_alias=$(cat .alias) -fi - -if [ "$APP_MANIFEST_KEY_PREFIX" != "$last_alias" ]; then - echo "Alias a changé. Recompilation nécessaire." - echo "$APP_MANIFEST_KEY_PREFIX" > .alias - yarn encore dev - yarn encore prod -fi +yarn encore prod bin/console app:Init +bin/console app:Cron exec $@ \ No newline at end of file diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 125cded..fca4668 100755 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -108,7 +108,7 @@ class InitCommand extends Command if (!$niveau01) { $niveau01 = new Niveau01(); $niveau01->setId(-1); - $niveau01->setLabel($this->appname); + $niveau01->setLabel("Nineskeletor"); $niveau01->setApikey(Uuid::uuid4()); $this->em->persist($niveau01); $this->em->flush(); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 34380cc..bd7ff5e 100755 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -81,9 +81,10 @@ class SecurityController extends AbstractController $appMasteridentity = $this->getParameter('appMasteridentity'); // Init Client CAS - $alias = $this->getParameter('appAlias'); - \phpCAS::setDebug($this->appKernel->getProjectDir().'/var/log/cas.log'); - \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('casHost'), intval($this->getParameter('casPort')), is_null($this->getParameter('casPath')) ? '' : $this->getParameter('casPath'), false); + $url=$this->getHost($request); + $url=str_replace("http://",$this->getParameter("protocole")."://",$url); + $url=str_replace("https://",$this->getParameter("protocole")."://",$url); + \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('casHost'), intval($this->getParameter('casPort')), is_null($this->getParameter('casPath')) ? '' : $this->getParameter('casPath'), $url, false); \phpCAS::setNoCasServerValidation(); // Authentification @@ -352,14 +353,17 @@ class SecurityController extends AbstractController $request->getSession()->invalidate(); // Init Client CAS - $alias = $this->getParameter('appAlias'); - \phpCAS::setDebug($this->appKernel->getProjectDir().'/var/log/cas.log'); - \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('casHost'), intval($this->getParameter('casPort')), is_null($this->getParameter('casPath')) ? '' : $this->getParameter('casPath'), false); + $url=$this->getHost($request); + $url=str_replace("http://",$this->getParameter("protocole")."://",$url); + $url=str_replace("https://",$this->getParameter("protocole")."://",$url); + \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('casHost'), intval($this->getParameter('casPort')), is_null($this->getParameter('casPath')) ? '' : $this->getParameter('casPath'), $url, false); \phpCAS::setNoCasServerValidation(); // Logout - $url = $this->generateUrl('app_home', [], UrlGeneratorInterface::ABSOLUTE_URL); - \phpCAS::logout(['service' => $url]); + $url=$this->generateUrl('app_home', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $url=str_replace("http://",$this->getParameter("protocole")."://",$url); + $url=str_replace("https://",$this->getParameter("protocole")."://",$url); + \phpCAS::logout(array("service"=>$url)); return true; } @@ -576,4 +580,12 @@ class SecurityController extends AbstractController return $this->redirect($this->generateUrl('app_home')); } } + + private function getHost($request) { + $host = $request->getHost(); + $protocol = $request->getScheme(); + $port = $request->getPort(); + return $protocol."://".$host.($port!=80&&$port!=443?":".$port:""); + } + }