Enum actix_session::SessionStatus [−][src]
Enum actix_session::SessionStatus [−][src]
pub enum SessionStatus { Changed, Purged, Renewed, Unchanged, -}
+}Status of a Session
.
+
Variants
-Trait Implementations
impl Clone for SessionStatus
[src]
fn clone(&self) -> SessionStatus
[src]
Returns a copy of the value. Read more
+Session has been updated and requires a new persist operation.
+Session is flagged for deletion and should be removed from client and server.
+Most operations on the session after purge flag is set should have no effect.
+Session is flagged for refresh.
+For example, when using a backend that has a TTL (time-to-live) expiry on the session entry,
+the session will be refreshed even if no data inside it has changed. The client may also
+be notified of the refresh.
+Session is unchanged from when last seen (if exists).
+This state also captures new (previously unissued) sessions such as a user’s first
+site visit.
+Trait Implementations
impl Clone for SessionStatus
[src]
fn clone(&self) -> SessionStatus
[src]
Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
-impl Debug for SessionStatus
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Formats the value using the given formatter. Read more
-impl Default for SessionStatus
[src]
fn default() -> SessionStatus
[src]
Returns the “default value” for a type. Read more
-impl PartialEq<SessionStatus> for SessionStatus
[src]
fn eq(&self, other: &SessionStatus) -> bool
[src]
This method tests for self
and other
values to be equal, and is used
+
impl Debug for SessionStatus
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Formats the value using the given formatter. Read more
+impl Default for SessionStatus
[src]
fn default() -> SessionStatus
[src]
Returns the “default value” for a type. Read more
+impl PartialEq<SessionStatus> for SessionStatus
[src]
fn eq(&self, other: &SessionStatus) -> bool
[src]
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
-impl StructuralPartialEq for SessionStatus
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionStatus
impl Send for SessionStatus
impl Sync for SessionStatus
impl Unpin for SessionStatus
impl UnwindSafe for SessionStatus
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl StructuralPartialEq for SessionStatus
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionStatus
impl Send for SessionStatus
impl Sync for SessionStatus
impl Unpin for SessionStatus
impl UnwindSafe for SessionStatus
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]
Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]
Performs the conversion.
diff --git a/actix_session/index.html b/actix_session/index.html
index 54a637aa5..5e0d5f10c 100644
--- a/actix_session/index.html
+++ b/actix_session/index.html
@@ -1,7 +1,7 @@
actix_session - Rust
Crate actix_session[−][src]
Crate actix_session[−][src]
Sessions for Actix Web.
Provides a general solution for session management. Session middleware could provide different
implementations which could be accessed via general session API.
This crate provides a general solution for session management and includes a cookie backend.
@@ -18,9 +18,9 @@ modifying session data.
// access session data
if let Some(count) = session.get::<i32>("counter")? {
println!("SESSION value: {}", count);
- session.set("counter", count + 1)?;
+ session.insert("counter", count + 1)?;
} else {
- session.set("counter", 1)?;
+ session.insert("counter", 1)?;
}
Ok("Welcome!")
@@ -41,7 +41,8 @@ modifying session data.
CookieSession Use cookies for session storage.
Session The high-level interface you use to modify session data.
Enums
-SessionStatus
Traits
+SessionStatus Status of a Session
.
+
Traits
UserSession Extraction of a Session
object.
\ No newline at end of file
diff --git a/actix_session/sidebar-items.js b/actix_session/sidebar-items.js
index cf5fcad6e..9b592632f 100644
--- a/actix_session/sidebar-items.js
+++ b/actix_session/sidebar-items.js
@@ -1 +1 @@
-initSidebarItems({"enum":[["SessionStatus",""]],"struct":[["CookieSession","Use cookies for session storage."],["Session","The high-level interface you use to modify session data."]],"trait":[["UserSession","Extraction of a [`Session`] object."]]});
\ No newline at end of file
+initSidebarItems({"enum":[["SessionStatus","Status of a [`Session`]."]],"struct":[["CookieSession","Use cookies for session storage."],["Session","The high-level interface you use to modify session data."]],"trait":[["UserSession","Extraction of a [`Session`] object."]]});
\ No newline at end of file
diff --git a/actix_session/struct.CookieSession.html b/actix_session/struct.CookieSession.html
index 9052e3f22..f7daa52d4 100644
--- a/actix_session/struct.CookieSession.html
+++ b/actix_session/struct.CookieSession.html
@@ -1,7 +1,7 @@
actix_session::CookieSession - Rust
Struct actix_session::CookieSession [−][src]
pub struct CookieSession(_);
Struct actix_session::CookieSession [−][src]
pub struct CookieSession(_);
Use cookies for session storage.
CookieSession
creates sessions which are limited to storing
fewer than 4000 bytes of data (as the payload must fit into a single
cookie). An Internal Server Error is generated if the session contains more
@@ -32,31 +32,31 @@ cause troubles when reading cookie, if they are not properly percent encoded.
path("/")
.secure(true))
.service(web::resource("/").to(|| HttpResponse::Ok()));
-Implementations
impl CookieSession
[src]
pub fn signed(key: &[u8]) -> CookieSession
[src]
Construct new signed CookieSession
instance.
+Implementations
impl CookieSession
[src]
pub fn signed(key: &[u8]) -> CookieSession
[src]
Construct new signed CookieSession
instance.
Panics if key length is less than 32 bytes.
-pub fn private(key: &[u8]) -> CookieSession
[src]
Construct new private CookieSession
instance.
+pub fn private(key: &[u8]) -> CookieSession
[src]
Construct new private CookieSession
instance.
Panics if key length is less than 32 bytes.
-pub fn path<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the path
field in the session cookie being built.
-pub fn name<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the name
field in the session cookie being built.
-pub fn domain<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the domain
field in the session cookie being built.
-pub fn lazy(self, value: bool) -> CookieSession
[src]
When true, prevents adding session cookies to responses until
+
pub fn path<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the path
field in the session cookie being built.
+pub fn name<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the name
field in the session cookie being built.
+pub fn domain<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the domain
field in the session cookie being built.
+pub fn lazy(self, value: bool) -> CookieSession
[src]
When true, prevents adding session cookies to responses until
the session contains data. Default is false
.
Useful when trying to comply with laws that require consent for setting cookies.
-pub fn secure(self, value: bool) -> CookieSession
[src]
Sets the secure
field in the session cookie being built.
+pub fn secure(self, value: bool) -> CookieSession
[src]
Sets the secure
field in the session cookie being built.
If the secure
field is set, a cookie will only be transmitted when the
connection is secure - i.e. https
-pub fn http_only(self, value: bool) -> CookieSession
[src]
Sets the http_only
field in the session cookie being built.
-pub fn same_site(self, value: SameSite) -> CookieSession
[src]
Sets the same_site
field in the session cookie being built.
-pub fn max_age(self, seconds: i64) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
-pub fn max_age_time(self, value: Duration) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
-pub fn expires_in(self, seconds: i64) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
-pub fn expires_in_time(self, value: Duration) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
-Trait Implementations
impl<S, B: 'static> Transform<S, ServiceRequest> for CookieSession where
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
[src]
type Response = ServiceResponse<B>
Responses produced by the service.
+pub fn http_only(self, value: bool) -> CookieSession
[src]
Sets the http_only
field in the session cookie being built.
+pub fn same_site(self, value: SameSite) -> CookieSession
[src]
Sets the same_site
field in the session cookie being built.
+pub fn max_age(self, seconds: i64) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
+pub fn max_age_time(self, value: Duration) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
+pub fn expires_in(self, seconds: i64) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
+pub fn expires_in_time(self, value: Duration) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
+Trait Implementations
impl<S, B: 'static> Transform<S, ServiceRequest> for CookieSession where
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
[src]
type Response = ServiceResponse<B>
Responses produced by the service.
type Error = S::Error
Errors produced by the service.
type InitError = ()
Errors produced while building a transform service.
type Transform = CookieSessionMiddleware<S>
The TransformService
value created by this factory
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
-fn new_transform(&self, service: S) -> Self::Future
[src]
Creates and returns a new Transform component, asynchronously
+fn new_transform(&self, service: S) -> Self::Future
[src]
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl !RefUnwindSafe for CookieSession
impl !Send for CookieSession
impl !Sync for CookieSession
impl Unpin for CookieSession
impl UnwindSafe for CookieSession
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]
Mutably borrows from an owned value. Read more
diff --git a/actix_session/struct.Session.html b/actix_session/struct.Session.html
index 5def28dbe..94c0938a8 100644
--- a/actix_session/struct.Session.html
+++ b/actix_session/struct.Session.html
@@ -1,7 +1,7 @@
actix_session::Session - Rust
-Struct actix_session::Session [−][src]
pub struct Session(_);
The high-level interface you use to modify session data.
+Struct actix_session::Session [−][src]
pub struct Session(_);
The high-level interface you use to modify session data.
Session object is obtained with UserSession::get_session
. The UserSession
trait is
implemented for HttpRequest
, ServiceRequest
, and RequestHead
.
@@ -12,20 +12,28 @@ implemented for HttpRequest
, ServiceRequest
, and async fn index(session: Session) -> Result<&'static str> {
// access session data
if let Some(count) = session.get::<i32>("counter")? {
- session.set("counter", count + 1)?;
+ session.insert("counter", count + 1)?;
} else {
- session.set("counter", 1)?;
+ session.insert("counter", 1)?;
}
Ok("Welcome!")
}
-Implementations
impl Session
[src]
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<Option<T>, Error>
[src]
Get a value
from the session.
-pub fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error>
[src]
Set a value
from the session.
-pub fn remove(&self, key: &str)
[src]
Remove value from the session.
-pub fn clear(&self)
[src]
Clear the session.
-pub fn purge(&self)
[src]
Removes session, both client and server side.
-pub fn renew(&self)
[src]
Renews the session key, assigning existing session state to new key.
-pub fn set_session(
data: impl IntoIterator<Item = (String, String)>,
req: &mut ServiceRequest
)
[src]
Adds the given key-value pairs to the session on the request.
+Implementations
impl Session
[src]
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<Option<T>, Error>
[src]
Get a value
from the session.
+pub fn entries(&self) -> Ref<'_, HashMap<String, String>>
[src]
Get all raw key-value data from the session.
+Note that values are JSON encoded.
+pub fn insert(
&self,
key: impl Into<String>,
value: impl Serialize
) -> Result<(), Error>
[src]
Inserts a key-value pair into the session.
+Any serializable value can be used and will be encoded as JSON in session data, hence why
+only a reference to the value is taken.
+pub fn remove(&self, key: &str) -> Option<String>
[src]
Remove value from the session.
+If present, the JSON encoded value is returned.
+pub fn remove_as<T: DeserializeOwned>(
&self,
key: &str
) -> Option<Result<T, String>>
[src]
Remove value from the session and deserialize.
+Returns None if key was not present in session. Returns T if deserialization succeeds,
+otherwise returns un-deserialized JSON string.
+pub fn clear(&self)
[src]
Clear the session.
+pub fn purge(&self)
[src]
Removes session both client and server side.
+pub fn renew(&self)
[src]
Renews the session key, assigning existing session state to new key.
+pub fn set_session(
req: &mut ServiceRequest,
data: impl IntoIterator<Item = (String, String)>
)
[src]
Adds the given key-value pairs to the session on the request.
Values that match keys already existing on the session will be overwritten. Values should
already be JSON serialized.
Examples
@@ -33,28 +41,31 @@ already be JSON serialized.
let mut req = test::TestRequest::default().to_srv_request();
Session::set_session(
- vec![("counter".to_string(), serde_json::to_string(&0).unwrap())],
&mut req,
+ vec![("counter".to_string(), serde_json::to_string(&0).unwrap())],
);
-pub fn get_changes<B>(
res: &mut ServiceResponse<B>
) -> (SessionStatus, Option<impl Iterator<Item = (String, String)>>)
[src]
Trait Implementations
impl FromRequest for Session
[src]
Extractor implementation for Session type.
-
+pub fn get_changes<B>(
res: &mut ServiceResponse<B>
) -> (SessionStatus, impl Iterator<Item = (String, String)>)
[src]
Returns session status and iterator of key-value pairs of changes.
+Trait Implementations
impl FromRequest for Session
[src]
Extractor implementation for Session type.
+Examples
use actix_session::Session;
-fn index(session: Session) -> Result<&'static str> {
+#[get("/")]
+async fn index(session: Session) -> Result<impl Responder> {
// access session data
if let Some(count) = session.get::<i32>("counter")? {
- session.set("counter", count + 1)?;
+ session.insert("counter", count + 1)?;
} else {
- session.set("counter", 1)?;
+ session.insert("counter", 1)?;
}
- Ok("Welcome!")
+ let count = session.get::<i32>("counter")?.unwrap();
+ Ok(format!("Counter: {}", count))
}
type Error = Error
The associated error which can be returned.
type Future = Ready<Result<Session, Error>>
Future that resolves to a Self.
type Config = ()
Configuration for this extractor.
-fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]
Create a Self from request parts asynchronously.
+fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]
Create a Self from request parts asynchronously.
pub fn extract(req: &HttpRequest) -> Self::Future
Create a Self from request head asynchronously. Read more
pub fn configure<F>(f: F) -> Self::Config where
F: FnOnce(Self::Config) -> Self::Config,
Create and configure config instance.
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl !Send for Session
impl !Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
pub fn type_id(&self) -> TypeId
[src]
Gets the TypeId
of self
. Read more
diff --git a/actix_session/trait.UserSession.html b/actix_session/trait.UserSession.html
index 1083ce406..585700750 100644
--- a/actix_session/trait.UserSession.html
+++ b/actix_session/trait.UserSession.html
@@ -1,8 +1,9 @@
actix_session::UserSession - Rust
Trait actix_session::UserSession [−][src]
Trait actix_session::UserSession [−][src]
pub trait UserSession {
fn get_session(&self) -> Session;
}
Extraction of a Session
object.
-Required methods
fn get_session(&self) -> Session
[src]
Loading content...Implementations on Foreign Types
impl UserSession for HttpRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for ServiceRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for RequestHead
[src]
fn get_session(&self) -> Session
[src]
Loading content...Implementors
Loading content...
+Required methods
fn get_session(&self) -> Session
[src]
Extract the Session
object
+Loading content...Implementations on Foreign Types
impl UserSession for HttpRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for ServiceRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for RequestHead
[src]
fn get_session(&self) -> Session
[src]
Loading content...Implementors
Loading content...
\ No newline at end of file
diff --git a/search-index.js b/search-index.js
index 0d3541d80..46c01c075 100644
--- a/search-index.js
+++ b/search-index.js
@@ -3,7 +3,7 @@ var searchIndex = JSON.parse('{\
"actix_identity":{"doc":"Opinionated request identity service for Actix Web apps.","t":[3,3,3,8,16,16,10,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieIdentityPolicy","Identity","IdentityService","IdentityPolicy","Future","ResponseFuture","from_request","to_response","RequestIdentity","get_identity","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from_request","to_response","clone","new_transform","from_request","new","name","path","domain","secure","max_age","max_age_secs","http_only","same_site","visit_deadline","login_deadline","identity","remember","forget","new"],"q":["actix_identity","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for request identity storage.","The extractor type to obtain your identity from a request.","Request identity middleware","Identity policy.","The return type of the middleware","The return type of the middleware","Parse the session from request and load data from a …","Write changes to response","Helper trait that allows to get Identity.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create new CookieIdentityPolicy
instance.","Sets the name of issued cookies.","Sets the Path
attribute of issued cookies.","Sets the Domain
attribute of issued cookies.","Sets the Secure
attribute of issued cookies.","Sets the Max-Age
attribute of issued cookies.","Sets the Max-Age
attribute of issued cookies with given …","Sets the HttpOnly
attribute of issued cookies.","Sets the SameSite
attribute of issued cookies.","Accepts only users who have visited within given deadline.","Accepts only users who authenticated within the given …","Return the claimed identity of the user associated …","Remember identity.","This method is used to ‘forget’ the current identity …","Create new identity service with specified backend."],"i":[0,0,0,0,1,1,1,1,0,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,3,3,4,5,4,3,3,3,3,3,3,3,3,3,3,3,4,4,4,5],"f":[null,null,null,null,null,null,[[["servicerequest",3]]],[[["serviceresponse",3],["bool",15],["option",4],["string",3]]],null,[[],[["option",4],["string",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3],["bool",15],["option",4],["string",3]]],[[],["identity",3]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[["bool",15]],["cookieidentitypolicy",3]],[[["duration",3]],["cookieidentitypolicy",3]],[[["i64",15]],["cookieidentitypolicy",3]],[[["bool",15]]],[[["samesite",4]]],[[["duration",3]],["cookieidentitypolicy",3]],[[["duration",3]],["cookieidentitypolicy",3]],[[],[["option",4],["string",3]]],[[["string",3]]],[[]],[[]]],"p":[[8,"IdentityPolicy"],[8,"RequestIdentity"],[3,"CookieIdentityPolicy"],[3,"Identity"],[3,"IdentityService"]]},\
"actix_protobuf":{"doc":"","t":[4,13,13,13,13,13,3,12,3,11,3,11,11,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["ProtoBufPayloadError","Overflow","ContentType","Serialize","Deserialize","Payload","ProtoBuf","0","ProtoBufConfig","limit","ProtoBufMessage","new","limit","ProtoBufResponseBuilder","protobuf","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","into_future","try_poll","vzip","from","from","default","deref","deref_mut","fmt","fmt","fmt","fmt","poll","from_request","error_response","respond_to"],"q":["actix_protobuf","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","Payload size is bigger than 256k","Content type error","Serialize error","Deserialize error","Payload error","","","","Change max size of payload. By default max size is 256Kb","","Create ProtoBufMessage
for request.","Change max size of payload. By default max size is 256Kb","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,1,1,1,0,2,0,3,0,4,4,0,5,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,1,1,3,2,2,1,2,1,2,4,2,1,2],"f":[null,null,null,null,null,null,null,null,null,[[["usize",15]]],null,[[["httprequest",3],["payload",4]]],[[["usize",15]]],null,[[["message",8]],[["result",4],["httpresponse",3],["error",3]]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[["context",3],["pin",3]],["poll",4]],[[]],[[["payloaderror",4]],["protobufpayloaderror",4]],[[["protobufdecodeerror",3]],["protobufpayloaderror",4]],[[]],[[]],[[]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["pin",3],["context",3]],["poll",4]],[[["httprequest",3],["payload",4]]],[[],["httpresponse",3]],[[["httprequest",3]],["httpresponse",3]]],"p":[[4,"ProtoBufPayloadError"],[3,"ProtoBuf"],[3,"ProtoBufConfig"],[3,"ProtoBufMessage"],[8,"ProtoBufResponseBuilder"]]},\
"actix_redis":{"doc":"Redis integration for Actix and session store for Actix …","t":[3,12,3,4,13,13,13,3,4,13,13,13,4,13,13,13,13,13,13,4,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["Command","0","RedisActor","SameSite","Strict","Lax","None","RedisSession","Error","Redis","NotConnected","Disconnected","RespError","Internal","IO","RESP","Remote","Connection","Unexpected","RespValue","Nil","Array","BulkString","Error","Integer","SimpleString","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","equivalent","get_hash","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","equivalent","from_resp_int","clone","fmt","fmt","from","from","from","from","from","from","from","from","from","source","eq","ne","fmt","clone","hash","fmt","eq","fmt","from","fmt","fmt","fmt","source","started","restarting","handle","handle","error","new_transform","start","new","ttl","cookie_name","cookie_path","cookie_domain","cookie_secure","cookie_max_age","cookie_same_site","cookie_http_only","cache_keygen","is_strict","is_lax","is_none","append","push"],"q":["actix_redis","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Command for send data to Redis","","Redis communication actor","The SameSite
cookie attribute.","The “Strict” SameSite
attribute.","The “Lax” SameSite
attribute.","The “None” SameSite
attribute.","Use redis as session storage.","General purpose actix redis error","","Receiving message during reconnecting","Cancel all waters when connection get dropped","","A non-specific internal error that prevented an operation …","An IO error occurred","A RESP parsing/serialising error occurred","A remote error","Error creating a connection, or an error with a …","An unexpected error. In this context “unexpected” …","A single RESP value, this owns the data that is …","","Zero, one or more other RespValue
s.","A bulk string. In Redis terminology a string is a …","An error from the Redis server","Redis documentation defines an integer as being a signed …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Start new Supervisor
with RedisActor
.","Create new redis session backend","Set time to live in seconds for session value.","Set custom cookie name for session ID.","Set custom cookie path.","Set custom cookie domain.","Set custom cookie secure.","Set custom cookie max-age.","Set custom cookie SameSite
attribute.","Set custom cookie HttpOnly
policy.","Set a custom cache key generation strategy, expecting …","Returns true
if self
is SameSite::Strict
and false
…","Returns true
if self
is SameSite::Lax
and false
otherwise.","Returns true
if self
is SameSite::None
and false
…","Convenience function for building dynamic Redis commands …","Push item to Resp array"],"i":[0,1,0,0,2,2,2,0,0,3,3,3,0,4,4,4,4,4,4,0,5,5,5,5,5,5,1,1,1,1,1,1,1,1,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,4,5,5,4,5,5,5,4,5,5,4,2,2,2,2,2,3,1,3,3,3,6,6,6,6,6,7,6,7,7,7,7,7,7,7,7,7,7,2,2,2,5,5],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["bool",15]],[[["respvalue",4]],[["error",4],["respvalue",4],["result",4]]],[[],["respvalue",4]],[[["formatter",3]],[["result",4],["error",3]]],[[["formatter",3]],[["result",4],["error",3]]],[[["string",3]],["respvalue",4]],[[["string",3]],["respvalue",4]],[[["trysenderror",3]],["error",4]],[[["vec",3],["u8",15],["global",3]],["respvalue",4]],[[["str",15]],["respvalue",4]],[[["error",3]],["error",4]],[[["arc",3],["str",15]],["respvalue",4]],[[],["respvalue",4]],[[["usize",15]],["respvalue",4]],[[],[["option",4],["error",8]]],[[["respvalue",4]],["bool",15]],[[["respvalue",4]],["bool",15]],[[["formatter",3]],[["result",4],["error",3]]],[[],["samesite",4]],[[]],[[["formatter",3]],[["result",4],["error",3]]],[[["samesite",4]],["bool",15]],[[["formatter",3]],[["result",4],["error",3]]],[[["error",4]],["error",4]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],[["option",4],["error",8]]],[[["context",3]]],[[]],[[["command",3]]],[[["respvalue",4],["result",4],["resperror",4]]],[[["error",3]],["running",4]],[[]],[[["into",8],["string",3]],[["addr",3],["redisactor",3]]],[[["into",8],["string",3]],["redissession",3]],[[["u32",15]]],[[["str",15]]],[[["str",15]]],[[["str",15]]],[[["bool",15]]],[[]],[[["samesite",4]]],[[["bool",15]]],[[["box",3],["fn",8]]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["respvalue",4]],[[]]],"p":[[3,"Command"],[4,"SameSite"],[4,"Error"],[4,"RespError"],[4,"RespValue"],[3,"RedisActor"],[3,"RedisSession"]]},\
-"actix_session":{"doc":"Sessions for Actix Web.","t":[3,3,8,10,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieSession","Session","UserSession","get_session","SessionStatus","Changed","Purged","Renewed","Unchanged","get","set","remove","clear","purge","renew","set_session","get_changes","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","fmt","new_transform","from_request","signed","private","path","name","domain","lazy","secure","http_only","same_site","max_age","max_age_time","expires_in","expires_in_time"],"q":["actix_session","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for session storage.","The high-level interface you use to modify session data.","Extraction of a [Session
] object.","","","","","","","Get a value
from the session.","Set a value
from the session.","Remove value from the session.","Clear the session.","Removes session, both client and server side.","Renews the session key, assigning existing session state …","Adds the given key-value pairs to the session on the …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Construct new signed CookieSession
instance.","Construct new private CookieSession
instance.","Sets the path
field in the session cookie being built.","Sets the name
field in the session cookie being built.","Sets the domain
field in the session cookie being built.","When true, prevents adding session cookies to responses …","Sets the secure
field in the session cookie being built.","Sets the http_only
field in the session cookie being …","Sets the same_site
field in the session cookie being …","Sets the max-age
field in the session cookie being built.","Sets the max-age
field in the session cookie being built.","Sets the expires
field in the session cookie being built.","Sets the expires
field in the session cookie being built."],"i":[0,0,0,1,0,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4],"f":[null,null,null,[[],["session",3]],null,null,null,null,null,[[["str",15]],[["result",4],["option",4],["error",3]]],[[["serialize",8],["str",15]],[["error",3],["result",4]]],[[["str",15]]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["sessionstatus",4]],[[],["sessionstatus",4]],[[["sessionstatus",4]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookiesession",3]],[[],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["samesite",4]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]]],"p":[[8,"UserSession"],[4,"SessionStatus"],[3,"Session"],[3,"CookieSession"]]},\
+"actix_session":{"doc":"Sessions for Actix Web.","t":[3,3,8,10,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieSession","Session","UserSession","get_session","SessionStatus","Changed","Purged","Renewed","Unchanged","get","entries","insert","remove","remove_as","clear","purge","renew","set_session","get_changes","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","fmt","new_transform","from_request","signed","private","path","name","domain","lazy","secure","http_only","same_site","max_age","max_age_time","expires_in","expires_in_time"],"q":["actix_session","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for session storage.","The high-level interface you use to modify session data.","Extraction of a [Session
] object.","Extract the [Session
] object","Status of a [Session
].","Session has been updated and requires a new persist …","Session is flagged for deletion and should be removed …","Session is flagged for refresh.","Session is unchanged from when last seen (if exists).","Get a value
from the session.","Get all raw key-value data from the session.","Inserts a key-value pair into the session.","Remove value from the session.","Remove value from the session and deserialize.","Clear the session.","Removes session both client and server side.","Renews the session key, assigning existing session state …","Adds the given key-value pairs to the session on the …","Returns session status and iterator of key-value pairs of …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Construct new signed CookieSession
instance.","Construct new private CookieSession
instance.","Sets the path
field in the session cookie being built.","Sets the name
field in the session cookie being built.","Sets the domain
field in the session cookie being built.","When true, prevents adding session cookies to responses …","Sets the secure
field in the session cookie being built.","Sets the http_only
field in the session cookie being …","Sets the same_site
field in the session cookie being …","Sets the max-age
field in the session cookie being built.","Sets the max-age
field in the session cookie being built.","Sets the expires
field in the session cookie being built.","Sets the expires
field in the session cookie being built."],"i":[0,0,0,1,0,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4],"f":[null,null,null,[[],["session",3]],null,null,null,null,null,[[["str",15]],[["result",4],["option",4],["error",3]]],[[],[["hashmap",3],["ref",3]]],[[],[["error",3],["result",4]]],[[["str",15]],[["option",4],["string",3]]],[[["str",15]],[["result",4],["option",4]]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["sessionstatus",4]],[[],["sessionstatus",4]],[[["sessionstatus",4]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookiesession",3]],[[],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["samesite",4]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]]],"p":[[8,"UserSession"],[4,"SessionStatus"],[3,"Session"],[3,"CookieSession"]]},\
"actix_web_httpauth":{"doc":"HTTP authentication schemes for actix-web.","t":[0,0,3,11,3,11,11,0,4,13,13,13,3,11,11,3,11,8,16,10,3,8,16,16,10,0,0,4,13,13,13,13,13,13,3,3,3,8,10,0,11,0,3,0,3,3,4,13,13,13,8,10,3,12,0,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["extractors","basic","Config","realm","BasicAuth","user_id","password","bearer","Error","InvalidRequest","InvalidToken","InsufficientScope","Config","scope","realm","BearerAuth","token","AuthExtractorConfig","Inner","into_inner","AuthenticationError","AuthExtractor","Error","Future","from_service_request","headers","authorization","ParseError","Invalid","MissingScheme","MissingField","ToStrError","Base64DecodeError","Utf8Error","Authorization","Basic","Bearer","Scheme","parse","www_authenticate","status_code","basic","Basic","bearer","BearerBuilder","Bearer","Error","InvalidRequest","InvalidToken","InsufficientScope","Challenge","to_bytes","WwwAuthenticate","0","middleware","HttpAuthentication","with_fn","basic","bearer","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","try_into_header_pair","equivalent","get_hash","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","try_into_header_pair","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","into_inner","into_inner","from_service_request","from_service_request","parse","parse","as_mut","as_ref","as_ref","as_ref","from","from","from","from","from","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","default","default","default","default","default","default","default","cmp","cmp","cmp","cmp","cmp","cmp","cmp","eq","ne","eq","ne","eq","ne","eq","ne","eq","ne","eq","eq","ne","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","hash","hash","hash","hash","hash","source","new_transform","from_request","from_request","error_response","status_code","try_into_value","try_into_value","try_into_value","try_into_value","try_into_value","try_into_value","name","parse","name","parse","with_error","with_error_description","with_error_uri","new","challenge_mut","status_code_mut","into_scheme","new","user_id","password","new","token","new","with_realm","scope","realm","error","error_description","error_uri","finish","build"],"q":["actix_web_httpauth","actix_web_httpauth::extractors","actix_web_httpauth::extractors::basic","","","","","actix_web_httpauth::extractors","actix_web_httpauth::extractors::bearer","","","","","","","","","actix_web_httpauth::extractors","","","","","","","","actix_web_httpauth","actix_web_httpauth::headers","actix_web_httpauth::headers::authorization","","","","","","","","","","","","actix_web_httpauth::headers","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::www_authenticate::bearer","","","","","","actix_web_httpauth::headers::www_authenticate","","","","actix_web_httpauth","actix_web_httpauth::middleware","","","","actix_web_httpauth::extractors::basic","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::extractors::bearer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::extractors","","","","","","","","","actix_web_httpauth::headers::authorization","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate::bearer","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate","","","","","","","","","","","","","actix_web_httpauth::middleware","","","","","","","","","","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::extractors::basic","","actix_web_httpauth::extractors::bearer","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::middleware","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::extractors::basic","","actix_web_httpauth::extractors::bearer","","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::middleware","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","actix_web_httpauth::middleware","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::extractors","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","actix_web_httpauth::headers::www_authenticate","","actix_web_httpauth::extractors","","","","","","actix_web_httpauth::headers::authorization","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","actix_web_httpauth::headers::www_authenticate::bearer","","","","","",""],"d":["Type-safe authentication information extractors","Extractor for the “Basic” HTTP Authentication Scheme","BasicAuth
extractor configuration, used for …","Set challenge realm
attribute.","Extractor for HTTP Basic auth.","Returns client’s user-ID.","Returns client’s password.","Extractor for the “Bearer” HTTP Authentication Scheme","Bearer authorization error types, described in RFC 6750","The request is missing a required parameter, includes an …","The access token provided is expired, revoked, malformed, …","The request requires higher privileges than provided by …","BearerAuth extractor configuration.","Set challenge scope
attribute.","Set challenge realm
attribute.","Extractor for HTTP Bearer auth","Returns bearer token provided by client.","Trait implemented for types that provides configuration …","Associated challenge type.","Convert the config instance into a HTTP challenge.","Authentication error returned by authentication …","Trait implemented by types that can extract HTTP …","The associated error which can be returned.","Future that resolves into extracted credentials type.","Parse the authentication credentials from the actix’ …","Typed HTTP headers","Authorization
header and various auth schemes","Possible errors while parsing Authorization
header.","Header value is malformed","Authentication scheme is missing","Required authentication field is missing","Unable to convert header into the str","Malformed base64 string","Malformed UTF-8 string","Authorization
header, defined in RFC 7235","Credentials for Basic
authentication scheme, defined in …","Credentials for Bearer
authentication scheme, defined in …","Authentication scheme for Authorization
header.","Try to parse the authentication scheme from the …","WWW-Authenticate
header and various auth challenges","Returns HTTP status code suitable for current error type.","Challenge for the “Basic” HTTP Authentication Scheme","Challenge for WWW-Authenticate
header with HTTP Basic …","Challenge for the “Bearer” HTTP Authentication Scheme","Builder for the Bearer
challenge.","Challenge for WWW-Authenticate
header with HTTP Bearer …","Bearer authorization error types, described in RFC 6750","The request is missing a required parameter, includes an …","The access token provided is expired, revoked, malformed, …","The request requires higher privileges than provided by …","Authentication challenge for WWW-Authenticate
header.","Converts the challenge into a bytes suitable for HTTP …","WWW-Authenticate
header, described in RFC 7235","","HTTP Authentication middleware.","Middleware for checking HTTP authentication.","Construct HttpAuthentication
middleware with the provided …","Construct HttpAuthentication
middleware for the HTTP “…","Construct HttpAuthentication
middleware for the HTTP “…","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Attach Error
to the current Authentication error.","Attach error description to the current Authentication …","Attach error URI to the current Authentication error.","Creates new authentication error from the provided …","Returns mutable reference to the inner challenge instance.","Returns mutable reference to the inner status code.","Consumes Authorization
header and returns inner Scheme
…","Creates Basic
credentials with provided user_id
and …","Returns client’s user-ID.","Returns client’s password if provided.","Creates new Bearer
credentials with the token provided.","Gets reference to the credentials token.","Creates new Basic
challenge with an empty realm
field.","Creates new Basic
challenge from the provided realm
field …","Provides the scope
attribute, as defined in RFC6749, …","Provides the realm
attribute, as defined in RFC2617","Provides the error
attribute, as defined in RFC6750, …","Provides the error_description
attribute, as defined in …","Provides the error_uri
attribute, as defined in RFC6750, …","Consumes the builder and returns built Bearer
instance.","Creates the builder for Bearer
challenge."],"i":[0,0,0,1,0,2,2,0,0,3,3,3,0,4,4,0,5,0,6,6,0,0,7,7,7,0,0,0,8,8,8,8,8,8,0,0,0,0,9,0,3,0,0,0,0,0,0,3,3,3,0,10,0,11,0,0,12,12,12,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,13,13,13,13,13,13,13,13,13,8,8,8,8,8,8,8,8,8,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,1,4,2,5,15,16,14,1,4,14,13,8,8,8,14,1,2,4,5,14,15,16,17,19,3,11,12,1,4,14,17,18,19,11,14,15,16,17,19,3,11,14,14,15,15,16,16,17,17,19,19,3,11,11,14,15,16,17,19,3,11,1,2,4,5,13,8,14,15,16,17,18,19,3,11,12,13,8,14,15,16,17,19,3,14,17,19,3,11,8,12,2,5,13,13,14,15,16,17,19,11,14,14,11,11,13,13,13,13,13,13,14,15,15,15,16,16,17,17,18,18,18,18,18,18,19],"f":[null,null,null,[[],["config",3]],null,[[],["cow",4]],[[],[["option",4],["cow",4]]],null,null,null,null,null,null,[[["cow",4],["into",8]],["config",3]],[[["cow",4],["into",8]],["config",3]],null,[[],["str",15]],null,null,[[]],null,null,null,null,[[["servicerequest",3]]],null,null,null,null,null,null,null,null,null,null,null,null,null,[[["headervalue",3]],[["result",4],["parseerror",4]]],null,[[],["statuscode",3]],null,null,null,null,null,null,null,null,null,null,[[],["bytes",3]],null,null,null,null,[[],["httpauthentication",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["result",4]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["result",4]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["servicerequest",3]]],[[["headervalue",3]],[["result",4],["parseerror",4]]],[[["headervalue",3]],[["result",4],["parseerror",4]]],[[]],[[],["challenge",3]],[[],["bearer",3]],[[]],[[]],[[["tostrerror",3]]],[[["decodeerror",4]]],[[["utf8error",3]]],[[],["authorization",3]],[[],["config",3]],[[],["basicauth",3]],[[],["config",3]],[[],["bearerauth",3]],[[],["authorization",3]],[[],["basic",3]],[[],["bearer",3]],[[],["basic",3]],[[],["bearer",3]],[[],["error",4]],[[],["wwwauthenticate",3]],[[],["httpauthentication",3]],[[],["config",3]],[[],["config",3]],[[],["authorization",3]],[[],["basic",3]],[[],["bearerbuilder",3]],[[],["bearer",3]],[[],["wwwauthenticate",3]],[[["authorization",3]],["ordering",4]],[[["basic",3]],["ordering",4]],[[["bearer",3]],["ordering",4]],[[["basic",3]],["ordering",4]],[[["bearer",3]],["ordering",4]],[[["error",4]],["ordering",4]],[[["wwwauthenticate",3]],["ordering",4]],[[["authorization",3]],["bool",15]],[[["authorization",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["error",4]],["bool",15]],[[["wwwauthenticate",3]],["bool",15]],[[["wwwauthenticate",3]],["bool",15]],[[["authorization",3]],[["option",4],["ordering",4]]],[[["basic",3]],[["option",4],["ordering",4]]],[[["bearer",3]],[["option",4],["ordering",4]]],[[["basic",3]],[["option",4],["ordering",4]]],[[["bearer",3]],[["option",4],["ordering",4]]],[[["error",4]],[["option",4],["ordering",4]]],[[["wwwauthenticate",3]],[["option",4],["ordering",4]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],[["error",3],["result",4]]],[[["formatter",3]],[["error",3],["result",4]]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[],[["option",4],["error",8]]],[[]],[[["httprequest",3],["payload",4]]],[[["httprequest",3],["payload",4]]],[[],["httpresponse",3]],[[],["statuscode",3]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],["headername",3]],[[],[["parseerror",4],["result",4]]],[[],["headername",3]],[[],[["parseerror",4],["result",4]]],[[["error",4]]],[[]],[[]],[[],["authenticationerror",3]],[[]],[[],["statuscode",3]],[[]],[[["option",4]],["basic",3]],[[],["cow",4]],[[],[["option",4],["cow",4]]],[[],["bearer",3]],[[],["cow",4]],[[],["basic",3]],[[],["basic",3]],[[]],[[]],[[["error",4]]],[[]],[[]],[[],["bearer",3]],[[],["bearerbuilder",3]]],"p":[[3,"Config"],[3,"BasicAuth"],[4,"Error"],[3,"Config"],[3,"BearerAuth"],[8,"AuthExtractorConfig"],[8,"AuthExtractor"],[4,"ParseError"],[8,"Scheme"],[8,"Challenge"],[3,"WwwAuthenticate"],[3,"HttpAuthentication"],[3,"AuthenticationError"],[3,"Authorization"],[3,"Basic"],[3,"Bearer"],[3,"Basic"],[3,"BearerBuilder"],[3,"Bearer"]]},\
"prost_example":{"doc":"","t":[3,12,12,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["MyObj","number","name","index","main","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","ne","fmt","encode_raw","merge_field","encoded_len","clear"],"q":["prost_example","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"f":[null,null,null,[[["protobuf",3],["myobj",3]]],[[],["result",6]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["myobj",3]],[[]],[[["myobj",3]],["bool",15]],[[["myobj",3]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["u32",15],["wiretype",4],["decodecontext",3]],[["decodeerror",3],["result",4]]],[[],["usize",15]],[[]]],"p":[[3,"MyObj"]]}\
}');
diff --git a/src/actix_redis/session.rs.html b/src/actix_redis/session.rs.html
index 5a2baab47..05f308cda 100644
--- a/src/actix_redis/session.rs.html
+++ b/src/actix_redis/session.rs.html
@@ -867,8 +867,9 @@
Box::pin(async move {
let state = inner.load(&req).await?;
+
let value = if let Some((state, value)) = state {
- Session::set_session(state, &mut req);
+ Session::set_session(&mut req, state);
Some(value)
} else {
None
@@ -877,8 +878,7 @@
let mut res = srv.call(req).await?;
match Session::get_changes(&mut res) {
- (SessionStatus::Unchanged, None) => Ok(res),
- (SessionStatus::Unchanged, Some(state)) => {
+ (SessionStatus::Unchanged, state) => {
if value.is_none() {
// implies the session is new
inner.update(res, state, value).await
@@ -886,10 +886,10 @@
Ok(res)
}
}
- (SessionStatus::Changed, Some(state)) => {
- inner.update(res, state, value).await
- }
- (SessionStatus::Purged, Some(_)) => {
+
+ (SessionStatus::Changed, state) => inner.update(res, state, value).await,
+
+ (SessionStatus::Purged, _) => {
if let Some(val) = value {
inner.clear_cache(val).await?;
match inner.remove_cookie(&mut res) {
@@ -900,7 +900,8 @@
Err(error::ErrorInternalServerError("unexpected"))
}
}
- (SessionStatus::Renewed, Some(state)) => {
+
+ (SessionStatus::Renewed, state) => {
if let Some(val) = value {
inner.clear_cache(val).await?;
inner.update(res, state, None).await
@@ -908,7 +909,6 @@
inner.update(res, state, None).await
}
}
- (_, None) => unreachable!(),
}
})
}
@@ -1053,7 +1053,7 @@
Ok(res)
}
- /// removes cache entry
+ /// Removes cache entry.
async fn clear_cache(&self, key: String) -> Result<(), Error> {
let cache_key = (self.cache_keygen)(&key);
@@ -1072,7 +1072,7 @@
}
}
- /// invalidates session cookie
+ /// Invalidates session cookie.
fn remove_cookie<B>(&self, res: &mut ServiceResponse<B>) -> Result<(), Error> {
let mut cookie = Cookie::named(self.name.clone());
cookie.set_value("");
@@ -1121,7 +1121,7 @@
.get::<i32>("counter")
.unwrap_or(Some(0))
.map_or(1, |inner| inner + 1);
- session.set("counter", counter)?;
+ session.insert("counter", &counter)?;
Ok(HttpResponse::Ok().json(&IndexResponse { user_id, counter }))
}
@@ -1136,7 +1136,7 @@
session: Session,
) -> Result<HttpResponse> {
let id = user_id.into_inner().user_id;
- session.set("user_id", &id)?;
+ session.insert("user_id", &id)?;
session.renew();
let counter: i32 = session
diff --git a/src/actix_session/cookie.rs.html b/src/actix_session/cookie.rs.html
index ad71e5076..498bff896 100644
--- a/src/actix_session/cookie.rs.html
+++ b/src/actix_session/cookie.rs.html
@@ -551,6 +551,8 @@
548
549
550
+551
+552
//! Cookie based sessions. See docs for [`CookieSession`].
@@ -562,7 +564,7 @@
use actix_web::http::{header::SET_COOKIE, HeaderValue};
use actix_web::{Error, HttpMessage, ResponseError};
use derive_more::Display;
-use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready};
+use futures_util::future::{ok, LocalBoxFuture, Ready};
use serde_json::error::Error as JsonError;
use time::{Duration, OffsetDateTime};
@@ -631,6 +633,7 @@
let value =
serde_json::to_string(&state).map_err(CookieSessionError::Serialize)?;
+
if value.len() > 4064 {
return Err(CookieSessionError::Overflow.into());
}
@@ -698,6 +701,7 @@
jar.private(&self.key).get(&self.name)
}
};
+
if let Some(cookie) = cookie_opt {
if let Ok(val) = serde_json::from_str(cookie.value()) {
return (false, val);
@@ -706,6 +710,7 @@
}
}
}
+
(true, HashMap::new())
}
}
@@ -863,7 +868,7 @@
}
}
-/// Cookie session middleware
+/// Cookie based session middleware.
pub struct CookieSessionMiddleware<S> {
service: S,
inner: Rc<CookieSessionInner>,
@@ -890,41 +895,40 @@
let inner = self.inner.clone();
let (is_new, state) = self.inner.load(&req);
let prolong_expiration = self.inner.expires_in.is_some();
- Session::set_session(state, &mut req);
+ Session::set_session(&mut req, state);
let fut = self.service.call(req);
- async move {
- fut.await.map(|mut res| {
- match Session::get_changes(&mut res) {
- (SessionStatus::Changed, Some(state))
- | (SessionStatus::Renewed, Some(state)) => {
- res.checked_expr(|res| inner.set_cookie(res, state))
- }
- (SessionStatus::Unchanged, Some(state)) if prolong_expiration => {
- res.checked_expr(|res| inner.set_cookie(res, state))
- }
- (SessionStatus::Unchanged, _) =>
- // set a new session cookie upon first request (new client)
- {
- if is_new {
- let state: HashMap<String, String> = HashMap::new();
- res.checked_expr(|res| {
- inner.set_cookie(res, state.into_iter())
- })
- } else {
- res
- }
- }
- (SessionStatus::Purged, _) => {
- let _ = inner.remove_cookie(&mut res);
+ Box::pin(async move {
+ let mut res = fut.await?;
+
+ let res = match Session::get_changes(&mut res) {
+ (SessionStatus::Changed, state) | (SessionStatus::Renewed, state) => {
+ res.checked_expr(|res| inner.set_cookie(res, state))
+ }
+
+ (SessionStatus::Unchanged, state) if prolong_expiration => {
+ res.checked_expr(|res| inner.set_cookie(res, state))
+ }
+
+ // set a new session cookie upon first request (new client)
+ (SessionStatus::Unchanged, _) => {
+ if is_new {
+ let state: HashMap<String, String> = HashMap::new();
+ res.checked_expr(|res| inner.set_cookie(res, state.into_iter()))
+ } else {
res
}
- _ => res,
}
- })
- }
- .boxed_local()
+
+ (SessionStatus::Purged, _) => {
+ let _ = inner.remove_cookie(&mut res);
+ res
+ }
+ };
+
+ Ok(res)
+ })
}
}
@@ -940,7 +944,7 @@
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"test"
})),
)
@@ -960,7 +964,7 @@
App::new()
.wrap(CookieSession::private(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"test"
})),
)
@@ -980,7 +984,7 @@
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false).lazy(true))
.service(web::resource("/count").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"counting"
}))
.service(web::resource("/").to(|_ses: Session| async move { "test" })),
@@ -1006,7 +1010,7 @@
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"test"
})),
)
@@ -1034,7 +1038,7 @@
.max_age(100),
)
.service(web::resource("/").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"test"
}))
.service(web::resource("/test/").to(|ses: Session| async move {
@@ -1067,7 +1071,7 @@
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false).expires_in(60))
.service(web::resource("/").to(|ses: Session| async move {
- let _ = ses.set("counter", 100);
+ let _ = ses.insert("counter", 100);
"test"
}))
.service(
diff --git a/src/actix_session/lib.rs.html b/src/actix_session/lib.rs.html
index 0ab345162..b1bf63c0c 100644
--- a/src/actix_session/lib.rs.html
+++ b/src/actix_session/lib.rs.html
@@ -333,6 +333,85 @@
330
331
332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
//! Sessions for Actix Web.
//!
@@ -354,9 +433,9 @@
//! // access session data
//! if let Some(count) = session.get::<i32>("counter")? {
//! println!("SESSION value: {}", count);
-//! session.set("counter", count + 1)?;
+//! session.insert("counter", count + 1)?;
//! } else {
-//! session.set("counter", 1)?;
+//! session.insert("counter", 1)?;
//! }
//!
//! Ok("Welcome!")
@@ -375,21 +454,27 @@
//! }
//! ```
-#![deny(rust_2018_idioms)]
+#![deny(rust_2018_idioms, nonstandard_style)]
+#![warn(missing_docs)]
-use std::{cell::RefCell, collections::HashMap, rc::Rc};
-
-use actix_web::dev::{
- Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse,
+use std::{
+ cell::{Ref, RefCell},
+ collections::HashMap,
+ mem,
+ rc::Rc,
+};
+
+use actix_web::{
+ dev::{Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse},
+ Error, FromRequest, HttpMessage, HttpRequest,
};
-use actix_web::{Error, FromRequest, HttpMessage, HttpRequest};
use futures_util::future::{ok, Ready};
use serde::{de::DeserializeOwned, Serialize};
#[cfg(feature = "cookie-session")]
mod cookie;
#[cfg(feature = "cookie-session")]
-pub use crate::cookie::CookieSession;
+pub use self::cookie::CookieSession;
/// The high-level interface you use to modify session data.
///
@@ -403,9 +488,9 @@
/// async fn index(session: Session) -> Result<&'static str> {
/// // access session data
/// if let Some(count) = session.get::<i32>("counter")? {
-/// session.set("counter", count + 1)?;
+/// session.insert("counter", count + 1)?;
/// } else {
-/// session.set("counter", 1)?;
+/// session.insert("counter", 1)?;
/// }
///
/// Ok("Welcome!")
@@ -415,6 +500,7 @@
/// Extraction of a [`Session`] object.
pub trait UserSession {
+ /// Extract the [`Session`] object
fn get_session(&self) -> Session;
}
@@ -436,13 +522,31 @@
}
}
+/// Status of a [`Session`].
#[derive(PartialEq, Clone, Debug)]
pub enum SessionStatus {
+ /// Session has been updated and requires a new persist operation.
Changed,
+
+ /// Session is flagged for deletion and should be removed from client and server.
+ ///
+ /// Most operations on the session after purge flag is set should have no effect.
Purged,
+
+ /// Session is flagged for refresh.
+ ///
+ /// For example, when using a backend that has a TTL (time-to-live) expiry on the session entry,
+ /// the session will be refreshed even if no data inside it has changed. The client may also
+ /// be notified of the refresh.
Renewed,
+
+ /// Session is unchanged from when last seen (if exists).
+ ///
+ /// This state also captures new (previously unissued) sessions such as a user's first
+ /// site visit.
Unchanged,
}
+
impl Default for SessionStatus {
fn default() -> SessionStatus {
SessionStatus::Unchanged
@@ -452,7 +556,7 @@
#[derive(Default)]
struct SessionInner {
state: HashMap<String, String>,
- pub status: SessionStatus,
+ status: SessionStatus,
}
impl Session {
@@ -465,37 +569,80 @@
}
}
- /// Set a `value` from the session.
- pub fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error> {
+ /// Get all raw key-value data from the session.
+ ///
+ /// Note that values are JSON encoded.
+ pub fn entries(&self) -> Ref<'_, HashMap<String, String>> {
+ Ref::map(self.0.borrow(), |inner| &inner.state)
+ }
+
+ /// Inserts a key-value pair into the session.
+ ///
+ /// Any serializable value can be used and will be encoded as JSON in session data, hence why
+ /// only a reference to the value is taken.
+ pub fn insert(
+ &self,
+ key: impl Into<String>,
+ value: impl Serialize,
+ ) -> Result<(), Error> {
let mut inner = self.0.borrow_mut();
+
if inner.status != SessionStatus::Purged {
inner.status = SessionStatus::Changed;
- inner
- .state
- .insert(key.to_owned(), serde_json::to_string(&value)?);
+ let val = serde_json::to_string(&value)?;
+ inner.state.insert(key.into(), val);
}
+
Ok(())
}
/// Remove value from the session.
- pub fn remove(&self, key: &str) {
+ ///
+ /// If present, the JSON encoded value is returned.
+ pub fn remove(&self, key: &str) -> Option<String> {
let mut inner = self.0.borrow_mut();
+
if inner.status != SessionStatus::Purged {
inner.status = SessionStatus::Changed;
- inner.state.remove(key);
+ return inner.state.remove(key);
}
+
+ None
+ }
+
+ /// Remove value from the session and deserialize.
+ ///
+ /// Returns None if key was not present in session. Returns T if deserialization succeeds,
+ /// otherwise returns un-deserialized JSON string.
+ pub fn remove_as<T: DeserializeOwned>(
+ &self,
+ key: &str,
+ ) -> Option<Result<T, String>> {
+ self.remove(key)
+ .map(|val_str| match serde_json::from_str(&val_str) {
+ Ok(val) => Ok(val),
+ Err(_err) => {
+ log::debug!(
+ "removed value (key: {}) could not be deserialized as {}",
+ key,
+ std::any::type_name::<T>()
+ );
+ Err(val_str)
+ }
+ })
}
/// Clear the session.
pub fn clear(&self) {
let mut inner = self.0.borrow_mut();
+
if inner.status != SessionStatus::Purged {
inner.status = SessionStatus::Changed;
inner.state.clear()
}
}
- /// Removes session, both client and server side.
+ /// Removes session both client and server side.
pub fn purge(&self) {
let mut inner = self.0.borrow_mut();
inner.status = SessionStatus::Purged;
@@ -505,6 +652,7 @@
/// Renews the session key, assigning existing session state to new key.
pub fn renew(&self) {
let mut inner = self.0.borrow_mut();
+
if inner.status != SessionStatus::Purged {
inner.status = SessionStatus::Renewed;
}
@@ -522,35 +670,32 @@
/// let mut req = test::TestRequest::default().to_srv_request();
///
/// Session::set_session(
- /// vec![("counter".to_string(), serde_json::to_string(&0).unwrap())],
/// &mut req,
+ /// vec![("counter".to_string(), serde_json::to_string(&0).unwrap())],
/// );
/// ```
pub fn set_session(
- data: impl IntoIterator<Item = (String, String)>,
req: &mut ServiceRequest,
+ data: impl IntoIterator<Item = (String, String)>,
) {
let session = Session::get_session(&mut *req.extensions_mut());
let mut inner = session.0.borrow_mut();
inner.state.extend(data);
}
+ /// Returns session status and iterator of key-value pairs of changes.
pub fn get_changes<B>(
res: &mut ServiceResponse<B>,
- ) -> (
- SessionStatus,
- Option<impl Iterator<Item = (String, String)>>,
- ) {
+ ) -> (SessionStatus, impl Iterator<Item = (String, String)>) {
if let Some(s_impl) = res
.request()
.extensions()
.get::<Rc<RefCell<SessionInner>>>()
{
- let state =
- std::mem::replace(&mut s_impl.borrow_mut().state, HashMap::new());
- (s_impl.borrow().status.clone(), Some(state.into_iter()))
+ let state = mem::take(&mut s_impl.borrow_mut().state);
+ (s_impl.borrow().status.clone(), state.into_iter())
} else {
- (SessionStatus::Unchanged, None)
+ (SessionStatus::Unchanged, HashMap::new().into_iter())
}
}
@@ -566,21 +711,23 @@
/// Extractor implementation for Session type.
///
-/// ```rust
+/// # Examples
+/// ```
/// # use actix_web::*;
/// use actix_session::Session;
///
-/// fn index(session: Session) -> Result<&'static str> {
+/// #[get("/")]
+/// async fn index(session: Session) -> Result<impl Responder> {
/// // access session data
/// if let Some(count) = session.get::<i32>("counter")? {
-/// session.set("counter", count + 1)?;
+/// session.insert("counter", count + 1)?;
/// } else {
-/// session.set("counter", 1)?;
+/// session.insert("counter", 1)?;
/// }
///
-/// Ok("Welcome!")
+/// let count = session.get::<i32>("counter")?.unwrap();
+/// Ok(format!("Counter: {}", count))
/// }
-/// # fn main() {}
/// ```
impl FromRequest for Session {
type Error = Error;
@@ -604,19 +751,19 @@
let mut req = test::TestRequest::default().to_srv_request();
Session::set_session(
- vec![("key".to_string(), serde_json::to_string("value").unwrap())],
&mut req,
+ vec![("key".to_string(), serde_json::to_string("value").unwrap())],
);
let session = Session::get_session(&mut *req.extensions_mut());
let res = session.get::<String>("key").unwrap();
assert_eq!(res, Some("value".to_string()));
- session.set("key2", "value2".to_string()).unwrap();
+ session.insert("key2", "value2").unwrap();
session.remove("key");
let mut res = req.into_response(HttpResponse::Ok().finish());
let (_status, state) = Session::get_changes(&mut res);
- let changes: Vec<_> = state.unwrap().collect();
+ let changes: Vec<_> = state.collect();
assert_eq!(changes, [("key2".to_string(), "\"value2\"".to_string())]);
}
@@ -625,8 +772,8 @@
let mut req = test::TestRequest::default().to_srv_request();
Session::set_session(
- vec![("key".to_string(), serde_json::to_string(&true).unwrap())],
&mut req,
+ vec![("key".to_string(), serde_json::to_string(&true).unwrap())],
);
let session = req.get_session();
@@ -639,8 +786,8 @@
let mut req = test::TestRequest::default().to_srv_request();
Session::set_session(
- vec![("key".to_string(), serde_json::to_string(&10).unwrap())],
&mut req,
+ vec![("key".to_string(), serde_json::to_string(&10).unwrap())],
);
let session = req.head_mut().get_session();
@@ -665,6 +812,17 @@
session.renew();
assert_eq!(session.0.borrow().status, SessionStatus::Renewed);
}
+
+ #[test]
+ fn session_entries() {
+ let session = Session(Rc::new(RefCell::new(SessionInner::default())));
+ session.insert("test_str", "val").unwrap();
+ session.insert("test_num", 1).unwrap();
+
+ let map = session.entries();
+ map.contains_key("test_str");
+ map.contains_key("test_num");
+ }
}
Status of a Session
.
impl Clone for SessionStatus
[src]
fn clone(&self) -> SessionStatus
[src]
Returns a copy of the value. Read more
+Session has been updated and requires a new persist operation.
+Session is flagged for deletion and should be removed from client and server.
+Most operations on the session after purge flag is set should have no effect.
+Session is flagged for refresh.
+For example, when using a backend that has a TTL (time-to-live) expiry on the session entry, +the session will be refreshed even if no data inside it has changed. The client may also +be notified of the refresh.
+Session is unchanged from when last seen (if exists).
+This state also captures new (previously unissued) sessions such as a user’s first +site visit.
+Trait Implementations
impl Clone for SessionStatus
[src]
fn clone(&self) -> SessionStatus
[src]
Returns a copy of the value. Read more
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for SessionStatus
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Formats the value using the given formatter. Read more
-impl Default for SessionStatus
[src]
fn default() -> SessionStatus
[src]
Returns the “default value” for a type. Read more
-impl PartialEq<SessionStatus> for SessionStatus
[src]
fn eq(&self, other: &SessionStatus) -> bool
[src]
This method tests for self
and other
values to be equal, and is used
+
impl Debug for SessionStatus
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Formats the value using the given formatter. Read more
+impl Default for SessionStatus
[src]
fn default() -> SessionStatus
[src]
Returns the “default value” for a type. Read more
+impl PartialEq<SessionStatus> for SessionStatus
[src]
fn eq(&self, other: &SessionStatus) -> bool
[src]
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl StructuralPartialEq for SessionStatus
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionStatus
impl Send for SessionStatus
impl Sync for SessionStatus
impl Unpin for SessionStatus
impl UnwindSafe for SessionStatus
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl StructuralPartialEq for SessionStatus
[src]
Auto Trait Implementations
impl RefUnwindSafe for SessionStatus
impl Send for SessionStatus
impl Sync for SessionStatus
impl Unpin for SessionStatus
impl UnwindSafe for SessionStatus
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src]
pub fn from(t: T) -> T
[src]
Performs the conversion.
diff --git a/actix_session/index.html b/actix_session/index.html index 54a637aa5..5e0d5f10c 100644 --- a/actix_session/index.html +++ b/actix_session/index.html @@ -1,7 +1,7 @@Crate actix_session[−][src]
Crate actix_session[−][src]
Sessions for Actix Web.
Provides a general solution for session management. Session middleware could provide different implementations which could be accessed via general session API.
This crate provides a general solution for session management and includes a cookie backend. @@ -18,9 +18,9 @@ modifying session data.
// access session data if let Some(count) = session.get::<i32>("counter")? { println!("SESSION value: {}", count); - session.set("counter", count + 1)?; + session.insert("counter", count + 1)?; } else { - session.set("counter", 1)?; + session.insert("counter", 1)?; } Ok("Welcome!") @@ -41,7 +41,8 @@ modifying session data.CookieSession | Use cookies for session storage. |
Session | The high-level interface you use to modify session data. |
Enums
-SessionStatus |
Traits
+SessionStatus | Status of a |
Traits
UserSession | Extraction of a |
Struct actix_session::CookieSession [−][src]
pub struct CookieSession(_);
Struct actix_session::CookieSession [−][src]
pub struct CookieSession(_);
Use cookies for session storage.
CookieSession
creates sessions which are limited to storing
fewer than 4000 bytes of data (as the payload must fit into a single
cookie). An Internal Server Error is generated if the session contains more
@@ -32,31 +32,31 @@ cause troubles when reading cookie, if they are not properly percent encoded.
Implementations
impl CookieSession
[src]
pub fn signed(key: &[u8]) -> CookieSession
[src]
Construct new signed CookieSession
instance.
Implementations
impl CookieSession
[src]
pub fn signed(key: &[u8]) -> CookieSession
[src]
Construct new signed CookieSession
instance.
Panics if key length is less than 32 bytes.
-pub fn private(key: &[u8]) -> CookieSession
[src]
Construct new private CookieSession
instance.
pub fn private(key: &[u8]) -> CookieSession
[src]
Construct new private CookieSession
instance.
Panics if key length is less than 32 bytes.
-pub fn path<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the path
field in the session cookie being built.
pub fn name<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the name
field in the session cookie being built.
pub fn domain<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the domain
field in the session cookie being built.
pub fn lazy(self, value: bool) -> CookieSession
[src]
When true, prevents adding session cookies to responses until +
pub fn path<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the path
field in the session cookie being built.
pub fn name<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the name
field in the session cookie being built.
pub fn domain<S: Into<String>>(self, value: S) -> CookieSession
[src]
Sets the domain
field in the session cookie being built.
pub fn lazy(self, value: bool) -> CookieSession
[src]
When true, prevents adding session cookies to responses until
the session contains data. Default is false
.
Useful when trying to comply with laws that require consent for setting cookies.
-pub fn secure(self, value: bool) -> CookieSession
[src]
Sets the secure
field in the session cookie being built.
pub fn secure(self, value: bool) -> CookieSession
[src]
Sets the secure
field in the session cookie being built.
If the secure
field is set, a cookie will only be transmitted when the
connection is secure - i.e. https
pub fn http_only(self, value: bool) -> CookieSession
[src]
Sets the http_only
field in the session cookie being built.
pub fn same_site(self, value: SameSite) -> CookieSession
[src]
Sets the same_site
field in the session cookie being built.
pub fn max_age(self, seconds: i64) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
pub fn max_age_time(self, value: Duration) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
pub fn expires_in(self, seconds: i64) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
pub fn expires_in_time(self, value: Duration) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
Trait Implementations
impl<S, B: 'static> Transform<S, ServiceRequest> for CookieSession where
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
type Response = ServiceResponse<B>
Responses produced by the service.
+pub fn http_only(self, value: bool) -> CookieSession
[src]
Sets the http_only
field in the session cookie being built.
pub fn same_site(self, value: SameSite) -> CookieSession
[src]
Sets the same_site
field in the session cookie being built.
pub fn max_age(self, seconds: i64) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
pub fn max_age_time(self, value: Duration) -> CookieSession
[src]
Sets the max-age
field in the session cookie being built.
pub fn expires_in(self, seconds: i64) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
pub fn expires_in_time(self, value: Duration) -> CookieSession
[src]
Sets the expires
field in the session cookie being built.
Trait Implementations
impl<S, B: 'static> Transform<S, ServiceRequest> for CookieSession where
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>>,
S::Future: 'static,
S::Error: 'static,
type Response = ServiceResponse<B>
Responses produced by the service.
type Error = S::Error
Errors produced by the service.
type InitError = ()
Errors produced while building a transform service.
type Transform = CookieSessionMiddleware<S>
The TransformService
value created by this factory
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
-fn new_transform(&self, service: S) -> Self::Future
[src]
Creates and returns a new Transform component, asynchronously
+fn new_transform(&self, service: S) -> Self::Future
[src]
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl !RefUnwindSafe for CookieSession
impl !Send for CookieSession
impl !Sync for CookieSession
impl Unpin for CookieSession
impl UnwindSafe for CookieSession
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
Mutably borrows from an owned value. Read more
diff --git a/actix_session/struct.Session.html b/actix_session/struct.Session.html index 5def28dbe..94c0938a8 100644 --- a/actix_session/struct.Session.html +++ b/actix_session/struct.Session.html @@ -1,7 +1,7 @@Struct actix_session::Session [−][src]
pub struct Session(_);
The high-level interface you use to modify session data.
+Struct actix_session::Session [−][src]
pub struct Session(_);
The high-level interface you use to modify session data.
Session object is obtained with UserSession::get_session
. The UserSession
trait is
implemented for HttpRequest
, ServiceRequest
, and RequestHead
.
HttpRequest
, ServiceRequest
, and async fn index(session: Session) -> Result<&'static str> {
// access session data
if let Some(count) = session.get::<i32>("counter")? {
- session.set("counter", count + 1)?;
+ session.insert("counter", count + 1)?;
} else {
- session.set("counter", 1)?;
+ session.insert("counter", 1)?;
}
Ok("Welcome!")
}
Implementations
impl Session
[src]
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<Option<T>, Error>
[src]
Get a value
from the session.
pub fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error>
[src]
Set a value
from the session.
pub fn remove(&self, key: &str)
[src]
Remove value from the session.
-pub fn clear(&self)
[src]
Clear the session.
-pub fn purge(&self)
[src]
Removes session, both client and server side.
-pub fn renew(&self)
[src]
Renews the session key, assigning existing session state to new key.
-pub fn set_session(
data: impl IntoIterator<Item = (String, String)>,
req: &mut ServiceRequest
)
[src]
data: impl IntoIterator<Item = (String, String)>,
req: &mut ServiceRequest
)
Adds the given key-value pairs to the session on the request.
+Implementations
impl Session
[src]
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<Option<T>, Error>
[src]
Get a value
from the session.
pub fn entries(&self) -> Ref<'_, HashMap<String, String>>
[src]
Get all raw key-value data from the session.
+Note that values are JSON encoded.
+pub fn insert(
&self,
key: impl Into<String>,
value: impl Serialize
) -> Result<(), Error>
[src]
&self,
key: impl Into<String>,
value: impl Serialize
) -> Result<(), Error>
Inserts a key-value pair into the session.
+Any serializable value can be used and will be encoded as JSON in session data, hence why +only a reference to the value is taken.
+pub fn remove(&self, key: &str) -> Option<String>
[src]
Remove value from the session.
+If present, the JSON encoded value is returned.
+pub fn remove_as<T: DeserializeOwned>(
&self,
key: &str
) -> Option<Result<T, String>>
[src]
&self,
key: &str
) -> Option<Result<T, String>>
Remove value from the session and deserialize.
+Returns None if key was not present in session. Returns T if deserialization succeeds, +otherwise returns un-deserialized JSON string.
+pub fn clear(&self)
[src]
Clear the session.
+pub fn purge(&self)
[src]
Removes session both client and server side.
+pub fn renew(&self)
[src]
Renews the session key, assigning existing session state to new key.
+pub fn set_session(
req: &mut ServiceRequest,
data: impl IntoIterator<Item = (String, String)>
)
[src]
req: &mut ServiceRequest,
data: impl IntoIterator<Item = (String, String)>
)
Adds the given key-value pairs to the session on the request.
Values that match keys already existing on the session will be overwritten. Values should already be JSON serialized.
Examples
@@ -33,28 +41,31 @@ already be JSON serialized. let mut req = test::TestRequest::default().to_srv_request(); Session::set_session( - vec![("counter".to_string(), serde_json::to_string(&0).unwrap())], &mut req, + vec![("counter".to_string(), serde_json::to_string(&0).unwrap())], );pub fn get_changes<B>(
res: &mut ServiceResponse<B>
) -> (SessionStatus, Option<impl Iterator<Item = (String, String)>>)
[src]
res: &mut ServiceResponse<B>
) -> (SessionStatus, Option<impl Iterator<Item = (String, String)>>)
Trait Implementations
impl FromRequest for Session
[src]
Extractor implementation for Session type.
- +pub fn get_changes<B>(
res: &mut ServiceResponse<B>
) -> (SessionStatus, impl Iterator<Item = (String, String)>)
[src]
res: &mut ServiceResponse<B>
) -> (SessionStatus, impl Iterator<Item = (String, String)>)
Returns session status and iterator of key-value pairs of changes.
+Trait Implementations
impl FromRequest for Session
[src]
Extractor implementation for Session type.
+Examples
use actix_session::Session; -fn index(session: Session) -> Result<&'static str> { +#[get("/")] +async fn index(session: Session) -> Result<impl Responder> { // access session data if let Some(count) = session.get::<i32>("counter")? { - session.set("counter", count + 1)?; + session.insert("counter", count + 1)?; } else { - session.set("counter", 1)?; + session.insert("counter", 1)?; } - Ok("Welcome!") + let count = session.get::<i32>("counter")?.unwrap(); + Ok(format!("Counter: {}", count)) }
type Error = Error
The associated error which can be returned.
type Future = Ready<Result<Session, Error>>
Future that resolves to a Self.
type Config = ()
Configuration for this extractor.
-fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]
Create a Self from request parts asynchronously.
+fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
[src]
Create a Self from request parts asynchronously.
pub fn extract(req: &HttpRequest) -> Self::Future
Create a Self from request head asynchronously. Read more
pub fn configure<F>(f: F) -> Self::Config where
F: FnOnce(Self::Config) -> Self::Config,
F: FnOnce(Self::Config) -> Self::Config,
Create and configure config instance.
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl !Send for Session
impl !Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
pub fn type_id(&self) -> TypeId
[src]
Gets the TypeId
of self
. Read more
Trait actix_session::UserSession [−][src]
Trait actix_session::UserSession [−][src]
pub trait UserSession { fn get_session(&self) -> Session; }
Extraction of a Session
object.
Required methods
fn get_session(&self) -> Session
[src]
Implementations on Foreign Types
impl UserSession for HttpRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for ServiceRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for RequestHead
[src]
fn get_session(&self) -> Session
[src]
Implementors
Loading content...Required methods
fn get_session(&self) -> Session
[src]
Extract the Session
object
Implementations on Foreign Types
impl UserSession for HttpRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for ServiceRequest
[src]
fn get_session(&self) -> Session
[src]
impl UserSession for RequestHead
[src]
fn get_session(&self) -> Session
[src]
Implementors
Loading content... \ No newline at end of file diff --git a/search-index.js b/search-index.js index 0d3541d80..46c01c075 100644 --- a/search-index.js +++ b/search-index.js @@ -3,7 +3,7 @@ var searchIndex = JSON.parse('{\ "actix_identity":{"doc":"Opinionated request identity service for Actix Web apps.","t":[3,3,3,8,16,16,10,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieIdentityPolicy","Identity","IdentityService","IdentityPolicy","Future","ResponseFuture","from_request","to_response","RequestIdentity","get_identity","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from_request","to_response","clone","new_transform","from_request","new","name","path","domain","secure","max_age","max_age_secs","http_only","same_site","visit_deadline","login_deadline","identity","remember","forget","new"],"q":["actix_identity","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for request identity storage.","The extractor type to obtain your identity from a request.","Request identity middleware","Identity policy.","The return type of the middleware","The return type of the middleware","Parse the session from request and load data from a …","Write changes to response","Helper trait that allows to get Identity.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create newCookieIdentityPolicy
instance.","Sets the name of issued cookies.","Sets the Path
attribute of issued cookies.","Sets the Domain
attribute of issued cookies.","Sets the Secure
attribute of issued cookies.","Sets the Max-Age
attribute of issued cookies.","Sets the Max-Age
attribute of issued cookies with given …","Sets the HttpOnly
attribute of issued cookies.","Sets the SameSite
attribute of issued cookies.","Accepts only users who have visited within given deadline.","Accepts only users who authenticated within the given …","Return the claimed identity of the user associated …","Remember identity.","This method is used to ‘forget’ the current identity …","Create new identity service with specified backend."],"i":[0,0,0,0,1,1,1,1,0,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,3,3,4,5,4,3,3,3,3,3,3,3,3,3,3,3,4,4,4,5],"f":[null,null,null,null,null,null,[[["servicerequest",3]]],[[["serviceresponse",3],["bool",15],["option",4],["string",3]]],null,[[],[["option",4],["string",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3],["bool",15],["option",4],["string",3]]],[[],["identity",3]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[],["cookieidentitypolicy",3]],[[["bool",15]],["cookieidentitypolicy",3]],[[["duration",3]],["cookieidentitypolicy",3]],[[["i64",15]],["cookieidentitypolicy",3]],[[["bool",15]]],[[["samesite",4]]],[[["duration",3]],["cookieidentitypolicy",3]],[[["duration",3]],["cookieidentitypolicy",3]],[[],[["option",4],["string",3]]],[[["string",3]]],[[]],[[]]],"p":[[8,"IdentityPolicy"],[8,"RequestIdentity"],[3,"CookieIdentityPolicy"],[3,"Identity"],[3,"IdentityService"]]},\
"actix_protobuf":{"doc":"","t":[4,13,13,13,13,13,3,12,3,11,3,11,11,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["ProtoBufPayloadError","Overflow","ContentType","Serialize","Deserialize","Payload","ProtoBuf","0","ProtoBufConfig","limit","ProtoBufMessage","new","limit","ProtoBufResponseBuilder","protobuf","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","into_future","try_poll","vzip","from","from","default","deref","deref_mut","fmt","fmt","fmt","fmt","poll","from_request","error_response","respond_to"],"q":["actix_protobuf","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","Payload size is bigger than 256k","Content type error","Serialize error","Deserialize error","Payload error","","","","Change max size of payload. By default max size is 256Kb","","Create ProtoBufMessage
for request.","Change max size of payload. By default max size is 256Kb","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,1,1,1,0,2,0,3,0,4,4,0,5,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,1,1,3,2,2,1,2,1,2,4,2,1,2],"f":[null,null,null,null,null,null,null,null,null,[[["usize",15]]],null,[[["httprequest",3],["payload",4]]],[[["usize",15]]],null,[[["message",8]],[["result",4],["httpresponse",3],["error",3]]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[["context",3],["pin",3]],["poll",4]],[[]],[[["payloaderror",4]],["protobufpayloaderror",4]],[[["protobufdecodeerror",3]],["protobufpayloaderror",4]],[[]],[[]],[[]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["pin",3],["context",3]],["poll",4]],[[["httprequest",3],["payload",4]]],[[],["httpresponse",3]],[[["httprequest",3]],["httpresponse",3]]],"p":[[4,"ProtoBufPayloadError"],[3,"ProtoBuf"],[3,"ProtoBufConfig"],[3,"ProtoBufMessage"],[8,"ProtoBufResponseBuilder"]]},\
"actix_redis":{"doc":"Redis integration for Actix and session store for Actix …","t":[3,12,3,4,13,13,13,3,4,13,13,13,4,13,13,13,13,13,13,4,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["Command","0","RedisActor","SameSite","Strict","Lax","None","RedisSession","Error","Redis","NotConnected","Disconnected","RespError","Internal","IO","RESP","Remote","Connection","Unexpected","RespValue","Nil","Array","BulkString","Error","Integer","SimpleString","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","equivalent","get_hash","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","equivalent","from_resp_int","clone","fmt","fmt","from","from","from","from","from","from","from","from","from","source","eq","ne","fmt","clone","hash","fmt","eq","fmt","from","fmt","fmt","fmt","source","started","restarting","handle","handle","error","new_transform","start","new","ttl","cookie_name","cookie_path","cookie_domain","cookie_secure","cookie_max_age","cookie_same_site","cookie_http_only","cache_keygen","is_strict","is_lax","is_none","append","push"],"q":["actix_redis","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Command for send data to Redis","","Redis communication actor","The SameSite
cookie attribute.","The “Strict” SameSite
attribute.","The “Lax” SameSite
attribute.","The “None” SameSite
attribute.","Use redis as session storage.","General purpose actix redis error","","Receiving message during reconnecting","Cancel all waters when connection get dropped","","A non-specific internal error that prevented an operation …","An IO error occurred","A RESP parsing/serialising error occurred","A remote error","Error creating a connection, or an error with a …","An unexpected error. In this context “unexpected” …","A single RESP value, this owns the data that is …","","Zero, one or more other RespValue
s.","A bulk string. In Redis terminology a string is a …","An error from the Redis server","Redis documentation defines an integer as being a signed …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Start new Supervisor
with RedisActor
.","Create new redis session backend","Set time to live in seconds for session value.","Set custom cookie name for session ID.","Set custom cookie path.","Set custom cookie domain.","Set custom cookie secure.","Set custom cookie max-age.","Set custom cookie SameSite
attribute.","Set custom cookie HttpOnly
policy.","Set a custom cache key generation strategy, expecting …","Returns true
if self
is SameSite::Strict
and false
…","Returns true
if self
is SameSite::Lax
and false
otherwise.","Returns true
if self
is SameSite::None
and false
…","Convenience function for building dynamic Redis commands …","Push item to Resp array"],"i":[0,1,0,0,2,2,2,0,0,3,3,3,0,4,4,4,4,4,4,0,5,5,5,5,5,5,1,1,1,1,1,1,1,1,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,4,5,5,4,5,5,5,4,5,5,4,2,2,2,2,2,3,1,3,3,3,6,6,6,6,6,7,6,7,7,7,7,7,7,7,7,7,7,2,2,2,5,5],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["bool",15]],[[["respvalue",4]],[["error",4],["respvalue",4],["result",4]]],[[],["respvalue",4]],[[["formatter",3]],[["result",4],["error",3]]],[[["formatter",3]],[["result",4],["error",3]]],[[["string",3]],["respvalue",4]],[[["string",3]],["respvalue",4]],[[["trysenderror",3]],["error",4]],[[["vec",3],["u8",15],["global",3]],["respvalue",4]],[[["str",15]],["respvalue",4]],[[["error",3]],["error",4]],[[["arc",3],["str",15]],["respvalue",4]],[[],["respvalue",4]],[[["usize",15]],["respvalue",4]],[[],[["option",4],["error",8]]],[[["respvalue",4]],["bool",15]],[[["respvalue",4]],["bool",15]],[[["formatter",3]],[["result",4],["error",3]]],[[],["samesite",4]],[[]],[[["formatter",3]],[["result",4],["error",3]]],[[["samesite",4]],["bool",15]],[[["formatter",3]],[["result",4],["error",3]]],[[["error",4]],["error",4]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],[["option",4],["error",8]]],[[["context",3]]],[[]],[[["command",3]]],[[["respvalue",4],["result",4],["resperror",4]]],[[["error",3]],["running",4]],[[]],[[["into",8],["string",3]],[["addr",3],["redisactor",3]]],[[["into",8],["string",3]],["redissession",3]],[[["u32",15]]],[[["str",15]]],[[["str",15]]],[[["str",15]]],[[["bool",15]]],[[]],[[["samesite",4]]],[[["bool",15]]],[[["box",3],["fn",8]]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["respvalue",4]],[[]]],"p":[[3,"Command"],[4,"SameSite"],[4,"Error"],[4,"RespError"],[4,"RespValue"],[3,"RedisActor"],[3,"RedisSession"]]},\
-"actix_session":{"doc":"Sessions for Actix Web.","t":[3,3,8,10,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieSession","Session","UserSession","get_session","SessionStatus","Changed","Purged","Renewed","Unchanged","get","set","remove","clear","purge","renew","set_session","get_changes","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","fmt","new_transform","from_request","signed","private","path","name","domain","lazy","secure","http_only","same_site","max_age","max_age_time","expires_in","expires_in_time"],"q":["actix_session","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for session storage.","The high-level interface you use to modify session data.","Extraction of a [Session
] object.","","","","","","","Get a value
from the session.","Set a value
from the session.","Remove value from the session.","Clear the session.","Removes session, both client and server side.","Renews the session key, assigning existing session state …","Adds the given key-value pairs to the session on the …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Construct new signed CookieSession
instance.","Construct new private CookieSession
instance.","Sets the path
field in the session cookie being built.","Sets the name
field in the session cookie being built.","Sets the domain
field in the session cookie being built.","When true, prevents adding session cookies to responses …","Sets the secure
field in the session cookie being built.","Sets the http_only
field in the session cookie being …","Sets the same_site
field in the session cookie being …","Sets the max-age
field in the session cookie being built.","Sets the max-age
field in the session cookie being built.","Sets the expires
field in the session cookie being built.","Sets the expires
field in the session cookie being built."],"i":[0,0,0,1,0,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4],"f":[null,null,null,[[],["session",3]],null,null,null,null,null,[[["str",15]],[["result",4],["option",4],["error",3]]],[[["serialize",8],["str",15]],[["error",3],["result",4]]],[[["str",15]]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["sessionstatus",4]],[[],["sessionstatus",4]],[[["sessionstatus",4]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookiesession",3]],[[],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["samesite",4]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]]],"p":[[8,"UserSession"],[4,"SessionStatus"],[3,"Session"],[3,"CookieSession"]]},\
+"actix_session":{"doc":"Sessions for Actix Web.","t":[3,3,8,10,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["CookieSession","Session","UserSession","get_session","SessionStatus","Changed","Purged","Renewed","Unchanged","get","entries","insert","remove","remove_as","clear","purge","renew","set_session","get_changes","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","fmt","new_transform","from_request","signed","private","path","name","domain","lazy","secure","http_only","same_site","max_age","max_age_time","expires_in","expires_in_time"],"q":["actix_session","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Use cookies for session storage.","The high-level interface you use to modify session data.","Extraction of a [Session
] object.","Extract the [Session
] object","Status of a [Session
].","Session has been updated and requires a new persist …","Session is flagged for deletion and should be removed …","Session is flagged for refresh.","Session is unchanged from when last seen (if exists).","Get a value
from the session.","Get all raw key-value data from the session.","Inserts a key-value pair into the session.","Remove value from the session.","Remove value from the session and deserialize.","Clear the session.","Removes session both client and server side.","Renews the session key, assigning existing session state …","Adds the given key-value pairs to the session on the …","Returns session status and iterator of key-value pairs of …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Construct new signed CookieSession
instance.","Construct new private CookieSession
instance.","Sets the path
field in the session cookie being built.","Sets the name
field in the session cookie being built.","Sets the domain
field in the session cookie being built.","When true, prevents adding session cookies to responses …","Sets the secure
field in the session cookie being built.","Sets the http_only
field in the session cookie being …","Sets the same_site
field in the session cookie being …","Sets the max-age
field in the session cookie being built.","Sets the max-age
field in the session cookie being built.","Sets the expires
field in the session cookie being built.","Sets the expires
field in the session cookie being built."],"i":[0,0,0,1,0,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4],"f":[null,null,null,[[],["session",3]],null,null,null,null,null,[[["str",15]],[["result",4],["option",4],["error",3]]],[[],[["hashmap",3],["ref",3]]],[[],[["error",3],["result",4]]],[[["str",15]],[["option",4],["string",3]]],[[["str",15]],[["result",4],["option",4]]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["serviceresponse",3]]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["sessionstatus",4]],[[],["sessionstatus",4]],[[["sessionstatus",4]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["httprequest",3],["payload",4]]],[[],["cookiesession",3]],[[],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["into",8],["string",3]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["bool",15]],["cookiesession",3]],[[["samesite",4]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]],[[["i64",15]],["cookiesession",3]],[[["duration",3]],["cookiesession",3]]],"p":[[8,"UserSession"],[4,"SessionStatus"],[3,"Session"],[3,"CookieSession"]]},\
"actix_web_httpauth":{"doc":"HTTP authentication schemes for actix-web.","t":[0,0,3,11,3,11,11,0,4,13,13,13,3,11,11,3,11,8,16,10,3,8,16,16,10,0,0,4,13,13,13,13,13,13,3,3,3,8,10,0,11,0,3,0,3,3,4,13,13,13,8,10,3,12,0,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["extractors","basic","Config","realm","BasicAuth","user_id","password","bearer","Error","InvalidRequest","InvalidToken","InsufficientScope","Config","scope","realm","BearerAuth","token","AuthExtractorConfig","Inner","into_inner","AuthenticationError","AuthExtractor","Error","Future","from_service_request","headers","authorization","ParseError","Invalid","MissingScheme","MissingField","ToStrError","Base64DecodeError","Utf8Error","Authorization","Basic","Bearer","Scheme","parse","www_authenticate","status_code","basic","Basic","bearer","BearerBuilder","Bearer","Error","InvalidRequest","InvalidToken","InsufficientScope","Challenge","to_bytes","WwwAuthenticate","0","middleware","HttpAuthentication","with_fn","basic","bearer","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","try_into_header_pair","equivalent","get_hash","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","borrow","borrow_mut","try_from","try_into","type_id","vzip","from","into","to_owned","clone_into","to_string","borrow","borrow_mut","try_from","try_into","type_id","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","try_into_header_pair","equivalent","get_hash","vzip","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","into_inner","into_inner","from_service_request","from_service_request","parse","parse","as_mut","as_ref","as_ref","as_ref","from","from","from","from","from","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","default","default","default","default","default","default","default","cmp","cmp","cmp","cmp","cmp","cmp","cmp","eq","ne","eq","ne","eq","ne","eq","ne","eq","ne","eq","eq","ne","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","hash","hash","hash","hash","hash","source","new_transform","from_request","from_request","error_response","status_code","try_into_value","try_into_value","try_into_value","try_into_value","try_into_value","try_into_value","name","parse","name","parse","with_error","with_error_description","with_error_uri","new","challenge_mut","status_code_mut","into_scheme","new","user_id","password","new","token","new","with_realm","scope","realm","error","error_description","error_uri","finish","build"],"q":["actix_web_httpauth","actix_web_httpauth::extractors","actix_web_httpauth::extractors::basic","","","","","actix_web_httpauth::extractors","actix_web_httpauth::extractors::bearer","","","","","","","","","actix_web_httpauth::extractors","","","","","","","","actix_web_httpauth","actix_web_httpauth::headers","actix_web_httpauth::headers::authorization","","","","","","","","","","","","actix_web_httpauth::headers","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::www_authenticate::bearer","","","","","","actix_web_httpauth::headers::www_authenticate","","","","actix_web_httpauth","actix_web_httpauth::middleware","","","","actix_web_httpauth::extractors::basic","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::extractors::bearer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::extractors","","","","","","","","","actix_web_httpauth::headers::authorization","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate::bearer","","","","","","","","","","","","","","","","","","","","","actix_web_httpauth::headers::www_authenticate","","","","","","","","","","","","","actix_web_httpauth::middleware","","","","","","","","","","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::extractors::basic","","actix_web_httpauth::extractors::bearer","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::middleware","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::extractors::basic","","actix_web_httpauth::extractors::bearer","","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::middleware","actix_web_httpauth::extractors","actix_web_httpauth::headers::authorization","","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::authorization","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::extractors::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","actix_web_httpauth::middleware","actix_web_httpauth::extractors::basic","actix_web_httpauth::extractors::bearer","actix_web_httpauth::extractors","","actix_web_httpauth::headers::authorization","","","actix_web_httpauth::headers::www_authenticate::basic","actix_web_httpauth::headers::www_authenticate::bearer","actix_web_httpauth::headers::www_authenticate","actix_web_httpauth::headers::authorization","","actix_web_httpauth::headers::www_authenticate","","actix_web_httpauth::extractors","","","","","","actix_web_httpauth::headers::authorization","","","","","","actix_web_httpauth::headers::www_authenticate::basic","","actix_web_httpauth::headers::www_authenticate::bearer","","","","","",""],"d":["Type-safe authentication information extractors","Extractor for the “Basic” HTTP Authentication Scheme","BasicAuth
extractor configuration, used for …","Set challenge realm
attribute.","Extractor for HTTP Basic auth.","Returns client’s user-ID.","Returns client’s password.","Extractor for the “Bearer” HTTP Authentication Scheme","Bearer authorization error types, described in RFC 6750","The request is missing a required parameter, includes an …","The access token provided is expired, revoked, malformed, …","The request requires higher privileges than provided by …","BearerAuth extractor configuration.","Set challenge scope
attribute.","Set challenge realm
attribute.","Extractor for HTTP Bearer auth","Returns bearer token provided by client.","Trait implemented for types that provides configuration …","Associated challenge type.","Convert the config instance into a HTTP challenge.","Authentication error returned by authentication …","Trait implemented by types that can extract HTTP …","The associated error which can be returned.","Future that resolves into extracted credentials type.","Parse the authentication credentials from the actix’ …","Typed HTTP headers","Authorization
header and various auth schemes","Possible errors while parsing Authorization
header.","Header value is malformed","Authentication scheme is missing","Required authentication field is missing","Unable to convert header into the str","Malformed base64 string","Malformed UTF-8 string","Authorization
header, defined in RFC 7235","Credentials for Basic
authentication scheme, defined in …","Credentials for Bearer
authentication scheme, defined in …","Authentication scheme for Authorization
header.","Try to parse the authentication scheme from the …","WWW-Authenticate
header and various auth challenges","Returns HTTP status code suitable for current error type.","Challenge for the “Basic” HTTP Authentication Scheme","Challenge for WWW-Authenticate
header with HTTP Basic …","Challenge for the “Bearer” HTTP Authentication Scheme","Builder for the Bearer
challenge.","Challenge for WWW-Authenticate
header with HTTP Bearer …","Bearer authorization error types, described in RFC 6750","The request is missing a required parameter, includes an …","The access token provided is expired, revoked, malformed, …","The request requires higher privileges than provided by …","Authentication challenge for WWW-Authenticate
header.","Converts the challenge into a bytes suitable for HTTP …","WWW-Authenticate
header, described in RFC 7235","","HTTP Authentication middleware.","Middleware for checking HTTP authentication.","Construct HttpAuthentication
middleware with the provided …","Construct HttpAuthentication
middleware for the HTTP “…","Construct HttpAuthentication
middleware for the HTTP “…","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Attach Error
to the current Authentication error.","Attach error description to the current Authentication …","Attach error URI to the current Authentication error.","Creates new authentication error from the provided …","Returns mutable reference to the inner challenge instance.","Returns mutable reference to the inner status code.","Consumes Authorization
header and returns inner Scheme
…","Creates Basic
credentials with provided user_id
and …","Returns client’s user-ID.","Returns client’s password if provided.","Creates new Bearer
credentials with the token provided.","Gets reference to the credentials token.","Creates new Basic
challenge with an empty realm
field.","Creates new Basic
challenge from the provided realm
field …","Provides the scope
attribute, as defined in RFC6749, …","Provides the realm
attribute, as defined in RFC2617","Provides the error
attribute, as defined in RFC6750, …","Provides the error_description
attribute, as defined in …","Provides the error_uri
attribute, as defined in RFC6750, …","Consumes the builder and returns built Bearer
instance.","Creates the builder for Bearer
challenge."],"i":[0,0,0,1,0,2,2,0,0,3,3,3,0,4,4,0,5,0,6,6,0,0,7,7,7,0,0,0,8,8,8,8,8,8,0,0,0,0,9,0,3,0,0,0,0,0,0,3,3,3,0,10,0,11,0,0,12,12,12,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,13,13,13,13,13,13,13,13,13,8,8,8,8,8,8,8,8,8,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,1,4,2,5,15,16,14,1,4,14,13,8,8,8,14,1,2,4,5,14,15,16,17,19,3,11,12,1,4,14,17,18,19,11,14,15,16,17,19,3,11,14,14,15,15,16,16,17,17,19,19,3,11,11,14,15,16,17,19,3,11,1,2,4,5,13,8,14,15,16,17,18,19,3,11,12,13,8,14,15,16,17,19,3,14,17,19,3,11,8,12,2,5,13,13,14,15,16,17,19,11,14,14,11,11,13,13,13,13,13,13,14,15,15,15,16,16,17,17,18,18,18,18,18,18,19],"f":[null,null,null,[[],["config",3]],null,[[],["cow",4]],[[],[["option",4],["cow",4]]],null,null,null,null,null,null,[[["cow",4],["into",8]],["config",3]],[[["cow",4],["into",8]],["config",3]],null,[[],["str",15]],null,null,[[]],null,null,null,null,[[["servicerequest",3]]],null,null,null,null,null,null,null,null,null,null,null,null,null,[[["headervalue",3]],[["result",4],["parseerror",4]]],null,[[],["statuscode",3]],null,null,null,null,null,null,null,null,null,null,[[],["bytes",3]],null,null,null,null,[[],["httpauthentication",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["result",4]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["result",4]],[[],["bool",15]],[[],["u64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[["servicerequest",3]]],[[["servicerequest",3]]],[[["headervalue",3]],[["result",4],["parseerror",4]]],[[["headervalue",3]],[["result",4],["parseerror",4]]],[[]],[[],["challenge",3]],[[],["bearer",3]],[[]],[[]],[[["tostrerror",3]]],[[["decodeerror",4]]],[[["utf8error",3]]],[[],["authorization",3]],[[],["config",3]],[[],["basicauth",3]],[[],["config",3]],[[],["bearerauth",3]],[[],["authorization",3]],[[],["basic",3]],[[],["bearer",3]],[[],["basic",3]],[[],["bearer",3]],[[],["error",4]],[[],["wwwauthenticate",3]],[[],["httpauthentication",3]],[[],["config",3]],[[],["config",3]],[[],["authorization",3]],[[],["basic",3]],[[],["bearerbuilder",3]],[[],["bearer",3]],[[],["wwwauthenticate",3]],[[["authorization",3]],["ordering",4]],[[["basic",3]],["ordering",4]],[[["bearer",3]],["ordering",4]],[[["basic",3]],["ordering",4]],[[["bearer",3]],["ordering",4]],[[["error",4]],["ordering",4]],[[["wwwauthenticate",3]],["ordering",4]],[[["authorization",3]],["bool",15]],[[["authorization",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["basic",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["bearer",3]],["bool",15]],[[["error",4]],["bool",15]],[[["wwwauthenticate",3]],["bool",15]],[[["wwwauthenticate",3]],["bool",15]],[[["authorization",3]],[["option",4],["ordering",4]]],[[["basic",3]],[["option",4],["ordering",4]]],[[["bearer",3]],[["option",4],["ordering",4]]],[[["basic",3]],[["option",4],["ordering",4]]],[[["bearer",3]],[["option",4],["ordering",4]]],[[["error",4]],[["option",4],["ordering",4]]],[[["wwwauthenticate",3]],[["option",4],["ordering",4]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],[["error",3],["result",4]]],[[["formatter",3]],[["error",3],["result",4]]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[],[["option",4],["error",8]]],[[]],[[["httprequest",3],["payload",4]]],[[["httprequest",3],["payload",4]]],[[],["httpresponse",3]],[[],["statuscode",3]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],[["result",4],["headervalue",3]]],[[],["headername",3]],[[],[["parseerror",4],["result",4]]],[[],["headername",3]],[[],[["parseerror",4],["result",4]]],[[["error",4]]],[[]],[[]],[[],["authenticationerror",3]],[[]],[[],["statuscode",3]],[[]],[[["option",4]],["basic",3]],[[],["cow",4]],[[],[["option",4],["cow",4]]],[[],["bearer",3]],[[],["cow",4]],[[],["basic",3]],[[],["basic",3]],[[]],[[]],[[["error",4]]],[[]],[[]],[[],["bearer",3]],[[],["bearerbuilder",3]]],"p":[[3,"Config"],[3,"BasicAuth"],[4,"Error"],[3,"Config"],[3,"BearerAuth"],[8,"AuthExtractorConfig"],[8,"AuthExtractor"],[4,"ParseError"],[8,"Scheme"],[8,"Challenge"],[3,"WwwAuthenticate"],[3,"HttpAuthentication"],[3,"AuthenticationError"],[3,"Authorization"],[3,"Basic"],[3,"Bearer"],[3,"Basic"],[3,"BearerBuilder"],[3,"Bearer"]]},\
"prost_example":{"doc":"","t":[3,12,12,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["MyObj","number","name","index","main","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","vzip","clone","default","eq","ne","fmt","encode_raw","merge_field","encoded_len","clear"],"q":["prost_example","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"f":[null,null,null,[[["protobuf",3],["myobj",3]]],[[],["result",6]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[],["myobj",3]],[[]],[[["myobj",3]],["bool",15]],[[["myobj",3]],["bool",15]],[[["formatter",3]],["result",6]],[[]],[[["u32",15],["wiretype",4],["decodecontext",3]],[["decodeerror",3],["result",4]]],[[],["usize",15]],[[]]],"p":[[3,"MyObj"]]}\
}');
diff --git a/src/actix_redis/session.rs.html b/src/actix_redis/session.rs.html
index 5a2baab47..05f308cda 100644
--- a/src/actix_redis/session.rs.html
+++ b/src/actix_redis/session.rs.html
@@ -867,8 +867,9 @@
Box::pin(async move {
let state = inner.load(&req).await?;
+
let value = if let Some((state, value)) = state {
- Session::set_session(state, &mut req);
+ Session::set_session(&mut req, state);
Some(value)
} else {
None
@@ -877,8 +878,7 @@
let mut res = srv.call(req).await?;
match Session::get_changes(&mut res) {
- (SessionStatus::Unchanged, None) => Ok(res),
- (SessionStatus::Unchanged, Some(state)) => {
+ (SessionStatus::Unchanged, state) => {
if value.is_none() {
// implies the session is new
inner.update(res, state, value).await
@@ -886,10 +886,10 @@
Ok(res)
}
}
- (SessionStatus::Changed, Some(state)) => {
- inner.update(res, state, value).await
- }
- (SessionStatus::Purged, Some(_)) => {
+
+ (SessionStatus::Changed, state) => inner.update(res, state, value).await,
+
+ (SessionStatus::Purged, _) => {
if let Some(val) = value {
inner.clear_cache(val).await?;
match inner.remove_cookie(&mut res) {
@@ -900,7 +900,8 @@
Err(error::ErrorInternalServerError("unexpected"))
}
}
- (SessionStatus::Renewed, Some(state)) => {
+
+ (SessionStatus::Renewed, state) => {
if let Some(val) = value {
inner.clear_cache(val).await?;
inner.update(res, state, None).await
@@ -908,7 +909,6 @@
inner.update(res, state, None).await
}
}
- (_, None) => unreachable!(),
}
})
}
@@ -1053,7 +1053,7 @@
Ok(res)
}
- /// removes cache entry
+ /// Removes cache entry.
async fn clear_cache(&self, key: String) -> Result<(), Error> {
let cache_key = (self.cache_keygen)(&key);
@@ -1072,7 +1072,7 @@
}
}
- /// invalidates session cookie
+ /// Invalidates session cookie.
fn remove_cookie<B>(&self, res: &mut ServiceResponse<B>) -> Result<(), Error> {
let mut cookie = Cookie::named(self.name.clone());
cookie.set_value("");
@@ -1121,7 +1121,7 @@
.get::<i32>("counter")
.unwrap_or(Some(0))
.map_or(1, |inner| inner + 1);
- session.set("counter", counter)?;
+ session.insert("counter", &counter)?;
Ok(HttpResponse::Ok().json(&IndexResponse { user_id, counter }))
}
@@ -1136,7 +1136,7 @@
session: Session,
) -> Result<HttpResponse> {
let id = user_id.into_inner().user_id;
- session.set("user_id", &id)?;
+ session.insert("user_id", &id)?;
session.renew();
let counter: i32 = session
diff --git a/src/actix_session/cookie.rs.html b/src/actix_session/cookie.rs.html
index ad71e5076..498bff896 100644
--- a/src/actix_session/cookie.rs.html
+++ b/src/actix_session/cookie.rs.html
@@ -551,6 +551,8 @@
548
549
550
+551
+552
//! Cookie based sessions. See docs for [`CookieSession`]. @@ -562,7 +564,7 @@ use actix_web::http::{header::SET_COOKIE, HeaderValue}; use actix_web::{Error, HttpMessage, ResponseError}; use derive_more::Display; -use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready}; +use futures_util::future::{ok, LocalBoxFuture, Ready}; use serde_json::error::Error as JsonError; use time::{Duration, OffsetDateTime}; @@ -631,6 +633,7 @@ let value = serde_json::to_string(&state).map_err(CookieSessionError::Serialize)?; + if value.len() > 4064 { return Err(CookieSessionError::Overflow.into()); } @@ -698,6 +701,7 @@ jar.private(&self.key).get(&self.name) } }; + if let Some(cookie) = cookie_opt { if let Ok(val) = serde_json::from_str(cookie.value()) { return (false, val); @@ -706,6 +710,7 @@ } } } + (true, HashMap::new()) } } @@ -863,7 +868,7 @@ } } -/// Cookie session middleware +/// Cookie based session middleware. pub struct CookieSessionMiddleware<S> { service: S, inner: Rc<CookieSessionInner>, @@ -890,41 +895,40 @@ let inner = self.inner.clone(); let (is_new, state) = self.inner.load(&req); let prolong_expiration = self.inner.expires_in.is_some(); - Session::set_session(state, &mut req); + Session::set_session(&mut req, state); let fut = self.service.call(req); - async move { - fut.await.map(|mut res| { - match Session::get_changes(&mut res) { - (SessionStatus::Changed, Some(state)) - | (SessionStatus::Renewed, Some(state)) => { - res.checked_expr(|res| inner.set_cookie(res, state)) - } - (SessionStatus::Unchanged, Some(state)) if prolong_expiration => { - res.checked_expr(|res| inner.set_cookie(res, state)) - } - (SessionStatus::Unchanged, _) => - // set a new session cookie upon first request (new client) - { - if is_new { - let state: HashMap<String, String> = HashMap::new(); - res.checked_expr(|res| { - inner.set_cookie(res, state.into_iter()) - }) - } else { - res - } - } - (SessionStatus::Purged, _) => { - let _ = inner.remove_cookie(&mut res); + Box::pin(async move { + let mut res = fut.await?; + + let res = match Session::get_changes(&mut res) { + (SessionStatus::Changed, state) | (SessionStatus::Renewed, state) => { + res.checked_expr(|res| inner.set_cookie(res, state)) + } + + (SessionStatus::Unchanged, state) if prolong_expiration => { + res.checked_expr(|res| inner.set_cookie(res, state)) + } + + // set a new session cookie upon first request (new client) + (SessionStatus::Unchanged, _) => { + if is_new { + let state: HashMap<String, String> = HashMap::new(); + res.checked_expr(|res| inner.set_cookie(res, state.into_iter())) + } else { res } - _ => res, } - }) - } - .boxed_local() + + (SessionStatus::Purged, _) => { + let _ = inner.remove_cookie(&mut res); + res + } + }; + + Ok(res) + }) } } @@ -940,7 +944,7 @@ App::new() .wrap(CookieSession::signed(&[0; 32]).secure(false)) .service(web::resource("/").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "test" })), ) @@ -960,7 +964,7 @@ App::new() .wrap(CookieSession::private(&[0; 32]).secure(false)) .service(web::resource("/").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "test" })), ) @@ -980,7 +984,7 @@ App::new() .wrap(CookieSession::signed(&[0; 32]).secure(false).lazy(true)) .service(web::resource("/count").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "counting" })) .service(web::resource("/").to(|_ses: Session| async move { "test" })), @@ -1006,7 +1010,7 @@ App::new() .wrap(CookieSession::signed(&[0; 32]).secure(false)) .service(web::resource("/").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "test" })), ) @@ -1034,7 +1038,7 @@ .max_age(100), ) .service(web::resource("/").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "test" })) .service(web::resource("/test/").to(|ses: Session| async move { @@ -1067,7 +1071,7 @@ App::new() .wrap(CookieSession::signed(&[0; 32]).secure(false).expires_in(60)) .service(web::resource("/").to(|ses: Session| async move { - let _ = ses.set("counter", 100); + let _ = ses.insert("counter", 100); "test" })) .service( diff --git a/src/actix_session/lib.rs.html b/src/actix_session/lib.rs.html index 0ab345162..b1bf63c0c 100644 --- a/src/actix_session/lib.rs.html +++ b/src/actix_session/lib.rs.html @@ -333,6 +333,85 @@ 330 331 332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411
//! Sessions for Actix Web. //! @@ -354,9 +433,9 @@ //! // access session data //! if let Some(count) = session.get::<i32>("counter")? { //! println!("SESSION value: {}", count); -//! session.set("counter", count + 1)?; +//! session.insert("counter", count + 1)?; //! } else { -//! session.set("counter", 1)?; +//! session.insert("counter", 1)?; //! } //! //! Ok("Welcome!") @@ -375,21 +454,27 @@ //! } //! ``` -#![deny(rust_2018_idioms)] +#![deny(rust_2018_idioms, nonstandard_style)] +#![warn(missing_docs)] -use std::{cell::RefCell, collections::HashMap, rc::Rc}; - -use actix_web::dev::{ - Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse, +use std::{ + cell::{Ref, RefCell}, + collections::HashMap, + mem, + rc::Rc, +}; + +use actix_web::{ + dev::{Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse}, + Error, FromRequest, HttpMessage, HttpRequest, }; -use actix_web::{Error, FromRequest, HttpMessage, HttpRequest}; use futures_util::future::{ok, Ready}; use serde::{de::DeserializeOwned, Serialize}; #[cfg(feature = "cookie-session")] mod cookie; #[cfg(feature = "cookie-session")] -pub use crate::cookie::CookieSession; +pub use self::cookie::CookieSession; /// The high-level interface you use to modify session data. /// @@ -403,9 +488,9 @@ /// async fn index(session: Session) -> Result<&'static str> { /// // access session data /// if let Some(count) = session.get::<i32>("counter")? { -/// session.set("counter", count + 1)?; +/// session.insert("counter", count + 1)?; /// } else { -/// session.set("counter", 1)?; +/// session.insert("counter", 1)?; /// } /// /// Ok("Welcome!") @@ -415,6 +500,7 @@ /// Extraction of a [`Session`] object. pub trait UserSession { + /// Extract the [`Session`] object fn get_session(&self) -> Session; } @@ -436,13 +522,31 @@ } } +/// Status of a [`Session`]. #[derive(PartialEq, Clone, Debug)] pub enum SessionStatus { + /// Session has been updated and requires a new persist operation. Changed, + + /// Session is flagged for deletion and should be removed from client and server. + /// + /// Most operations on the session after purge flag is set should have no effect. Purged, + + /// Session is flagged for refresh. + /// + /// For example, when using a backend that has a TTL (time-to-live) expiry on the session entry, + /// the session will be refreshed even if no data inside it has changed. The client may also + /// be notified of the refresh. Renewed, + + /// Session is unchanged from when last seen (if exists). + /// + /// This state also captures new (previously unissued) sessions such as a user's first + /// site visit. Unchanged, } + impl Default for SessionStatus { fn default() -> SessionStatus { SessionStatus::Unchanged @@ -452,7 +556,7 @@ #[derive(Default)] struct SessionInner { state: HashMap<String, String>, - pub status: SessionStatus, + status: SessionStatus, } impl Session { @@ -465,37 +569,80 @@ } } - /// Set a `value` from the session. - pub fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error> { + /// Get all raw key-value data from the session. + /// + /// Note that values are JSON encoded. + pub fn entries(&self) -> Ref<'_, HashMap<String, String>> { + Ref::map(self.0.borrow(), |inner| &inner.state) + } + + /// Inserts a key-value pair into the session. + /// + /// Any serializable value can be used and will be encoded as JSON in session data, hence why + /// only a reference to the value is taken. + pub fn insert( + &self, + key: impl Into<String>, + value: impl Serialize, + ) -> Result<(), Error> { let mut inner = self.0.borrow_mut(); + if inner.status != SessionStatus::Purged { inner.status = SessionStatus::Changed; - inner - .state - .insert(key.to_owned(), serde_json::to_string(&value)?); + let val = serde_json::to_string(&value)?; + inner.state.insert(key.into(), val); } + Ok(()) } /// Remove value from the session. - pub fn remove(&self, key: &str) { + /// + /// If present, the JSON encoded value is returned. + pub fn remove(&self, key: &str) -> Option<String> { let mut inner = self.0.borrow_mut(); + if inner.status != SessionStatus::Purged { inner.status = SessionStatus::Changed; - inner.state.remove(key); + return inner.state.remove(key); } + + None + } + + /// Remove value from the session and deserialize. + /// + /// Returns None if key was not present in session. Returns T if deserialization succeeds, + /// otherwise returns un-deserialized JSON string. + pub fn remove_as<T: DeserializeOwned>( + &self, + key: &str, + ) -> Option<Result<T, String>> { + self.remove(key) + .map(|val_str| match serde_json::from_str(&val_str) { + Ok(val) => Ok(val), + Err(_err) => { + log::debug!( + "removed value (key: {}) could not be deserialized as {}", + key, + std::any::type_name::<T>() + ); + Err(val_str) + } + }) } /// Clear the session. pub fn clear(&self) { let mut inner = self.0.borrow_mut(); + if inner.status != SessionStatus::Purged { inner.status = SessionStatus::Changed; inner.state.clear() } } - /// Removes session, both client and server side. + /// Removes session both client and server side. pub fn purge(&self) { let mut inner = self.0.borrow_mut(); inner.status = SessionStatus::Purged; @@ -505,6 +652,7 @@ /// Renews the session key, assigning existing session state to new key. pub fn renew(&self) { let mut inner = self.0.borrow_mut(); + if inner.status != SessionStatus::Purged { inner.status = SessionStatus::Renewed; } @@ -522,35 +670,32 @@ /// let mut req = test::TestRequest::default().to_srv_request(); /// /// Session::set_session( - /// vec![("counter".to_string(), serde_json::to_string(&0).unwrap())], /// &mut req, + /// vec![("counter".to_string(), serde_json::to_string(&0).unwrap())], /// ); /// ``` pub fn set_session( - data: impl IntoIterator<Item = (String, String)>, req: &mut ServiceRequest, + data: impl IntoIterator<Item = (String, String)>, ) { let session = Session::get_session(&mut *req.extensions_mut()); let mut inner = session.0.borrow_mut(); inner.state.extend(data); } + /// Returns session status and iterator of key-value pairs of changes. pub fn get_changes<B>( res: &mut ServiceResponse<B>, - ) -> ( - SessionStatus, - Option<impl Iterator<Item = (String, String)>>, - ) { + ) -> (SessionStatus, impl Iterator<Item = (String, String)>) { if let Some(s_impl) = res .request() .extensions() .get::<Rc<RefCell<SessionInner>>>() { - let state = - std::mem::replace(&mut s_impl.borrow_mut().state, HashMap::new()); - (s_impl.borrow().status.clone(), Some(state.into_iter())) + let state = mem::take(&mut s_impl.borrow_mut().state); + (s_impl.borrow().status.clone(), state.into_iter()) } else { - (SessionStatus::Unchanged, None) + (SessionStatus::Unchanged, HashMap::new().into_iter()) } } @@ -566,21 +711,23 @@ /// Extractor implementation for Session type. /// -/// ```rust +/// # Examples +/// ``` /// # use actix_web::*; /// use actix_session::Session; /// -/// fn index(session: Session) -> Result<&'static str> { +/// #[get("/")] +/// async fn index(session: Session) -> Result<impl Responder> { /// // access session data /// if let Some(count) = session.get::<i32>("counter")? { -/// session.set("counter", count + 1)?; +/// session.insert("counter", count + 1)?; /// } else { -/// session.set("counter", 1)?; +/// session.insert("counter", 1)?; /// } /// -/// Ok("Welcome!") +/// let count = session.get::<i32>("counter")?.unwrap(); +/// Ok(format!("Counter: {}", count)) /// } -/// # fn main() {} /// ``` impl FromRequest for Session { type Error = Error; @@ -604,19 +751,19 @@ let mut req = test::TestRequest::default().to_srv_request(); Session::set_session( - vec![("key".to_string(), serde_json::to_string("value").unwrap())], &mut req, + vec![("key".to_string(), serde_json::to_string("value").unwrap())], ); let session = Session::get_session(&mut *req.extensions_mut()); let res = session.get::<String>("key").unwrap(); assert_eq!(res, Some("value".to_string())); - session.set("key2", "value2".to_string()).unwrap(); + session.insert("key2", "value2").unwrap(); session.remove("key"); let mut res = req.into_response(HttpResponse::Ok().finish()); let (_status, state) = Session::get_changes(&mut res); - let changes: Vec<_> = state.unwrap().collect(); + let changes: Vec<_> = state.collect(); assert_eq!(changes, [("key2".to_string(), "\"value2\"".to_string())]); } @@ -625,8 +772,8 @@ let mut req = test::TestRequest::default().to_srv_request(); Session::set_session( - vec![("key".to_string(), serde_json::to_string(&true).unwrap())], &mut req, + vec![("key".to_string(), serde_json::to_string(&true).unwrap())], ); let session = req.get_session(); @@ -639,8 +786,8 @@ let mut req = test::TestRequest::default().to_srv_request(); Session::set_session( - vec![("key".to_string(), serde_json::to_string(&10).unwrap())], &mut req, + vec![("key".to_string(), serde_json::to_string(&10).unwrap())], ); let session = req.head_mut().get_session(); @@ -665,6 +812,17 @@ session.renew(); assert_eq!(session.0.borrow().status, SessionStatus::Renewed); } + + #[test] + fn session_entries() { + let session = Session(Rc::new(RefCell::new(SessionInner::default()))); + session.insert("test_str", "val").unwrap(); + session.insert("test_num", 1).unwrap(); + + let map = session.entries(); + map.contains_key("test_str"); + map.contains_key("test_num"); + } }