Add auth_request_set directive (#154)

This commit is contained in:
Philip Henning 2019-07-12 20:14:46 +02:00 committed by Alessandro Fael Garcia
parent 43fdafe1b1
commit 37641fcdf1
3 changed files with 39 additions and 2 deletions

View File

@ -345,6 +345,9 @@ nginx_main_template:
stream_enable: false stream_enable: false
http_global_autoindex: false http_global_autoindex: false
#auth_request_http: /auth #auth_request_http: /auth
#auth_request_set_http:
#name: $auth_user
#value: $upstream_http_x_user
# Enable creating dynamic templated NGINX HTTP configuration files. # Enable creating dynamic templated NGINX HTTP configuration files.
# Defaults will not produce a valid configuration. Instead they are meant to showcase # Defaults will not produce a valid configuration. Instead they are meant to showcase
@ -365,6 +368,9 @@ nginx_http_template:
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
add_headers: add_headers:
strict_transport_security: strict_transport_security:
name: Strict-Transport-Security name: Strict-Transport-Security
@ -406,6 +412,9 @@ nginx_http_template:
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
#returns: #returns:
#return302: #return302:
#code: 302 #code: 302
@ -498,7 +507,10 @@ nginx_http_template:
auth_basic: null auth_basic: null
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_req: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
#returns: #returns:
#return302: #return302:
#code: 302 #code: 302

View File

@ -157,6 +157,9 @@ nginx_main_template:
stream_enable: false stream_enable: false
http_global_autoindex: false http_global_autoindex: false
#auth_request_http: /auth #auth_request_http: /auth
#auth_request_set_http:
#name: $auth_user
#value: $upstream_http_x_user
# Enable creating dynamic templated NGINX HTTP configuration files. # Enable creating dynamic templated NGINX HTTP configuration files.
# Defaults will not produce a valid configuration. Instead they are meant to showcase # Defaults will not produce a valid configuration. Instead they are meant to showcase
@ -177,6 +180,9 @@ nginx_http_template:
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
add_headers: add_headers:
strict_transport_security: strict_transport_security:
name: Strict-Transport-Security name: Strict-Transport-Security
@ -218,6 +224,9 @@ nginx_http_template:
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_request: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
#returns: #returns:
#return302: #return302:
#code: 302 #code: 302
@ -310,7 +319,10 @@ nginx_http_template:
auth_basic: null auth_basic: null
auth_basic_user_file: null auth_basic_user_file: null
try_files: $uri $uri/index.html $uri.html =404 try_files: $uri $uri/index.html $uri.html =404
#auth_req: /auth #auth_request: /auth
#auth_request_set:
#name: $auth_user
#value: $upstream_http_x_user
#returns: #returns:
#return302: #return302:
#code: 302 #code: 302

View File

@ -48,6 +48,9 @@ proxy_temp_path {{ item.value.reverse_proxy.proxy_temp_path.path }} {{ item.valu
{% if item.value.auth_request_http is defined %} {% if item.value.auth_request_http is defined %}
auth_request {{ item.value.auth_request_http }}; auth_request {{ item.value.auth_request_http }};
{% endif %} {% endif %}
{% if item.value.auth_request_set_http is defined %}
auth_request_set {{ item.value.auth_request_set_http.name }} {{ item.value.auth_request_set_http.value }};
{% endif %}
server { server {
{% if item.value.ssl is defined and item.value.ssl %} {% if item.value.ssl is defined and item.value.ssl %}
@ -111,6 +114,9 @@ server {
{% if item.value.auth_request is defined %} {% if item.value.auth_request is defined %}
auth_request {{ item.value.auth_request }}; auth_request {{ item.value.auth_request }};
{% endif %} {% endif %}
{% if item.value.auth_request_set is defined %}
auth_request_set {{ item.value.auth_request_set.name }} {{ item.value.auth_request_set.value }};
{% endif %}
{% if item.value.reverse_proxy is defined and item.value.reverse_proxy %} {% if item.value.reverse_proxy is defined and item.value.reverse_proxy %}
{% for location in item.value.reverse_proxy.locations %} {% for location in item.value.reverse_proxy.locations %}
@ -126,6 +132,9 @@ server {
{% if item.value.reverse_proxy.locations[location].auth_request is defined %} {% if item.value.reverse_proxy.locations[location].auth_request is defined %}
auth_request {{ item.value.reverse_proxy.locations[location].auth_request }}; auth_request {{ item.value.reverse_proxy.locations[location].auth_request }};
{% endif %} {% endif %}
{% if item.value.reverse_proxy.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.reverse_proxy.locations[location].auth_request_set.name }} {{ item.value.reverse_proxy.locations[location].auth_request_set.value }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].auth_basic is defined and item.value.reverse_proxy.locations[location].auth_basic %} {% if item.value.reverse_proxy.locations[location].auth_basic is defined and item.value.reverse_proxy.locations[location].auth_basic %}
auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}"; auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}";
{% endif %} {% endif %}
@ -274,6 +283,10 @@ server {
{% if item.value.web_server.locations[location].auth_request is defined %} {% if item.value.web_server.locations[location].auth_request is defined %}
auth_request {{ item.value.web_server.locations[location].auth_request }}; auth_request {{ item.value.web_server.locations[location].auth_request }};
{% endif %} {% endif %}
{% if item.value.web_server.locations[location].auth_request_set is defined %}
auth_request_set {{ item.value.web_server.locations[location].auth_request_set.name }} {{ item.value.web_server.locations[location].auth_request_set.value }};
{% endif %}
} }
{% endfor %} {% endfor %}
{% if item.value.web_server.http_demo_conf %} {% if item.value.web_server.http_demo_conf %}