[fix][ldap] fix ldap password null pointer exception. (#10284)
This commit is contained in:
@ -100,13 +100,13 @@ public class LdapClient {
|
||||
}
|
||||
|
||||
public boolean checkUpdate(String ldapPassword) {
|
||||
return !this.ldapPassword.equals(ldapPassword);
|
||||
return this.ldapPassword == null || !this.ldapPassword.equals(ldapPassword);
|
||||
}
|
||||
}
|
||||
|
||||
private static void init() {
|
||||
LdapInfo ldapInfo = Catalog.getCurrentCatalog().getAuth().getLdapInfo();
|
||||
if (ldapInfo == null) {
|
||||
if (ldapInfo == null || !ldapInfo.isValid()) {
|
||||
LOG.error("info is null, maybe no ldap admin password is set.");
|
||||
ErrorReport.report(ErrorCode.ERROR_LDAP_CONFIGURATION_ERR);
|
||||
throw new RuntimeException("ldapTemplate is not initialized");
|
||||
|
||||
@ -46,6 +46,10 @@ public class LdapInfo implements Writable {
|
||||
ldapPasswdEncrypted = SymmetricEncryption.encrypt(ldapPasswd, secretKey, iv);
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return ldapPasswdEncrypted != null && secretKey != null && iv != null;
|
||||
}
|
||||
|
||||
public String getLdapPasswdEncrypted() {
|
||||
return ldapPasswdEncrypted;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user