Struct grpcio::AuthContext
source · [−]pub struct AuthContext { /* private fields */ }
Expand description
To perform server-side authentication, gRPC exposes the authentication context for each call. The context exposes important authentication-related information about the RPC such as the type of security/authentication type being used and the peer identity.
The authentication context is structured as a multi-map of key-value pairs - the auth properties. In addition to that, for authenticated RPCs, the set of properties corresponding to a selected key will represent the verified identity of the caller - the peer identity.
The contents of the auth properties are populated by an auth interceptor within
gRPC Core. The interceptor also chooses which property key will act as the peer
identity (e.g. for client certificate authentication this property will be
x509_common_name
or x509_subject_alternative_name
).
Implementations
sourceimpl AuthContext
impl AuthContext
Binding to gRPC Core AuthContext
sourcepub fn peer_identity_property_name(&self) -> Option<&str>
pub fn peer_identity_property_name(&self) -> Option<&str>
The name of the property gRPC Core has chosen as main peer identity property, if any.
sourcepub fn peer_is_authenticated(&self) -> bool
pub fn peer_is_authenticated(&self) -> bool
true
if the client has provided a valid certificate (or other auth method
considered valid by gRPC).
false
in non-secure scenarios.
sourcepub fn peer_identity(&self) -> AuthPropertyIter<'_>ⓘNotable traits for AuthPropertyIter<'a>impl<'a> Iterator for AuthPropertyIter<'a> type Item = AuthProperty<'a>;
pub fn peer_identity(&self) -> AuthPropertyIter<'_>ⓘNotable traits for AuthPropertyIter<'a>impl<'a> Iterator for AuthPropertyIter<'a> type Item = AuthProperty<'a>;
AuthContext[peer_identity_property_name()]
There may be several of them (for instance if x509_subject_alternative_name
is selected)
Trait Implementations
sourceimpl Drop for AuthContext
impl Drop for AuthContext
sourceimpl<'a> IntoIterator for &'a AuthContext
impl<'a> IntoIterator for &'a AuthContext
type Item = AuthProperty<'a>
type Item = AuthProperty<'a>
The type of the elements being iterated over.
type IntoIter = AuthPropertyIter<'a>
type IntoIter = AuthPropertyIter<'a>
Which kind of iterator are we turning this into?
Auto Trait Implementations
impl RefUnwindSafe for AuthContext
impl !Send for AuthContext
impl !Sync for AuthContext
impl Unpin for AuthContext
impl UnwindSafe for AuthContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more