var remote_user -> remote_user_js

This commit is contained in:
Andrea Dell'Amico 2021-11-04 18:30:20 +01:00
parent 8586323ae4
commit 0584e1588d
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
export default { config, exportBackendHeaders };
function exportBackendHeaders(context){
// exportVariable("remote_user", context.authn.verified_token.preferred_username)
// exportVariable("remote_user_js", context.authn.verified_token.preferred_username)
return context
}
var config = {

View File

@ -1,7 +1,7 @@
proxy_cache_path /var/cache/nginx/pep keys_zone=token_responses:1m max_size=2m;
js_var $auth_token;
js_var $pep_credentials;
js_var $remote_user;
js_var $remote_user_js;
underscores_in_headers on;
upstream _inception-server {
@ -42,6 +42,8 @@ server {
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Authorization "Bearer $auth_token";
proxy_set_header remote_user "$remote_user_js";
proxy_pass http://_inception-server;
}
@ -60,7 +62,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Authorization "Bearer $auth_token";
proxy_set_header remote_user "$remote_user";
proxy_set_header remote_user "$remote_user_js";
proxy_pass http://_inception-server;
rewrite ^/_d4sauth / last;
}

View File

@ -40,7 +40,7 @@ log(context, "headers " + njs.dump(r.headersIn))
throw new Error("Unauthorized")
}
}).then(userinfo => {
exportVariable(context, "remote_user", userinfo.result.username)
exportVariable(context, "remote_user_js", userinfo.result.username)
{% if nginx_pep_debug_enabled %}
log(context, "username is " + userinfo.result.username)
{% endif %}