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<'_> ⓘ
pub fn peer_identity(&self) -> AuthPropertyIter<'_> ⓘ
AuthContext[peer_identity_property_name()]
There may be several of them (for instance if x509_subject_alternative_name
is selected)