actix-jwt-auth-middleware
actix-jwt-auth-middleware copied to clipboard
allow modifying cookie settings
Allow modifying cookie settings by passing closure with CookieBuilder to cookie_adjust in TokenSigner builder.
As mentioned in https://github.com/michaelvanstraten/actix-jwt-auth-middleware/issues/24, we could change cookie settings when creating the initial access_token or refresh_token, but we couldn't easily change the access_token when it is refreshed. This PR allows to adjust cookie settings (e.g. Path) as follows using cookie_adjust()
:
TokenSigner::new()
.signing_key(key.clone())
.algorithm(Hs256)
.cookie_adjust(|builder: CookieBuilder| builder.path("/"))
.build()
.expect("Error: Could not create a TokenSigner")