TeskaLabs / seacat-auth

SeaCat Auth provides authentication, authorization, identity management, session management and other access control features.
GNU General Public License v3.0
11 stars 6 forks source link

Multiple cookies and tracking ID refactoring #188

Closed byewokko closed 1 year ago

byewokko commented 1 year ago

Breaking changes

Cookies

Cookie introspection setup

Setting custom HTTP headers using a webhook

Setting custom cookies

The webhook can be used to setting custom cookies if Nginx is configured accordingly. The webhook must provide the cookie name and value and optionally other parameters. Seacat Auth will propagate that data in the auth request response header. You can then use the auth_request_set directive to extract the header value from the response and the add_header to create a new Set-Cookie header with that value. Example webhook payload:

{
 "response_headers": {
  "Set-My-Custom-Cookie": "MyCustomCookie=d75bj6czt5gi7d6xdrtvxrt; HttpOnly; Secure"
 }
}

Example nginx location config

location /protected {
  auth_request /my_app_anon_auth;
  # Set Seacat client cookie (no change here, same as before)
  auth_request_set   $set_cookie $upstream_http_set_cookie;
  add_header    Set-Cookie $set_cookie;
  # Set MyCustomCookie
  auth_request_set   $my_custom_cookie $upstream_http_my_custom_cookie;
  add_header    Set-Cookie $my_custom_cookie;
  ...
}

Client config

New client attributes have been added: