Skip to content

Commit

Permalink
add kerberos authentication provider
Browse files Browse the repository at this point in the history
  • Loading branch information
adwk67 committed Sep 23, 2024
1 parent 7fe86d5 commit 61c45e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions crates/stackable-operator/src/commons/authentication/kerberos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticationProvider {
/// Mandatory secret class used for producing keytabs.
#[serde(default)]
pub kerberos_secret_class: String,
}
13 changes: 12 additions & 1 deletion crates/stackable-operator/src/commons/authentication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use strum::Display;

use crate::client::Client;

pub mod kerberos;
pub mod ldap;
pub mod oidc;
pub mod static_;
Expand Down Expand Up @@ -77,6 +78,9 @@ pub enum AuthenticationClassProvider {
/// The [TLS provider](DOCS_BASE_URL_PLACEHOLDER/concepts/authentication#_tls).
/// The TLS AuthenticationClass is used when users should authenticate themselves with a TLS certificate.
Tls(tls::AuthenticationProvider),

/// The Kerberos provider is used for Kerberos authentication and defines the secret used for generating keytabs.
Kerberos(kerberos::AuthenticationProvider),
}

impl AuthenticationClass {
Expand Down Expand Up @@ -183,6 +187,13 @@ mod tests {
let tls_provider = AuthenticationClassProvider::Tls(AuthenticationProvider {
client_cert_secret_class: None,
});
assert_eq!("Tls", tls_provider.to_string())
assert_eq!("Tls", tls_provider.to_string());

let kerberos_provider = AuthenticationClassProvider::Kerberos(
crate::commons::authentication::kerberos::AuthenticationProvider {
kerberos_secret_class: "kerberos".to_string(),
},
);
assert_eq!("Kerberos", kerberos_provider.to_string());
}
}

0 comments on commit 61c45e1

Please sign in to comment.