pub struct ApiKeyAuthenticator { /* private fields */ }Expand description
Authenticates requests via API key with constant-time comparison.
Uses ring::constant_time::verify_slices_are_equal to prevent timing
side-channel attacks during key comparison.
§Examples
use secure_identity::api_key::ApiKeyAuthenticator;
use security_core::types::ActorId;
use uuid::Uuid;
let authenticator = ApiKeyAuthenticator::new(
"secret-api-key".to_string(),
ActorId::from(Uuid::new_v4()),
vec!["reader".to_string()],
);Implementations§
Trait Implementations§
Source§impl Authenticator for ApiKeyAuthenticator
impl Authenticator for ApiKeyAuthenticator
Source§async fn authenticate(
&self,
request: &AuthenticationRequest,
) -> Result<AuthenticatedIdentity, IdentityError>
async fn authenticate( &self, request: &AuthenticationRequest, ) -> Result<AuthenticatedIdentity, IdentityError>
Authenticates the given request and returns an
security_core::identity::AuthenticatedIdentity on success.Auto Trait Implementations§
impl Freeze for ApiKeyAuthenticator
impl RefUnwindSafe for ApiKeyAuthenticator
impl Send for ApiKeyAuthenticator
impl Sync for ApiKeyAuthenticator
impl Unpin for ApiKeyAuthenticator
impl UnsafeUnpin for ApiKeyAuthenticator
impl UnwindSafe for ApiKeyAuthenticator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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