Skip to content
Snippets Groups Projects
Commit 88242db4 authored by David Coutadeur's avatar David Coutadeur
Browse files

allow to customize sd and wp with an extra configuration file (#74)

parent 7f236fad
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,9 @@ exportedHeaders:
Auth-User: '$uid'
{{ lemonldap2_servicedesk_name }}.{{ lemonldap2_domain }}:
Auth-User: '$uid'
ssp-extra-config: '"extra"'
{{ lemonldap2_whitepages_name }}.{{ lemonldap2_domain }}:
wp-extra-config: '"extra"'
portalDisplayRegister: '{{ lemonldap2_portaldisplayregister }}'
portalCheckLogins: 0
portalDisplayResetPassword: '{{ lemonldap2_portaldisplayresetpassword }}'
......
......@@ -32,6 +32,9 @@ server {
auth_request_set $authuser $upstream_http_auth_user;
proxy_set_header Auth-User $authuser;
auth_request_set $sspextraconfig $upstream_http_ssp_extra_config;
proxy_set_header ssp-extra-config $sspextraconfig;
auth_request_set $lmcookie $upstream_http_cookie;
proxy_set_header Cookie $lmcookie;
......
......@@ -32,6 +32,9 @@ server {
auth_request_set $lmcookie $upstream_http_cookie;
proxy_set_header Cookie $lmcookie;
auth_request_set $wpextraconfig $upstream_http_wp_extra_config;
proxy_set_header wp-extra-config $wpextraconfig;
proxy_pass http://{{ lemonldap2_whitepages_host }}:{{ lemonldap2_whitepages_port }}/;
include /etc/nginx/proxy_params;
}
......
......@@ -20,3 +20,6 @@ $logout_link = "https://auth.{{ SSO_DOMAIN}}/";
# Audit file
$audit_log_file = "php://stdout";
$header_name_audit_admin = "AUTH_USER";
# Extra configuration header
$header_name_extra_config="ssp-extra-config";
......@@ -26,3 +26,17 @@ $logout_link = "https://auth.{{ SSO_DOMAIN}}/";
# Maps
$use_map = true;
$http_url = "https://{{ VHOST_NAME }}.{{ SSO_DOMAIN }}/";
# Extra configuration header
$header_name_extra_config="wp-extra-config";
# Allow to override current settings with an extra configuration file, whose reference is passed in HTTP_HEADER $header_name_extra_config
if (isset($header_name_extra_config)) {
$extraConfigKey = "HTTP_".strtoupper(str_replace('-','_',$header_name_extra_config));
if (array_key_exists($extraConfigKey, $_SERVER)) {
$extraConfig = preg_replace("/[^a-zA-Z0-9-_]+/", "", filter_var($_SERVER[$extraConfigKey], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH));
if (strlen($extraConfig) > 0 && file_exists (__DIR__ . "/config.inc.".$extraConfig.".php")) {
require __DIR__ . "/config.inc.".$extraConfig.".php";
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment