feat: complete Epic 1 production foundation
This commit is contained in:
@@ -40,6 +40,15 @@ pub enum AuthConfig {
|
||||
}
|
||||
|
||||
impl AuthConfig {
|
||||
pub const fn kind(&self) -> AuthKind {
|
||||
match self {
|
||||
Self::Bearer(_) => AuthKind::Bearer,
|
||||
Self::Basic(_) => AuthKind::Basic,
|
||||
Self::ApiKeyHeader(_) => AuthKind::ApiKeyHeader,
|
||||
Self::ApiKeyQuery(_) => AuthKind::ApiKeyQuery,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn secret_ids(&self) -> Vec<&SecretId> {
|
||||
match self {
|
||||
Self::Bearer(config) => vec![&config.secret_id],
|
||||
@@ -94,4 +103,16 @@ mod tests {
|
||||
assert_eq!(value["created_at"], json!("2026-03-25T12:00:00Z"));
|
||||
assert_eq!(value["updated_at"], json!("2026-03-25T12:05:00Z"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auth_config_reports_its_semantic_kind() {
|
||||
assert_eq!(
|
||||
AuthConfig::ApiKeyHeader(ApiKeyHeaderAuthConfig {
|
||||
header_name: "X-Api-Key".to_owned(),
|
||||
secret_id: SecretId::new("secret_01"),
|
||||
})
|
||||
.kind(),
|
||||
AuthKind::ApiKeyHeader
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user