pub struct AuthorizationCheck {
pub user_agent: UserAgentInfo,
}Expand description
Verifies the request authorization via the authorization header.
The expected token is the HMAC-SHA256 hash of the UAID, signed with one of the available keys (allows for key rotation). NOTE: This is ONLY for internal calls that require authorization and should NOT be used by calls that are using VAPID authentication (e.g. subscription provider endpoints)
Fields§
§user_agent: UserAgentInfoImplementations§
Source§impl AuthorizationCheck
impl AuthorizationCheck
pub fn generate_token(auth_key: &str, user: &Uuid) -> Result<String, ErrorStack>
pub fn validate_token( token: &str, uaid: &Uuid, auth_keys: &[String], user_agent: UserAgentInfo, ) -> Result<Self, ApiError>
Trait Implementations§
Source§impl FromRequest for AuthorizationCheck
impl FromRequest for AuthorizationCheck
Source§type Future = Pin<Box<dyn Future<Output = Result<AuthorizationCheck, <AuthorizationCheck as FromRequest>::Error>>>>
type Future = Pin<Box<dyn Future<Output = Result<AuthorizationCheck, <AuthorizationCheck as FromRequest>::Error>>>>
Future that resolves to a
Self. Read moreSource§fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
Create a
Self from request parts asynchronously.Auto Trait Implementations§
impl Freeze for AuthorizationCheck
impl RefUnwindSafe for AuthorizationCheck
impl Send for AuthorizationCheck
impl Sync for AuthorizationCheck
impl Unpin for AuthorizationCheck
impl UnwindSafe for AuthorizationCheck
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more