Skip to content

Commit cac2028

Browse files
author
Vladislav Supalov
committed
step: accept ldap field when parsing
1 parent 93a5da7 commit cac2028

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

rust/crd/src/authentication.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use stackable_operator::{
66
client::Client,
77
commons::{
88
authentication::{AuthenticationClass, AuthenticationClassProvider},
9-
tls::TlsAuthenticationProvider,
9+
tls::TlsAuthenticationProvider, ldap::LdapAuthenticationProvider,
1010
},
1111
kube::runtime::reflector::ObjectRef,
1212
schemars::{self, JsonSchema},
@@ -33,7 +33,7 @@ pub enum Error {
3333
pub struct DruidAuthentication {
3434
/// TLS based client authentication (mutual TLS)
3535
pub tls: Option<DruidTlsAuthentication>,
36-
//pub ldap: Option<DruidLdapAuthentication>,
36+
pub ldap: Option<DruidLdapAuthentication>,
3737
}
3838

3939
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
@@ -57,6 +57,7 @@ impl DruidAuthentication {
5757

5858
if let Some(DruidAuthentication {
5959
tls: Some(druid_tls),
60+
ldap: _,
6061
}) = &druid.spec.cluster_config.authentication
6162
{
6263
let authentication_class =
@@ -93,10 +94,11 @@ impl DruidAuthentication {
9394
#[derive(Clone, Debug)]
9495
pub enum DruidAuthenticationConfig {
9596
Tls(TlsAuthenticationProvider),
97+
Ldap(LdapAuthenticationProvider),
9698
}
9799

98100
impl DruidAuthenticationConfig {
99101
pub fn is_tls_auth(&self) -> bool {
100102
matches!(self, DruidAuthenticationConfig::Tls(_))
101103
}
102-
}
104+
}

rust/crd/src/lib.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ impl DruidCluster {
595595
// TLS authentication with provided AuthenticationClass or no TLS required?
596596
matches!(
597597
&self.spec.cluster_config.authentication,
598-
Some(DruidAuthentication { tls: Some(_) })
598+
Some(DruidAuthentication { tls: Some(_), ldap: _ })
599599
)
600600
}
601601
}
@@ -945,4 +945,30 @@ mod tests {
945945
"foo".to_string()
946946
);
947947
}
948+
949+
#[test]
950+
fn test_ldap_config() {
951+
let input = r#"
952+
deepStorage:
953+
hdfs:
954+
configMapName: druid-hdfs
955+
directory: /druid
956+
metadataStorageDatabase:
957+
dbType: derby
958+
connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true
959+
host: localhost
960+
port: 1527
961+
zookeeperConfigMapName: zk-config-map
962+
authentication:
963+
ldap:
964+
authenticationClass: some-ldap-class
965+
"#;
966+
let druid_cluster_config: DruidClusterConfig =
967+
serde_yaml::from_str(input).expect("illegal test input");
968+
969+
assert_eq!(
970+
druid_cluster_config.authentication.unwrap().ldap.unwrap().authentication_class,
971+
"some-ldap-class".to_string()
972+
);
973+
}
948974
}

0 commit comments

Comments
 (0)