Crate actix_identity
source · [−]Expand description
Expand description
Opinionated request identity service for Actix Web apps.
IdentityService
middleware can be used with different policies types to store
identity information.
A cookie based policy is provided. CookieIdentityPolicy
uses cookies as identity storage.
Trait actix_identity::IdentityPolicy
source · [−]pub trait IdentityPolicy: Sized + 'static {
+ Trait actix_identity::IdentityPolicy
source · [−]
pub trait IdentityPolicy: Sized + 'static {
type Future: Future<Output = Result<Option<String>, Error>>;
type ResponseFuture: Future<Output = Result<(), Error>>;
fn from_request(&self, req: &mut ServiceRequest) -> Self::Future;
@@ -12,7 +12,7 @@
}
Expand description
Identity policy.
Associated Types
type ResponseFuture: Future<Output = Result<(), Error>>
type ResponseFuture: Future<Output = Result<(), Error>>
The return type of the middleware
-Required methods
fn from_request(&self, req: &mut ServiceRequest) -> Self::Future
fn from_request(&self, req: &mut ServiceRequest) -> Self::Future
Parse the session from request and load data from a service identity.
-fn to_response<B>(
&self,
identity: Option<String>,
changed: bool,
response: &mut ServiceResponse<B>
) -> Self::ResponseFuture
fn to_response<B>(
&self,
identity: Option<String>,
changed: bool,
response: &mut ServiceResponse<B>
) -> Self::ResponseFuture
Write changes to response
+Required methods
fn from_request(&self, req: &mut ServiceRequest) -> Self::Future
fn from_request(&self, req: &mut ServiceRequest) -> Self::Future
Parse the session from request and load data from a service identity.
+fn to_response<B>(
&self,
identity: Option<String>,
changed: bool,
response: &mut ServiceResponse<B>
) -> Self::ResponseFuture
fn to_response<B>(
&self,
identity: Option<String>,
changed: bool,
response: &mut ServiceResponse<B>
) -> Self::ResponseFuture
Write changes to response