actix / actix/actix-web

Can't set a signed cookie or a CookieJar

Offen
#2,465 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
A-web C-feature
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

~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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.