mirror of
https://github.com/YunoHost-Apps/snappymail_ynh.git
synced 2024-09-03 20:26:29 +02:00
sso
This commit is contained in:
parent
b8e0a6060d
commit
e3041e6224
6 changed files with 70 additions and 4 deletions
|
@ -17,10 +17,10 @@ allow_themes = On
|
||||||
allow_user_background = Off
|
allow_user_background = Off
|
||||||
|
|
||||||
; Language used by default
|
; Language used by default
|
||||||
language = "__LANGUAGE__"
|
language = "en"
|
||||||
|
|
||||||
; Admin Panel interface language
|
; Admin Panel interface language
|
||||||
language_admin = "__LANGUAGE__"
|
language_admin = "en"
|
||||||
|
|
||||||
; Allow language selection on settings screen
|
; Allow language selection on settings screen
|
||||||
allow_languages_on_settings = On
|
allow_languages_on_settings = On
|
||||||
|
@ -283,6 +283,8 @@ boundary_prefix = ""
|
||||||
kolab_enabled = Off
|
kolab_enabled = Off
|
||||||
dev_email = ""
|
dev_email = ""
|
||||||
dev_password = ""
|
dev_password = ""
|
||||||
|
custom_login_link='__PATH__/sso.php'
|
||||||
|
custom_logout_link='https://__MAIN_DOMAIN__/yunohost/sso/?action=logout'
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
current = "2.15.0"
|
current = "2.15.0"
|
||||||
|
|
|
@ -23,7 +23,7 @@ multi_instance = true
|
||||||
ldap = false
|
ldap = false
|
||||||
sso = false
|
sso = false
|
||||||
disk = "50M"
|
disk = "50M"
|
||||||
ram.build = "50M"
|
ram.build = "100M"
|
||||||
ram.runtime = "50M"
|
ram.runtime = "50M"
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
|
@ -55,5 +55,8 @@ ram.runtime = "50M"
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "mysql"
|
||||||
|
|
||||||
[resources.apt]
|
[resources.apt]
|
||||||
packages = "php8.2-sqlite3 php8.2-tidy php8.2-dom php8.2-intl php8.2-mysql php8.2-curl php8.2-gd php8.2-cli php8.2-xml php8.2-mbstring"
|
packages = "mariadb-server php8.2-sqlite3 php8.2-tidy php8.2-dom php8.2-intl php8.2-mysql php8.2-curl php8.2-gd php8.2-cli php8.2-xml php8.2-mbstring"
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
timezone=$(cat /etc/timezone)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -50,6 +50,28 @@ ynh_add_nginx_config
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# APP INITIAL CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
|
mkdir -p "$install_dir/data/_data_/_default_/configs"
|
||||||
|
chown $app:$app -R "$install_dir/data/_data_"
|
||||||
|
|
||||||
|
ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
|
||||||
|
chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSO
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Applying SSO patch..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -67,6 +67,25 @@ ynh_add_nginx_config
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||||
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
|
||||||
|
chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSO
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Applying SSO patch..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
17
sources/sso.php
Normal file
17
sources/sso.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Enable SnappyMail Api and include index file
|
||||||
|
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||||
|
require '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::CreateUserSsoHash($email, $password);
|
||||||
|
// redirect to webmail sso url
|
||||||
|
\header('Location: https://__DOMAIN____PATH__/?sso&hash='.$ssoHash);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
\header('Location: https://__DOMAIN____PATH__/snappymail/');
|
||||||
|
}
|
Loading…
Reference in a new issue