| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a289330 commit fe305a5
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,8 +62,9 @@ private DirContext createInitialDirContext(final String principal, | |||
| 62 | 62 | private DirContext createInitialDirContext(final String principal, | |
| 63 | 63 | final String password, final String providerUrl, | |
| 64 | 64 | final boolean isSystemContext) throws NamingException { | |
| 65 | - return new InitialDirContext(getEnvironment(principal, password, | ||
| 66 | - providerUrl, isSystemContext)); | ||
| 65 | + Hashtable<String, String> environment = getEnvironment(principal, password, providerUrl, isSystemContext); | ||
| 66 | + s_logger.debug("initializing ldap with provider url: "+ environment.get(Context.PROVIDER_URL)); | ||
| 67 | + return new InitialDirContext(environment); | ||
| 67 | 68 | } | |
| 68 | 69 | ||
| 69 | 70 | public DirContext createUserContext(final String principal, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,6 +72,7 @@ public LdapConfigurationResponse addConfiguration(final String hostname, final i | |||
| 72 | 72 | s_logger.info("Added new ldap server with hostname: " + hostname); | |
| 73 | 73 | return new LdapConfigurationResponse(hostname, port); | |
| 74 | 74 | } catch (final NamingException e) { | |
| 75 | + s_logger.debug("NamingException while doing an LDAP bind", e); | ||
| 75 | 76 | throw new InvalidParameterValueException("Unable to bind to the given LDAP server"); | |
| 76 | 77 | } | |
| 77 | 78 | } else { | |
@@ -89,6 +90,7 @@ public boolean canAuthenticate(final String username, final String password) { | |||
| 89 | 90 | closeContext(context); | |
| 90 | 91 | return true; | |
| 91 | 92 | } catch (final NamingException e) { | |
| 93 | + s_logger.debug("NamingException: while doing an LDAP bind for user "+" "+username, e); | ||
| 92 | 94 | s_logger.info("Failed to authenticate user: " + username + ". incorrect password."); | |
| 93 | 95 | return false; | |
| 94 | 96 | } | |
@@ -100,7 +102,7 @@ private void closeContext(final DirContext context) { | |||
| 100 | 102 | context.close(); | |
| 101 | 103 | } | |
| 102 | 104 | } catch (final NamingException e) { | |
| 103 | - s_logger.warn(e.getMessage()); | ||
| 105 | + s_logger.warn(e.getMessage(),e); | ||
| 104 | 106 | } | |
| 105 | 107 | } | |
| 106 | 108 | ||
@@ -174,6 +176,7 @@ public List<LdapUser> getUsers() throws NoLdapUserMatchingQueryException { | |||
| 174 | 176 | context = _ldapContextFactory.createBindContext(); | |
| 175 | 177 | return _ldapUserManager.getUsers(context); | |
| 176 | 178 | } catch (final NamingException e) { | |
| 179 | + s_logger.debug("ldap NamingException: ",e); | ||
| 177 | 180 | throw new NoLdapUserMatchingQueryException("*"); | |
| 178 | 181 | } finally { | |
| 179 | 182 | closeContext(context); | |
@@ -187,6 +190,7 @@ public List<LdapUser> getUsersInGroup(String groupName) throws NoLdapUserMatchin | |||
| 187 | 190 | context = _ldapContextFactory.createBindContext(); | |
| 188 | 191 | return _ldapUserManager.getUsersInGroup(groupName, context); | |
| 189 | 192 | } catch (final NamingException e) { | |
| 193 | + s_logger.debug("ldap NamingException: ",e); | ||
| 190 | 194 | throw new NoLdapUserMatchingQueryException("groupName=" + groupName); | |
| 191 | 195 | } finally { | |
| 192 | 196 | closeContext(context); | |
@@ -214,6 +218,7 @@ public List<LdapUser> searchUsers(final String username) throws NoLdapUserMatchi | |||
| 214 | 218 | final String escapedUsername = LdapUtils.escapeLDAPSearchFilter(username); | |
| 215 | 219 | return _ldapUserManager.getUsers("*" + escapedUsername + "*", context); | |
| 216 | 220 | } catch (final NamingException e) { | |
| 221 | + s_logger.debug("ldap NamingException: ",e); | ||
| 217 | 222 | throw new NoLdapUserMatchingQueryException(username); | |
| 218 | 223 | } finally { | |
| 219 | 224 | closeContext(context); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments