correstion CAS nextcloud

This commit is contained in:
afornerot 2024-09-22 10:35:25 +02:00
parent 55e4226456
commit 2ca0cef4f6
8 changed files with 29 additions and 19 deletions

View File

@ -2,8 +2,6 @@
if [ -f "$dir/dicos/.env.dicos" ]; then if [ -f "$dir/dicos/.env.dicos" ]; then
echo $dir
dicos="$dir/dicos/.env.dicos" dicos="$dir/dicos/.env.dicos"
# Exporter la variable # Exporter la variable

View File

@ -30,7 +30,7 @@
<dependencies> <dependencies>
<owncloud min-version="10.0" max-version="10.10"/> <owncloud min-version="10.0" max-version="10.10"/>
<nextcloud min-version="14" max-version="27.1"/> <nextcloud min-version="14" max-version="27.2"/>
</dependencies> </dependencies>
<commands> <commands>

View File

@ -123,7 +123,7 @@ class AuthenticationController extends Controller
$this->loggingService->write(\OCA\UserCas\Service\LoggingService::FATAL, 'Fatal error with code: ' . $e->getCode() . ' and message: ' . $e->getMessage()); $this->loggingService->write(\OCA\UserCas\Service\LoggingService::FATAL, 'Fatal error with code: ' . $e->getCode() . ' and message: ' . $e->getMessage());
header("Location: " . $this->appService->getAbsoluteURL('/')); header("Location: " . this->getServiceBasedUrl());
die(); die();
} }
} }
@ -217,7 +217,7 @@ class AuthenticationController extends Controller
$this->loggingService->write(\OCA\UserCas\Service\LoggingService::FATAL, 'Fatal error with code: ' . $e->getCode() . ' and message: ' . $e->getMessage()); $this->loggingService->write(\OCA\UserCas\Service\LoggingService::FATAL, 'Fatal error with code: ' . $e->getCode() . ' and message: ' . $e->getMessage());
header("Location: " . $this->appService->getAbsoluteURL('/')); header("Location: " . this->getServiceBasedUrl());
die(); die();
} }
} }
@ -278,19 +278,26 @@ class AuthenticationController extends Controller
$newProtocol = 'http://'; $newProtocol = 'http://';
if (intval($this->config->getAppValue($this->appName, 'cas_server_port')) === 443) {
$newProtocol = 'https://';
}
$params['backUrl'] = $newProtocol . $this->config->getAppValue($this->appName, 'cas_server_hostname') . $this->config->getAppValue($this->appName, 'cas_server_path'); $params['backUrl'] = $newProtocol . $this->config->getAppValue($this->appName, 'cas_server_hostname') . $this->config->getAppValue($this->appName, 'cas_server_path');
} else {*/ } else {*/
$params['backUrl'] = $this->appService->getAbsoluteURL('/');
$params['backUrl'] = this->getServiceBasedUrl();
//} //}
$response = new TemplateResponse($this->appName, 'cas-error', $params, 'guest'); $response = new TemplateResponse($this->appName, 'cas-error', $params, 'guest');
return $response; return $response;
} }
private function getServiceBasedUrl(): string {
$overwrite = \OC::$server->getConfig()->getSystemValue('overwrite.cli.url');
if($overwrite) return $overwrite;
$httpProtocol = \OC::$server->getConfig()->getSystemValue('protocol');
$currentUrl = $_SERVER['SERVER_NAME'];
return $httpProtocol . $currentUrl;
}
} }

View File

@ -406,7 +406,7 @@ class UserHooks
# Reset cookie # Reset cookie
setcookie("user_cas_redirect_url", '/', 0, '/'); setcookie("user_cas_redirect_url", '/', 0, '/');
\phpCAS::logout(array("service" => $this->appService->getAbsoluteURL('/'))); \phpCAS::logout(array("service" => $this->getServiceBasedUrl()));
} else { } else {
@ -445,4 +445,14 @@ class UserHooks
return $attributes; return $attributes;
} }
private function getServiceBasedUrl(): string {
$overwrite = \OC::$server->getConfig()->getSystemValue('overwrite.cli.url');
if($overwrite) return $overwrite;
$httpProtocol = \OC::$server->getConfig()->getSystemValue('protocol');
$currentUrl = $_SERVER['SERVER_NAME'];
return $httpProtocol . $currentUrl;
}
} }

View File

@ -54,7 +54,7 @@ run_as 'php occ app:update files_external'
run_as 'php occ app:enable files_external' run_as 'php occ app:enable files_external'
if [[ "${NEXTCLOUD_SAMBA}" == "1" ]] if [[ "${NEXTCLOUD_SAMBA}" == "1" ]]
then then
run_as 'php occ files_external:import /envole/mount.json -q' run_as 'php occ files_external:import /nine/mount.json -q'
fi fi
echo echo
@ -67,7 +67,7 @@ echo
echo "== USER CAS" echo "== USER CAS"
if [[ "${MODE_AUTH}" == "CAS" && "${CAS_ACTIVATE}" == "1" ]] if [[ "${MODE_AUTH}" == "CAS" && "${CAS_ACTIVATE}" == "1" ]]
then then
cp -rf /envole/app/user_cas /var/www/html/custom_apps cp -rf /nine/app/user_cas /var/www/html/custom_apps
chown www-data:www-data /var/www/html/custom_apps -R chown www-data:www-data /var/www/html/custom_apps -R
run_as 'php occ config:app:set user_cas cas_server_hostname --value='${CAS_HOST}' -q' run_as 'php occ config:app:set user_cas cas_server_hostname --value='${CAS_HOST}' -q'
run_as 'php occ config:app:set user_cas cas_server_path --value='${CAS_PATH}' -q' run_as 'php occ config:app:set user_cas cas_server_path --value='${CAS_PATH}' -q'

View File

@ -1,5 +0,0 @@
# nineskeletor
ProxyPass /nineskeletor http://nineskeletor/nineskeletor retry=0 keepalive=On
ProxyPassReverse /nineskeletor http://nineskeletor/nineskeletor retry=0

View File

@ -8,7 +8,7 @@ WORDPRESS_DB_PASSWORD=${MARIADB_PASSWORD}
WORDPRESS_TITLE=wordpress WORDPRESS_TITLE=wordpress
WORDPRESS_USER=${ADMIN_USER} WORDPRESS_USER=${ADMIN_USER}
WORDPRESS_PASSWORD=${ADMIN_PASSWORD} WORDPRESS_PASSWORD=${ADMIN_PASSWORD}
WORDPRESS_EMAIL=${ADMIN_USER}@noreply.fr WORDPRESS_EMAIL=${ADMIN_EMAIL}
WORDPRESS_PROTOCOL=${PROTOCOLE} WORDPRESS_PROTOCOL=${PROTOCOLE}
WORDPRESS_DOMAINE=${WEB_URL} WORDPRESS_DOMAINE=${WEB_URL}
WORDPRESS_ALIAS=/wordpress/ WORDPRESS_ALIAS=/wordpress/