1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 15:51:06 +01:00

feat(session): add rustls (actix#342) (#402)

* feat(session): add rustls feature (actix#342)

* docs(session): fix weird grammar

* docs: update crate docs

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
zbigniewzolnierowicz 2024-06-09 21:19:29 +02:00 committed by GitHub
parent 8195484415
commit 931c4eea4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 5 deletions

View File

@ -2,6 +2,7 @@
## Unreleased ## Unreleased
- Added support for using `rustls` in `actix-session` instead of `native-tls`
- Remove `redis-actor-session` crate feature (and, therefore, the `actix-redis` based storage backend). - Remove `redis-actor-session` crate feature (and, therefore, the `actix-redis` based storage backend).
## 0.9.0 ## 0.9.0

View File

@ -22,6 +22,7 @@ default = []
cookie-session = [] cookie-session = []
redis-rs-session = ["redis", "rand"] redis-rs-session = ["redis", "rand"]
redis-rs-tls-session = ["redis-rs-session", "redis/tokio-native-tls-comp"] redis-rs-tls-session = ["redis-rs-session", "redis/tokio-native-tls-comp"]
redis-rs-tls-session-rustls = ["redis-rs-session", "redis/tokio-rustls-comp"]
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"

View File

@ -108,12 +108,20 @@ By default, `actix-session` does not provide any storage backend to retrieve and
actix-session = { version = "...", features = ["redis-rs-session"] } actix-session = { version = "...", features = ["redis-rs-session"] }
``` ```
Add the `redis-rs-tls-session` feature flag if you want to connect to Redis using a secured connection: Add the `redis-rs-tls-session` feature flag if you want to connect to Redis using a secured connection (via the `native-tls` crate):
```toml ```toml
[dependencies] [dependencies]
# ... # ...
actix-session = { version = "...", features = ["redis-rs-session", "redis-rs-tls-session"] } actix-session = { version = "...", features = ["redis-rs-tls-session"] }
```
If you instead prefer depending on `rustls`, use the `redis-rs-tls-session-rustls` feature flag:
```toml
[dependencies]
# ...
actix-session = { version = "...", features = ["redis-rs-tls-session-rustls"] }
``` ```
You can implement your own session storage backend using the [`SessionStore`] trait. You can implement your own session storage backend using the [`SessionStore`] trait.

View File

@ -116,12 +116,20 @@ attached to your sessions. You can enable:
``` ```
Add the `redis-rs-tls-session` feature flag if you want to connect to Redis using a secured Add the `redis-rs-tls-session` feature flag if you want to connect to Redis using a secured
connection: connection (via the `native-tls` crate):
```toml ```toml
[dependencies] [dependencies]
# ... # ...
actix-session = { version = "...", features = ["redis-rs-session", "redis-rs-tls-session"] } actix-session = { version = "...", features = ["redis-rs-tls-session"] }
```
If you instead prefer depending on `rustls`, use the `redis-rs-tls-session-rustls` feature flag:
```toml
[dependencies]
# ...
actix-session = { version = "...", features = ["redis-rs-tls-session-rustls"] }
``` ```
You can implement your own session storage backend using the [`SessionStore`] trait. You can implement your own session storage backend using the [`SessionStore`] trait.

View File

@ -44,7 +44,7 @@ use crate::storage::{
/// ``` /// ```
/// ///
/// # TLS support /// # TLS support
/// Add the `redis-rs-tls-session` feature flag to enable TLS support. You can then establish a TLS /// Add the `redis-rs-tls-session` or `redis-rs-tls-session-rustls` feature flag to enable TLS support. You can then establish a TLS
/// connection to Redis using the `rediss://` URL scheme: /// connection to Redis using the `rediss://` URL scheme:
/// ///
/// ```no_run /// ```no_run