pub struct CommandTokenValidator<'a, P: TokenProvider> { /* private fields */ }Expand description
Validador de tokens bearer do runtime.
Implementations§
Source§impl<'a, P: TokenProvider> CommandTokenValidator<'a, P>
impl<'a, P: TokenProvider> CommandTokenValidator<'a, P>
Sourcepub fn new(provider: &'a P, claims: TokenClaims) -> Self
pub fn new(provider: &'a P, claims: TokenClaims) -> Self
Creates a bearer token validator.
Sourcepub fn validate(
&self,
token: &str,
command_name: &str,
now_ms: u64,
) -> Result<(), CommandTokenError>
pub fn validate( &self, token: &str, command_name: &str, now_ms: u64, ) -> Result<(), CommandTokenError>
Validates a command token for one command name.
Sourcepub fn validate_for_purpose(
&self,
token: &str,
expected_purpose: &str,
command_name: Option<&str>,
now_ms: u64,
) -> Result<(), CommandTokenError>
pub fn validate_for_purpose( &self, token: &str, expected_purpose: &str, command_name: Option<&str>, now_ms: u64, ) -> Result<(), CommandTokenError>
Validates a token for an isolated purpose and optional resource name.
Sourcepub fn validate_and_get_claims(
&self,
token: &str,
expected_purpose: &str,
command_name: Option<&str>,
now_ms: u64,
expected_request_hash: Option<&str>,
) -> Result<RuntimeTokenClaims, CommandTokenError>
pub fn validate_and_get_claims( &self, token: &str, expected_purpose: &str, command_name: Option<&str>, now_ms: u64, expected_request_hash: Option<&str>, ) -> Result<RuntimeTokenClaims, CommandTokenError>
Validates a token and returns its trusted claims.
Auto Trait Implementations§
impl<'a, P> Freeze for CommandTokenValidator<'a, P>
impl<'a, P> RefUnwindSafe for CommandTokenValidator<'a, P>where
&'a P: RefUnwindSafe,
impl<'a, P> Send for CommandTokenValidator<'a, P>
impl<'a, P> Sync for CommandTokenValidator<'a, P>
impl<'a, P> Unpin for CommandTokenValidator<'a, P>
impl<'a, P> UnsafeUnpin for CommandTokenValidator<'a, P>where
&'a P: UnsafeUnpin,
impl<'a, P> UnwindSafe for CommandTokenValidator<'a, P>where
&'a P: UnwindSafe,
Blanket Implementations§
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