You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/06/24 23:17:11 UTC

[GitHub] [activemq] epytka commented on a change in pull request #673: AMQ-6148 re-using LDAP context for authentication

epytka commented on a change in pull request #673:
URL: https://github.com/apache/activemq/pull/673#discussion_r658347684



##########
File path: activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java
##########
@@ -490,45 +482,47 @@ protected boolean bindUser(DirContext context, String dn, String password) throw
         return values;
     }
 
-    protected DirContext open() throws NamingException {
-        try {
-            Hashtable<String, String> env = new Hashtable<String, String>();
-            env.put(Context.INITIAL_CONTEXT_FACTORY, getLDAPPropertyValue(INITIAL_CONTEXT_FACTORY));
-            if (isLoginPropertySet(CONNECTION_USERNAME)) {
-                env.put(Context.SECURITY_PRINCIPAL, getLDAPPropertyValue(CONNECTION_USERNAME));
-            } else {
-                throw new NamingException("Empty username is not allowed");
-            }
+    protected void openContext() throws NamingException {
+        if (context == null) {

Review comment:
       Just to be consistent with `deleteContext` you could change to: 
   
   ```
   if (context != null) {
     return;
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org