File tree 1 file changed +8
-6
lines changed
jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -144,9 +144,15 @@ public Hashtable<String, Object> getEnv() throws NamingException {
144
144
env .put (Context .INITIAL_CONTEXT_FACTORY , getInitialContextFactory ());
145
145
env .put (Context .PROVIDER_URL , getConnectionURL ());
146
146
if (getConnectionUsername () != null && getConnectionUsername ().trim ().length () > 0 ) {
147
- env .put (Context .SECURITY_AUTHENTICATION , getAuthentication ());
147
+ String auth = getAuthentication ();
148
+ if (auth == null ) {
149
+ auth = DEFAULT_AUTHENTICATION ;
150
+ }
151
+ env .put (Context .SECURITY_AUTHENTICATION , auth );
148
152
env .put (Context .SECURITY_PRINCIPAL , getConnectionUsername ());
149
153
env .put (Context .SECURITY_CREDENTIALS , getConnectionPassword ());
154
+ } else if (getAuthentication () != null ) {
155
+ env .put (Context .SECURITY_AUTHENTICATION , getAuthentication ());
150
156
}
151
157
if (getSsl ()) {
152
158
setupSsl (env );
@@ -202,11 +208,7 @@ public String getConnectionPassword() {
202
208
}
203
209
204
210
public String getAuthentication () {
205
- String authentication = (String ) options .get (AUTHENTICATION );
206
- if (authentication == null ) {
207
- authentication = DEFAULT_AUTHENTICATION ;
208
- }
209
- return authentication ;
211
+ return (String ) options .get (AUTHENTICATION );
210
212
}
211
213
212
214
public boolean getSsl () {
You can’t perform that action at this time.
0 commit comments