mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-22 09:21:00 +00:00
Remove verify trait to encourage middleware use
This commit is contained in:
parent
f4139af189
commit
6f0ff4ca5f
2 changed files with 7 additions and 33 deletions
|
@ -18,7 +18,7 @@ pub mod prelude {
|
|||
pub use crate::{
|
||||
middleware::{SignatureVerified, VerifySignature},
|
||||
verify::Unverified,
|
||||
Config, Sign, SignatureVerify, Verify, VerifyError,
|
||||
Config, Sign, SignatureVerify, VerifyError,
|
||||
};
|
||||
|
||||
#[cfg(feature = "digest")]
|
||||
|
@ -29,17 +29,18 @@ pub mod prelude {
|
|||
|
||||
pub use actix_web::http::header::{InvalidHeaderValue, ToStrError};
|
||||
}
|
||||
pub mod verify;
|
||||
pub mod verify {
|
||||
pub use http_signature_normalization::verify::{
|
||||
Algorithm, DeprecatedAlgorithm, ParseSignatureError, ParsedHeader, Unvalidated, Unverified,
|
||||
ValidateError,
|
||||
};
|
||||
}
|
||||
|
||||
use self::{
|
||||
create::Unsigned,
|
||||
verify::{Algorithm, Unverified},
|
||||
};
|
||||
|
||||
pub trait Verify {
|
||||
fn begin_verify(&self, config: &Config) -> Result<Unverified, VerifyError>;
|
||||
}
|
||||
|
||||
pub trait SignatureVerify {
|
||||
type Error: actix_web::ResponseError;
|
||||
type Future: IntoFuture<Item = bool, Error = Self::Error>;
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
use actix_web::{dev::ServiceRequest, HttpRequest};
|
||||
pub use http_signature_normalization::verify::{
|
||||
Algorithm, DeprecatedAlgorithm, ParseSignatureError, ParsedHeader, Unvalidated, Unverified,
|
||||
ValidateError,
|
||||
};
|
||||
|
||||
use crate::{Config, Verify, VerifyError};
|
||||
|
||||
impl Verify for HttpRequest {
|
||||
fn begin_verify(&self, config: &Config) -> Result<Unverified, VerifyError> {
|
||||
config.begin_verify(
|
||||
self.method(),
|
||||
self.uri().path_and_query(),
|
||||
self.headers().clone(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Verify for ServiceRequest {
|
||||
fn begin_verify(&self, config: &Config) -> Result<Unverified, VerifyError> {
|
||||
config.begin_verify(
|
||||
self.method(),
|
||||
self.uri().path_and_query(),
|
||||
self.headers().clone(),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue