mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-27 07:19:04 +02:00
Merge branch 'master' into trait-middleware-mut-self
This commit is contained in:
@ -207,6 +207,7 @@ impl Default for Cors {
|
||||
}
|
||||
|
||||
impl Cors {
|
||||
/// Build a new CORS middleware instance
|
||||
pub fn build() -> CorsBuilder<()> {
|
||||
CorsBuilder {
|
||||
cors: Some(Inner {
|
||||
|
@ -121,10 +121,15 @@ impl<S> RequestIdentity for HttpRequest<S> {
|
||||
|
||||
/// An identity
|
||||
pub trait Identity: 'static {
|
||||
/// Return the claimed identity of the user associated request or
|
||||
/// ``None`` if no identity can be found associated with the request.
|
||||
fn identity(&self) -> Option<&str>;
|
||||
|
||||
/// Remember identity.
|
||||
fn remember(&mut self, key: String);
|
||||
|
||||
/// This method is used to 'forget' the current identity on subsequent
|
||||
/// requests.
|
||||
fn forget(&mut self);
|
||||
|
||||
/// Write session to storage backend.
|
||||
@ -133,7 +138,10 @@ pub trait Identity: 'static {
|
||||
|
||||
/// Identity policy definition.
|
||||
pub trait IdentityPolicy<S>: Sized + 'static {
|
||||
/// The associated identity
|
||||
type Identity: Identity;
|
||||
|
||||
/// The return type of the middleware
|
||||
type Future: Future<Item = Self::Identity, Error = Error>;
|
||||
|
||||
/// Parse the session from request and load data from a service identity.
|
||||
|
@ -103,6 +103,7 @@ use middleware::{Middleware, Response, Started};
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
pub trait RequestSession {
|
||||
/// Get the session from the request
|
||||
fn session(&self) -> Session;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user