@@ -478,4 +478,59 @@ mod tests {
478478 NifiAuthenticationConfig :: SingleUser { .. }
479479 ) ) ;
480480 }
481+
482+ /// An LDAP provider that uses TLS but disables certificate verification.
483+ fn ldap_auth_class_without_tls_verification ( ) -> auth_core:: v1alpha1:: AuthenticationClass {
484+ serde_yaml:: from_str ( indoc ! { r#"
485+ metadata:
486+ name: nifi-ldap
487+ spec:
488+ provider: !ldap
489+ hostname: my-ldap
490+ tls:
491+ verification:
492+ none: {}
493+ "# } )
494+ . expect ( "valid LDAP AuthenticationClass" )
495+ }
496+
497+ fn oidc_auth_class ( ) -> auth_core:: v1alpha1:: AuthenticationClass {
498+ serde_yaml:: from_str ( indoc ! { r#"
499+ metadata:
500+ name: nifi-oidc
501+ spec:
502+ provider: !oidc
503+ hostname: my-oidc
504+ principalClaim: preferred_username
505+ scopes:
506+ - openid
507+ "# } )
508+ . expect ( "valid OIDC AuthenticationClass" )
509+ }
510+
511+ #[ test]
512+ fn ldap_without_tls_verification_is_rejected ( ) {
513+ let dereferenced = DereferencedAuthenticationClasses {
514+ entries : vec ! [ ( auth_details( ) , ldap_auth_class_without_tls_verification( ) ) ] ,
515+ } ;
516+ let result = NifiAuthenticationConfig :: validate ( & cluster_name ( ) , & dereferenced) ;
517+ assert ! ( matches!(
518+ result,
519+ Err ( Error :: NoLdapTlsVerificationNotSupported { .. } )
520+ ) ) ;
521+ }
522+
523+ /// OIDC requires per-cluster client options on the spec entry; without them validation fails.
524+ #[ test]
525+ fn oidc_without_client_options_is_rejected ( ) {
526+ let dereferenced = DereferencedAuthenticationClasses {
527+ // `auth_details()` carries no OIDC client options.
528+ entries : vec ! [ ( auth_details( ) , oidc_auth_class( ) ) ] ,
529+ } ;
530+ let result = NifiAuthenticationConfig :: validate ( & cluster_name ( ) , & dereferenced) ;
531+ assert ! ( matches!(
532+ result,
533+ Err ( Error :: OidcConfigurationInvalid { .. } )
534+ ) ) ;
535+ }
481536}
0 commit comments