@@ -99,7 +99,19 @@ pub struct ClientAuthenticationDetails<O = ()> {
99
99
/// is flattened into the final CRD.
100
100
///
101
101
/// Use [`ClientAuthenticationDetails::oidc_or_error`] to get the value or report an error to the user.
102
- oidc : Option < oidc:: ClientAuthenticationOptions < O > > ,
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 > ) ,
103
115
}
104
116
105
117
impl < O > ClientAuthenticationDetails < O > {
@@ -120,11 +132,12 @@ impl<O> ClientAuthenticationDetails<O> {
120
132
& self ,
121
133
auth_class_name : & str ,
122
134
) -> OperatorResult < & oidc:: ClientAuthenticationOptions < O > > {
123
- self . oidc
124
- . as_ref ( )
125
- . ok_or ( Error :: OidcAuthenticationDetailsNotSpecified {
135
+ match & self . client_authentication_options {
136
+ Some ( ClientAuthenticationOptions :: Oidc ( oidc ) ) => Ok ( oidc ) ,
137
+ None => Err ( Error :: OidcAuthenticationDetailsNotSpecified {
126
138
auth_class_name : auth_class_name. to_string ( ) ,
127
- } )
139
+ } ) ,
140
+ }
128
141
}
129
142
}
130
143
0 commit comments