Skip to content

Commit a71b7a9

Browse files
committed
An attempt to fix SSL with LDAP auth
1 parent 1196f9f commit a71b7a9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/src/main/java/io/kafbat/ui/config/auth/LdapSecurityConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.springframework.context.annotation.Configuration;
1717
import org.springframework.ldap.core.DirContextOperations;
1818
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
19+
import org.springframework.ldap.core.support.DefaultTlsDirContextAuthenticationStrategy;
1920
import org.springframework.ldap.core.support.LdapContextSource;
2021
import org.springframework.security.authentication.AuthenticationManager;
2122
import org.springframework.security.authentication.ProviderManager;
@@ -90,6 +91,9 @@ public LdapContextSource ldapContextSource() {
9091
ctx.setUserDn(props.getAdminUser());
9192
ctx.setPassword(props.getAdminPassword());
9293
ctx.afterPropertiesSet();
94+
if (props.getUrls().startsWith("ldaps://")) {
95+
ctx.setAuthenticationStrategy(new DefaultTlsDirContextAuthenticationStrategy());
96+
}
9397
return ctx;
9498
}
9599

0 commit comments

Comments
 (0)