pub trait AuthenticationProvider: Send + Sync {
// Required methods
fn auth_credentials(&self) -> &Credentials;
fn auth_realm(&self) -> &str;
fn bearer_token(&self) -> Option<&str>;
// Provided methods
fn is_basic_auth_enabled(&self) -> bool { ... }
fn is_bearer_auth_enabled(&self) -> bool { ... }
fn is_auth_enabled(&self) -> bool { ... }
fn forward_authorization_header(&self) -> bool { ... }
}Expand description
Configuration for HTTP Basic Authentication and Bearer Token.
Implement this trait to enable optional authentication.
Required Methods§
Sourcefn auth_credentials(&self) -> &Credentials
fn auth_credentials(&self) -> &Credentials
Returns the list of authentication credentials for Basic Auth.
Sourcefn auth_realm(&self) -> &str
fn auth_realm(&self) -> &str
Returns the realm for WWW-Authenticate header.
Sourcefn bearer_token(&self) -> Option<&str>
fn bearer_token(&self) -> Option<&str>
Returns the bearer token, if configured.
Provided Methods§
Sourcefn is_basic_auth_enabled(&self) -> bool
fn is_basic_auth_enabled(&self) -> bool
Returns true if Basic Auth is enabled (credentials configured).
Sourcefn is_bearer_auth_enabled(&self) -> bool
fn is_bearer_auth_enabled(&self) -> bool
Returns true if Bearer Token auth is enabled.
Sourcefn is_auth_enabled(&self) -> bool
fn is_auth_enabled(&self) -> bool
Returns true if any authentication is enabled.
Whether to forward the Authorization header to the upstream service.
Default: false. When wisegate has performed authentication, the
credentials have already served their purpose, and forwarding them
leaks secrets to every downstream service. Set to true only when
the upstream genuinely needs to re-validate the same credentials.
When authentication is disabled (is_auth_enabled() == false), this
setting has no effect: the header passes through transparently.