mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
SSO first try
SSO with a workaround until someone can write an appropriate NGINX file. The workaround is to put Rainloop in a subfolder, and let the index.php be the file doing the SSO
This commit is contained in:
parent
64fb4bb9fd
commit
c5ed66ad19
4 changed files with 41 additions and 1 deletions
|
@ -11,7 +11,7 @@ location PATHTOCHANGE {
|
|||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php5-fpm-NAMETOCHANGE.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_index sso.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
|
|
18
conf/sso.php
Normal file
18
conf/sso.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
// Enable RainLoop Api and include index file
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||
include '/var/www/rainloop/index.php';
|
||||
|
||||
// Retrieve email and password
|
||||
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
$email = $_SERVER['HTTP_EMAIL'];
|
||||
$password = $_SERVER['PHP_AUTH_PW'];
|
||||
$ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password);
|
||||
|
||||
// redirect to webmail sso url
|
||||
\header('Location: https://test.com/rainloop/index.php?sso&hash='.$ssoHash);
|
||||
}
|
||||
else {
|
||||
\header('Location: https://test.com/rainloop/index.php');
|
||||
}
|
|
@ -70,6 +70,17 @@ sed -i "s@domain.tld@$domain@g" ../conf/data/domains/domain.tld.ini
|
|||
sudo cp ../conf/data/domains/domain.tld.ini $final_path/data/_data_/_default_/domains/$domain.ini
|
||||
sudo cp ../conf/data/domains/disabled $final_path/data/_data_/_default_/domains/disabled
|
||||
|
||||
# SSO
|
||||
sudo cp ../conf/sso.php $final_path/sso.php
|
||||
|
||||
# Temporary workaround until someone finds a way to setup NGINX properly...
|
||||
sudo mkdir -p $final_path/app
|
||||
sudo mv $final_path/index.php $final_path/app/index.php
|
||||
sudo mv $final_path/data $final_path/app/data
|
||||
sudo mv $final_path/rainloop $final_path/app/rainloop
|
||||
sudo sed -i "s@index.php@app/@g" $final_path/sso.php
|
||||
sudo mv $final_path/sso.php $final_path/index.php
|
||||
|
||||
# Set permissions to rainloop directory
|
||||
# sudo mkdir -p $final_path/logs
|
||||
sudo chown -R www-data:www-data $final_path
|
||||
|
|
|
@ -37,6 +37,17 @@ sudo cp ../conf/php-fpm.conf $finalphpconf
|
|||
sudo chown root: $finalphpconf
|
||||
sudo chmod 644 $finalphpconf
|
||||
|
||||
# SSO
|
||||
sudo cp ../conf/sso.php $final_path/sso.php
|
||||
|
||||
# Temporary workaround until someone finds a way to setup NGINX properly...
|
||||
sudo mkdir -p $final_path/app
|
||||
sudo mv $final_path/index.php $final_path/app/index.php
|
||||
sudo mv $final_path/data $final_path/app/data
|
||||
sudo mv $final_path/rainloop $final_path/app/rainloop
|
||||
sudo sed -i "s@index.php@app/@g" $final_path/sso.php
|
||||
sudo mv $final_path/sso.php $final_path/index.php
|
||||
|
||||
# Make app public if necessary
|
||||
sudo yunohost app setting $app is_public -v "$is_public"
|
||||
if [ "$is_public" = "Yes" ];
|
||||
|
|
Loading…
Add table
Reference in a new issue