pub struct AuthConfig {
pub auth_type: String,
pub credentials: HashMap<String, SecretString>,
}Expand description
Authentication configuration for remote forwarding
Specifies the authentication method and credentials to use when forwarding messages to remote OTLP endpoints.
§Supported Authentication Types
-
api_key: API key authentication with custom header name- Required credentials:
key - Optional credentials:
header_name(default:X-API-Key)
- Required credentials:
-
bearer_token: Bearer token authentication- Required credentials:
token
- Required credentials:
-
basic: HTTP Basic authentication- Required credentials:
username,password
- Required credentials:
§Example
use otlp_arrow_library::AuthConfig;
use secrecy::SecretString;
use std::collections::HashMap;
let mut credentials = HashMap::new();
credentials.insert("token".to_string(), SecretString::new("my-bearer-token".to_string()));
let auth = AuthConfig {
auth_type: "bearer_token".to_string(),
credentials,
};§Breaking Changes
As of version 0.4.0, credentials values are SecretString instead of String.
When creating AuthConfig programmatically, use SecretString::new().
YAML and environment variable loading automatically converts strings to SecretString.
Security Note: Credentials are stored using SecretString to prevent exposure in logs,
error messages, or memory dumps. Credentials are zeroed in memory when dropped.
Credentials are NOT serialized for security reasons - they must be provided via environment
variables or programmatic configuration.
Fields§
§auth_type: StringType of authentication (e.g., “api_key”, “bearer_token”, “basic”)
credentials: HashMap<String, SecretString>Authentication parameters (e.g., token, key, username, password) Stored as SecretString to prevent exposure in logs, errors, or memory dumps.
Required credentials by auth type:
api_key: requireskeycredentialbearer_token: requirestokencredentialbasic: requiresusernameandpasswordcredentials
Security: Credentials are NOT serialized (skipped during serialization) to prevent accidental exposure in configuration files or logs.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn validate(&self) -> Result<(), OtlpConfigError>
pub fn validate(&self) -> Result<(), OtlpConfigError>
Validate authentication configuration
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthConfig
impl Debug for AuthConfig
Source§impl<'de> Deserialize<'de> for AuthConfig
impl<'de> Deserialize<'de> for AuthConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnwindSafe for AuthConfig
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
T in a tonic::Request