Fix NPE in LDAP Helper class if username is null
Bug: issue 1622 Change-Id: Id96d75e40be4605dadba233ed7954363c7ee8812 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -111,8 +111,10 @@ import javax.security.auth.login.LoginException;
|
|||||||
if ("GSSAPI".equals(authentication)) {
|
if ("GSSAPI".equals(authentication)) {
|
||||||
return kerberosOpen(env);
|
return kerberosOpen(env);
|
||||||
} else {
|
} else {
|
||||||
|
if (username != null) {
|
||||||
env.put(Context.SECURITY_PRINCIPAL, username);
|
env.put(Context.SECURITY_PRINCIPAL, username);
|
||||||
env.put(Context.SECURITY_CREDENTIALS, password != null ? password : "");
|
env.put(Context.SECURITY_CREDENTIALS, password != null ? password : "");
|
||||||
|
}
|
||||||
return new InitialDirContext(env);
|
return new InitialDirContext(env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user