Open iamfoolberg opened 2 years ago
Try this:
ngx.req.set_header("X-User-Email", tostring(res.user["email"]))
ngx.req.set_header("X-User-Username", tostring(res.user["preferred_username"]))
ngx.req.set_header("X-User-Name", tostring(res.user["name"]))
Environment
In my case, a host(192.168.2.8) has the following dockers:
resty nginx ("resty_version": "1.19.9.1", "Created": "2021-12-03T12:24:51.007868968Z") -p 8081:80 the nginx.conf looks like: /nc --> require("resty.openidc").authenticate(http://192.168.2.8:8080/auth/realms/nginx...,redirect_uri_path = "/ncc") /ncc --> /ncc/ /ncc/ --> proxy_pass http://192.168.2.8:8086;
keycloak(jboss/keycloak:15.0.2) -p 8080:8080
nextcloud (rootlogin/nextcloud) -p 8086:80 configured as described in https://eclipsesource.com/blogs/2018/01/11/authenticating-reverse-proxy-with-keycloak/
Expected behaviour
The idea is, when a client access 2.8:8081/nc, nginx call keycloak(2.8:8080) to auth, and if passed, redirect to 2.8:8081/ncc --> /ncc/ --> proxy_pass http://192.168.2.8:8086 (nextcloud);
Actual behaviour
With the following nginx.conf, a client can login to nextcloud, but i can not get its id or somthing else...
BTW, the lines
"ngx.log(ngx.ERR, '**********after auth**********')"
are not executed after user login.My question is, how can i get the user's id? I need the id to prepare some other containers for the user, such as aria2.
PS: is there any tutorial wikis or books for us newbies?
Minimized example
Configuration and NGINX server log files
Config and logs for the minimized example, possibly provided as attachments. nginx.conf
error.log --not real erros :)
thx.