pub struct AuthConfig {
pub expected: Arc<Option<String>>,
/* private fields */
}Expand description
Optional bearer-auth state. None ⇒ no auth required.
Fields§
§expected: Arc<Option<String>>Expected Bearer API key token wrapped in an Arc. If None, authentication is disabled.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn new(expected: Option<String>) -> Self
pub fn new(expected: Option<String>) -> Self
Construct a new AuthConfig with the specified optional expected API key token.
Sourcepub fn resolve_api_key_with<F>(get_env: F) -> Option<String>
pub fn resolve_api_key_with<F>(get_env: F) -> Option<String>
Resolve an API key by consulting environment lookup closure.
OPENDECISION_API_KEY and OPENPICK_API_KEY remain deprecated fallbacks
so that upgrading a deployment cannot silently disable authentication.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Construct AuthConfig by resolving from the supported API-key environment variables.
Sourcepub fn is_required(&self) -> bool
pub fn is_required(&self) -> bool
Returns true if authentication is required (an expected API key is configured).
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin for AuthConfig
impl UnwindSafe for AuthConfig
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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