You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose to change some behaviour on the SessionMiddleware to allow developers to use an Opaque Token instead of a cookie to manage session identification for the Redis backend. This change opens the possibility to keep a stateful session when working with Actix as a Rest API for mobile app in example.
Current Behavior
The current SessionMiddleware only allow session management through cookies. While it works pretty well for web application, this is not suitable for other apps like mobile or desktop applications which doesn't necessarily support cookies as well as browsers.
Possible Solution
One possibility to improve this session middleware would be to ask developers if they prefer using cookies or an Opaque Token (in this case, the /login route will require to return the tokens to let the client store it somewhere)
Context
A way to implement this use-case on the developer-side would be like the following:
let redis_store = RedisSessionStore::new("redis://redis_url").await.unwrap();let provider = SessionProvider::opaque_token();// or for cookies (this would propably need a builder to make it pretty to uselet provider = Sessionprovider::cookie(Key::from(&[0;64])).cookie_path("/").cookie_http_only(true);let session_middleware = SessionMiddleware::builder(redis_store).provider(provider).session_lifecycle(PersistentSession::default().session_ttl(time::Duration::days(5))).build();
Rust Version: 1.72.0
Actix-session Version: 0.7.2
The text was updated successfully, but these errors were encountered:
Expected Behavior
I propose to change some behaviour on the
SessionMiddleware
to allow developers to use an Opaque Token instead of a cookie to manage session identification for the Redis backend. This change opens the possibility to keep a stateful session when working with Actix as a Rest API for mobile app in example.Current Behavior
The current
SessionMiddleware
only allow session management through cookies. While it works pretty well for web application, this is not suitable for other apps like mobile or desktop applications which doesn't necessarily support cookies as well as browsers.Possible Solution
One possibility to improve this session middleware would be to ask developers if they prefer using cookies or an Opaque Token (in this case, the /login route will require to return the tokens to let the client store it somewhere)
Context
A way to implement this use-case on the developer-side would be like the following:
The text was updated successfully, but these errors were encountered: