pub struct Credentials {
pub bearer: Option<String>,
pub client_cert_subject: Option<String>,
}Expand description
Raw credentials extracted from a request, before authentication.
Only the bearer token is populated by Credentials::from_metadata today;
client_cert_subject is the documented seam for mTLS, which tonic exposes
on the request extensions inside the service (not in the interceptor), so a
full wiring fills it in there. Keeping both here lets one provider consume
either without a second extraction path.
Fields§
§bearer: Option<String>Value after Bearer in the authorization metadata, if any.
client_cert_subject: Option<String>Subject (SAN/CN) of a verified client certificate, if mTLS is in use.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn from_metadata(metadata: &MetadataMap) -> Self
pub fn from_metadata(metadata: &MetadataMap) -> Self
Extracts credentials from gRPC request metadata.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Credentials
impl Debug for Credentials
Source§impl Default for Credentials
impl Default for Credentials
Source§fn default() -> Credentials
fn default() -> Credentials
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request