-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for returning authenticated user #173
Conversation
As for now, if oauth2_proxy is used only as authenticator, it doesn't return information about authenticated user. This patch introduces header X-Authenticated-User which is returned from proxy upstream. This way further user-based authorization is possible.
@lsiudut I generally think I suggest that a better way to implement this would be to enable |
I understand you completely and I was trying to make my solution this way. I thought that returning name of authenticated user is similar action as forwarding basic auth to application with difference, that we may perform some actions on http server level (nginx and lua authorization in this case). Unfortunately we have setup which makes inserting another proxy very difficult. If you're finding this solution too invasive just close this PR. |
What would be good way to pass authentication data in use case of nginx auth_request directive? |
@pawelgocek can you expand upon your question? What are you trying to accomplish? |
To pass information about authenticated user name/email to upstream. Right now it is possible when oauth2_proxy works as proxy, but when it's used as authenticator (for auth_request directive) we don't receive any information except authentication status (HTTP 202 or 401). In our use case nginx is proxying directly to microservices and there's no easy way to inject oauth2_proxy between them. Also we can't use it before nginx, as not all endpoints are suppose to be covered by authenticator. auth_request directive is perfect for us, but we lack info about authenticated user name. We could try to make some hacky solution and proxy authenticated request back to nginx, but we'd like to avoid it. |
Actually, this should be possible with the
See also: http://stackoverflow.com/questions/19366215/setting-headers-with-nginx-auth-request-proxy |
Yes, but only if oauth2_proxy return X-Authenticated-Email in response for /auth request :). For now it's not returning such header. My patch adds exactly this functionality. |
If email is present user name is forged from it, what may duplicate user names when multiple domains are allowed.
+1 |
This looks super-helpful for |
This still looks super-helpful for auth_request users (&& required for some grafana users). |
We are currently using the auth_request directive as well which saves us a lot of nginx instances and configuration details for oauth2_proxy. So is there anything still blocking #298 or can we expect it to be merged soon? Otherwise we will have to bite the bullet and either switch to the branch containing the change or start using oauth2_proxy as an actual proxy. |
We are also using the auth_request directive and would like to use #298 if it were merged. |
This is enhancement of bitly#173 to use "Auth Request" consistently in the command-line option, configuration file and response headers. It always sets the X-Auth-Request-User response header and if the email is available, sets X-Auth-Request-Email as well.
This is enhancement of bitly#173 to use "Auth Request" consistently in the command-line option, configuration file and response headers. It always sets the X-Auth-Request-User response header and if the email is available, sets X-Auth-Request-Email as well.
#319 has been merged, so this can be closed. |
This is enhancement of bitly#173 to use "Auth Request" consistently in the command-line option, configuration file and response headers. It always sets the X-Auth-Request-User response header and if the email is available, sets X-Auth-Request-Email as well.
As for now, if oauth2_proxy is used only as authenticator, it doesn't return information about authenticated user. This patch introduces header X-Authenticated-User which is returned from proxy upstream. This way further user-based authorization is possible.