Skip to content

Commit 2918d85

Browse files
committed
Revert "Switch oidc from Option<> to an Option<enum>"
This reverts commit bd701f7. The Option<enum> still was represented as mandatory (oneOf oidc) in the CRD :(
1 parent bd701f7 commit 2918d85

File tree

1 file changed

+5
-18
lines changed
  • src/commons/authentication

1 file changed

+5
-18
lines changed

src/commons/authentication/mod.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,7 @@ pub struct ClientAuthenticationDetails<O = ()> {
9999
/// is flattened into the final CRD.
100100
///
101101
/// Use [`ClientAuthenticationDetails::oidc_or_error`] to get the value or report an error to the user.
102-
///
103-
/// We are aware that this prevents users from e.g. configuring oidc and ldap clientAuthenticationOptions
104-
/// simultaneously. This might be helpful in cases of a migration of the provider of an AuthenticationClass,
105-
/// but we consider a good validation for 90% of the use-cases more important.
106-
#[serde(flatten)]
107-
client_authentication_options: Option<ClientAuthenticationOptions<O>>,
108-
}
109-
110-
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
111-
#[serde(rename_all = "camelCase")]
112-
113-
pub enum ClientAuthenticationOptions<O> {
114-
Oidc(oidc::ClientAuthenticationOptions<O>),
102+
oidc: Option<oidc::ClientAuthenticationOptions<O>>,
115103
}
116104

117105
impl<O> ClientAuthenticationDetails<O> {
@@ -132,12 +120,11 @@ impl<O> ClientAuthenticationDetails<O> {
132120
&self,
133121
auth_class_name: &str,
134122
) -> OperatorResult<&oidc::ClientAuthenticationOptions<O>> {
135-
match &self.client_authentication_options {
136-
Some(ClientAuthenticationOptions::Oidc(oidc)) => Ok(oidc),
137-
None => Err(Error::OidcAuthenticationDetailsNotSpecified {
123+
self.oidc
124+
.as_ref()
125+
.ok_or(Error::OidcAuthenticationDetailsNotSpecified {
138126
auth_class_name: auth_class_name.to_string(),
139-
}),
140-
}
127+
})
141128
}
142129
}
143130

0 commit comments

Comments
 (0)