nginxinc / nginx-ldap-auth

Example of LDAP authentication using ngx_http_auth_request_module
BSD 2-Clause "Simplified" License
678 stars 202 forks source link

Set cookie on successful authentication #70

Open mjiderhamn opened 4 years ago

mjiderhamn commented 4 years ago

The current implementation has support for reading the auth info from a cookie (named in X-CookieName). This PR adds the ability to also set the value of that same cookie upon successful authentication.

In order to make use of this feature, the following should be added to the Nginx config, in addition to auth_request

  auth_request_set $saved_set_cookie $upstream_http_set_cookie;
  add_header Set-Cookie $saved_set_cookie;