actix / actix/actix-web

Can't set a signed cookie or a CookieJar

Aperta
#2,465 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
A-web C-feature
Lingua principale
Rust
Stelle
24.8k
Fork
1.9k
Merge medio
23h 10m
PR unite (30g)
26

Descrizione

~Your issue may already be reported!
Please search on the [Actix Web issue tracker](https://github.com/actix/actix-web/issues) before creating one.~
Searched ✔️

## Expected Behavior

be able to set a signed cookie.

## Current Behavior

When trying to set a cookie (using `res_builder.cookie(...)`) it always uses `CookieJar::new()` (from source) leaving the user unable to set anything differently. When using `actix-identity` or `actix-session` it allows setting a signed cookie, but it might be too much of a stretch just to set a single cookie.

## Possible Solution

- Add a method to get/set cookie jar. To be able to use a `SignedJar` for instance.
Or
- Add a method to add signed cookies using a configuration. Just like `QueryConfig` does.

## Context

I was trying to set a trivial cookie that I don't want the end user to be able to modify it, but ended up using a lot of time trying, reading, and it ended up being way harder than I think it should be.

## Your Environment

```toml
actix = "0.10"
actix-web = "3.3"
actix-web-actors = "3.0"
actix-identity = "0.3"
```
* Rust Version (I.e, output of `rustc -V`): `rustc 1.56.1 (59eed8a2a 2021-11-01)`
* Actix Web Version: `3.3.2`

PS: This is my first time using `actix-web` so if there was something that I missed please advise.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.