#[non_exhaustive]pub enum StaticTokenDecision {
StaticAndOAuth(String),
StaticOnly(String),
OAuthOnly,
StaticIgnored,
Unauthenticated,
}Expand description
The outcome of static_token_policy.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StaticAndOAuth(String)
Dual mode: the static token and OAuth access tokens are both accepted.
StaticOnly(String)
Only the static token protects the routes (OAuth is off).
OAuthOnly
Only OAuth access tokens are accepted; no static token was configured.
StaticIgnored
A static token was configured but OAuth’s
accept_static_bearer is
false, so it is ignored and only OAuth access tokens are accepted.
Unauthenticated
Nothing is configured and the caller explicitly allowed unauthenticated
access: the routes are open. Build the pass-through deliberately (with the
axum feature, AuthLayer::allow_unauthenticated) and say so loudly at
startup.
Implementations§
Source§impl StaticTokenDecision
impl StaticTokenDecision
Sourcepub fn oauth_enabled(&self) -> bool
pub fn oauth_enabled(&self) -> bool
Whether the decision was made with OAuth on (a resolved OAuth config was
passed to static_token_policy), i.e. whether an OAuth validator must
accompany it.
Sourcepub fn static_token(&self) -> Option<&str>
pub fn static_token(&self) -> Option<&str>
The static token to accept, if any.
Sourcepub fn into_static_token(self) -> Option<String>
pub fn into_static_token(self) -> Option<String>
Consume the decision, yielding the static token to accept, if any.
Trait Implementations§
Source§impl Clone for StaticTokenDecision
impl Clone for StaticTokenDecision
Source§impl Debug for StaticTokenDecision
Hand-written so the token itself never reaches a log line through {:?}.
impl Debug for StaticTokenDecision
Hand-written so the token itself never reaches a log line through {:?}.