pub struct ClientCertAuthMethod { /* private fields */ }Expand description
Application-layer client certificate authenticator.
Validates an X.509 client certificate presented after an mTLS handshake and
extracts a CertIdentity that higher-level code can use to create a session.
§Minimal usage
use auth_framework::methods::client_cert::{ClientCertAuthMethod, ClientCertConfig};
use auth_framework::authentication::credentials::Credential;
let method = ClientCertAuthMethod::new(ClientCertConfig::new());
// `cert_der` comes from your HTTP framework's peer certificate extraction.
let identity = method.authenticate(&Credential::client_cert_from_tls(cert_der))?;Implementations§
Source§impl ClientCertAuthMethod
impl ClientCertAuthMethod
Sourcepub fn new(config: ClientCertConfig) -> Self
pub fn new(config: ClientCertConfig) -> Self
Create a new authenticator with the given configuration.
Sourcepub fn authenticate(&self, credential: &Credential) -> Result<CertIdentity>
pub fn authenticate(&self, credential: &Credential) -> Result<CertIdentity>
Validate credential and return the caller’s certificate identity.
Accepts Credential::Certificate { certificate, .. }. The private_key
field is ignored — key possession was already proved by the TLS
handshake. Use Credential::client_cert_from_tls to construct the
credential without supplying a private key.
Auto Trait Implementations§
impl Freeze for ClientCertAuthMethod
impl RefUnwindSafe for ClientCertAuthMethod
impl Send for ClientCertAuthMethod
impl Sync for ClientCertAuthMethod
impl Unpin for ClientCertAuthMethod
impl UnsafeUnpin for ClientCertAuthMethod
impl UnwindSafe for ClientCertAuthMethod
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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