Skip to content

The Unified and Autonomous Development Platform

Add handling for no ssh keys in ldap

Michael Weimannf47091022a21
diff --git a/server-core/src/main/java/io/onedev/server/model/support/administration/authenticator/ldap/LdapAuthenticator.java b/server-core/src/main/java/io/onedev/server/model/support/administration/authenticator/ldap/LdapAuthenticator.java
index bba6999b3a..d21686e7e7 100644
--- a/server-core/src/main/java/io/onedev/server/model/support/administration/authenticator/ldap/LdapAuthenticator.java
+++ b/server-core/src/main/java/io/onedev/server/model/support/administration/authenticator/ldap/LdapAuthenticator.java
@@ -400,6 +400,12 @@ public class LdapAuthenticator extends Authenticator {
Collection<SshKey> sshKeys = new ArrayList<SshKey>();
Attribute attributeValue = searchResultAttributes.get(getUserSSHPublicKey());
+
+ if (attributeValue == null) {
+ // no values for the user stored in LDAP
+ return sshKeys;
+ }
+
NamingEnumeration<?> ldapValues = attributeValue.getAll();
int keyIndex = 1;