mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 15:51:06 +01:00
standardize future types to ones from actix_utils
This commit is contained in:
parent
ec66754c0d
commit
56051786a6
@ -17,8 +17,9 @@ name = "actix_cors"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-web = { version = "4.0.0-beta.10", default-features = false }
|
||||
actix-service = "2.0.0"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.10", default-features = false }
|
||||
|
||||
derive_more = "0.99.5"
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
@ -28,5 +29,5 @@ smallvec = "1.6"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "2"
|
||||
pretty_env_logger = "0.4"
|
||||
env_logger = "0.9"
|
||||
regex = "1.4"
|
||||
|
@ -3,7 +3,7 @@ use actix_web::{http::header, web, App, HttpServer};
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
pretty_env_logger::init();
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
|
@ -2,6 +2,7 @@ use std::{
|
||||
collections::HashSet, convert::TryInto, error::Error as StdError, iter::FromIterator, rc::Rc,
|
||||
};
|
||||
|
||||
use actix_utils::future::{self, Ready};
|
||||
use actix_web::{
|
||||
body::MessageBody,
|
||||
dev::{RequestHead, Service, ServiceRequest, ServiceResponse, Transform},
|
||||
@ -9,7 +10,6 @@ use actix_web::{
|
||||
http::{self, header::HeaderName, Error as HttpError, HeaderValue, Method, Uri},
|
||||
Either,
|
||||
};
|
||||
use futures_util::future::{self, Ready};
|
||||
use log::error;
|
||||
use once_cell::sync::Lazy;
|
||||
use smallvec::smallvec;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::{collections::HashSet, convert::TryInto, error::Error as StdError, rc::Rc};
|
||||
|
||||
use actix_utils::future::{ok, Either, Ready};
|
||||
use actix_web::{
|
||||
body::{AnyBody, MessageBody},
|
||||
dev::{Service, ServiceRequest, ServiceResponse},
|
||||
@ -10,7 +11,7 @@ use actix_web::{
|
||||
},
|
||||
HttpResponse,
|
||||
};
|
||||
use futures_util::future::{ok, Either, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _};
|
||||
use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _};
|
||||
use log::debug;
|
||||
|
||||
use crate::{builder::intersperse_header_values, AllOrSome, Inner};
|
||||
@ -155,7 +156,7 @@ where
|
||||
if self.inner.preflight && req.method() == Method::OPTIONS {
|
||||
let inner = Rc::clone(&self.inner);
|
||||
let res = Self::handle_preflight(&inner, req);
|
||||
Either::Left(ok(res))
|
||||
Either::left(ok(res))
|
||||
} else {
|
||||
let origin = req.headers().get(header::ORIGIN).cloned();
|
||||
|
||||
@ -163,7 +164,7 @@ where
|
||||
// Only check requests with a origin header.
|
||||
if let Err(err) = self.inner.validate_origin(req.head()) {
|
||||
debug!("origin validation failed; inner service is not called");
|
||||
return Either::Left(ok(req.error_response(err)));
|
||||
return Either::left(ok(req.error_response(err)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ where
|
||||
.map_ok(|res| res.map_body(|_, body| AnyBody::new_boxed(body)))
|
||||
.boxed_local();
|
||||
|
||||
Either::Right(res)
|
||||
Either::right(res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
use actix_service::fn_service;
|
||||
use actix_utils::future::ok;
|
||||
use actix_web::{
|
||||
dev::{ServiceRequest, Transform},
|
||||
http::{header, HeaderValue, Method, StatusCode},
|
||||
test::{self, TestRequest},
|
||||
HttpResponse,
|
||||
};
|
||||
use futures_util::future::ok;
|
||||
use regex::bytes::Regex;
|
||||
|
||||
use actix_cors::Cors;
|
||||
|
@ -5,7 +5,7 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Identity service for Actix web"
|
||||
keywords = ["actix", "auth", "identity", "web", "security"]
|
||||
homepage = "https://actix.rs"
|
||||
repository = "https://github.com/actix/actix-extras"
|
||||
repository = "https://github.com/actix/actix-extras.git"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2018"
|
||||
|
||||
@ -15,6 +15,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-service = "2.0.0"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.10", default-features = false, features = ["cookies", "secure-cookies"] }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
serde = "1.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{rc::Rc, time::SystemTime};
|
||||
|
||||
use futures_util::future::{ready, Ready};
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::Duration;
|
||||
|
||||
|
@ -2,7 +2,7 @@ use actix_web::{
|
||||
dev::{Extensions, Payload},
|
||||
Error, FromRequest, HttpRequest,
|
||||
};
|
||||
use futures_util::future::{ready, Ready};
|
||||
use actix_utils::future::{ready, Ready};
|
||||
|
||||
pub(crate) struct IdentityItem {
|
||||
pub(crate) id: Option<String>,
|
||||
|
@ -1,11 +1,12 @@
|
||||
use std::{error::Error as StdError, rc::Rc};
|
||||
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use actix_web::{
|
||||
body::{AnyBody, MessageBody},
|
||||
dev::{Service, ServiceRequest, ServiceResponse, Transform},
|
||||
Error, HttpMessage, Result,
|
||||
};
|
||||
use futures_util::future::{ready, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _};
|
||||
use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _};
|
||||
|
||||
use crate::{identity::IdentityItem, IdentityPolicy};
|
||||
|
||||
@ -129,7 +130,8 @@ mod tests {
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn test_borrowed_mut_error() {
|
||||
use futures_util::future::{lazy, ok, Ready};
|
||||
use actix_utils::future::{ok, Ready};
|
||||
use futures_util::future::lazy;
|
||||
|
||||
struct Ident;
|
||||
impl IdentityPolicy for Ident {
|
||||
|
@ -9,7 +9,7 @@ authors = [
|
||||
description = "Protobuf support for Actix web"
|
||||
keywords = ["actix", "protobuf", "protocol", "rpc"]
|
||||
homepage = "https://actix.rs"
|
||||
repository = "https://github.com/actix/actix-extras"
|
||||
repository = "https://github.com/actix/actix-extras.git"
|
||||
license = "MIT OR Apache-2.0"
|
||||
exclude = [".cargo/config", "/examples/**"]
|
||||
|
||||
|
@ -6,7 +6,7 @@ description = "Redis integration for Actix and session store for Actix Web"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["actix", "redis", "async", "session"]
|
||||
homepage = "https://actix.rs"
|
||||
repository = "https://github.com/actix/actix-extras"
|
||||
repository = "https://github.com/actix/actix-extras.git"
|
||||
categories = ["network-programming", "asynchronous"]
|
||||
exclude = [".cargo/config"]
|
||||
edition = "2018"
|
||||
|
@ -5,7 +5,7 @@ authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Sessions for Actix web"
|
||||
keywords = ["http", "web", "framework", "async", "session"]
|
||||
homepage = "https://actix.rs"
|
||||
repository = "https://github.com/actix/actix-extras"
|
||||
repository = "https://github.com/actix/actix-extras.git"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2018"
|
||||
|
||||
@ -18,8 +18,9 @@ default = ["cookie-session"]
|
||||
cookie-session = ["actix-web/secure-cookies"]
|
||||
|
||||
[dependencies]
|
||||
actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] }
|
||||
actix-service = "2.0.0"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] }
|
||||
|
||||
derive_more = "0.99.5"
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use std::{collections::HashMap, error::Error as StdError, rc::Rc};
|
||||
|
||||
use actix_utils::future::{ok, Ready};
|
||||
use actix_web::{
|
||||
body::{AnyBody, MessageBody},
|
||||
cookie::{Cookie, CookieJar, Key, SameSite},
|
||||
@ -10,7 +11,7 @@ use actix_web::{
|
||||
Error, ResponseError,
|
||||
};
|
||||
use derive_more::Display;
|
||||
use futures_util::future::{ok, FutureExt as _, LocalBoxFuture, Ready};
|
||||
use futures_util::future::{FutureExt as _, LocalBoxFuture};
|
||||
use serde_json::error::Error as JsonError;
|
||||
use time::{Duration, OffsetDateTime};
|
||||
|
||||
|
@ -49,11 +49,11 @@ use std::{
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
use actix_utils::future::{ok, Ready};
|
||||
use actix_web::{
|
||||
dev::{Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse},
|
||||
Error, FromRequest, HttpMessage, HttpRequest,
|
||||
};
|
||||
use futures_util::future::{ok, Ready};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
|
||||
#[cfg(feature = "cookie-session")]
|
||||
|
@ -18,10 +18,13 @@ name = "actix_web_httpauth"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-web = { version = "4.0.0-beta.10", default_features = false }
|
||||
actix-service = "2.0.0"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.10", default_features = false }
|
||||
|
||||
base64 = "0.13"
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
pin-project-lite = "0.2.7"
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use actix_web::dev::{Payload, ServiceRequest};
|
||||
use actix_web::http::header::Header;
|
||||
use actix_web::{FromRequest, HttpRequest};
|
||||
use futures_util::future::{ready, Ready};
|
||||
|
||||
use super::config::AuthExtractorConfig;
|
||||
use super::errors::AuthenticationError;
|
||||
|
@ -1,19 +1,17 @@
|
||||
//! Extractor for the "Bearer" HTTP Authentication Scheme
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::default::Default;
|
||||
use std::{borrow::Cow, default::Default};
|
||||
|
||||
use actix_web::dev::{Payload, ServiceRequest};
|
||||
use actix_web::http::header::Header;
|
||||
use actix_web::{FromRequest, HttpRequest};
|
||||
use futures_util::future::{ready, Ready};
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use actix_web::{
|
||||
dev::{Payload, ServiceRequest},
|
||||
http::header::Header,
|
||||
FromRequest, HttpRequest,
|
||||
};
|
||||
|
||||
use super::config::AuthExtractorConfig;
|
||||
use super::errors::AuthenticationError;
|
||||
use super::AuthExtractor;
|
||||
use crate::headers::authorization;
|
||||
use crate::headers::www_authenticate::bearer;
|
||||
use super::{config::AuthExtractorConfig, errors::AuthenticationError, AuthExtractor};
|
||||
pub use crate::headers::www_authenticate::bearer::Error;
|
||||
use crate::headers::{authorization, www_authenticate::bearer};
|
||||
|
||||
/// [BearerAuth](./struct/BearerAuth.html) extractor configuration.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
@ -8,7 +8,7 @@ use std::{
|
||||
|
||||
use actix_web::dev::ServiceRequest;
|
||||
use actix_web::Error;
|
||||
use futures_util::ready;
|
||||
use futures_core::ready;
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pub mod basic;
|
||||
|
@ -1,7 +1,13 @@
|
||||
//! HTTP Authentication middleware.
|
||||
|
||||
use std::{
|
||||
error::Error as StdError, future::Future, marker::PhantomData, pin::Pin, rc::Rc, sync::Arc,
|
||||
error::Error as StdError,
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
pin::Pin,
|
||||
rc::Rc,
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use actix_web::{
|
||||
@ -9,11 +15,8 @@ use actix_web::{
|
||||
dev::{Service, ServiceRequest, ServiceResponse, Transform},
|
||||
Error,
|
||||
};
|
||||
use futures_util::{
|
||||
future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _},
|
||||
ready,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
use futures_core::ready;
|
||||
use futures_util::future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _};
|
||||
|
||||
use crate::extractors::{basic, bearer, AuthExtractor};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user