Skip to content

Commit 48b45bf

Browse files
authored
RANGER-5384: basic-auth header should not be set in Solr requests when username or password is empty (apache#715)
1 parent e98446f commit 48b45bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security-admin/src/main/java/org/apache/ranger/solr/SolrUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.ranger.solr;
2121

22+
import org.apache.commons.lang3.StringUtils;
2223
import org.apache.ranger.common.MessageEnums;
2324
import org.apache.ranger.common.PropertiesUtil;
2425
import org.apache.ranger.common.RESTErrorUtil;
@@ -81,7 +82,7 @@ public QueryResponse runQuery(SolrClient solrClient, SolrQuery solrQuery) throws
8182
String username = PropertiesUtil.getProperty("ranger.solr.audit.user");
8283
String password = PropertiesUtil.getProperty("ranger.solr.audit.user.password");
8384

84-
if (username != null && password != null) {
85+
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
8586
req.setBasicAuthCredentials(username, password);
8687
}
8788

0 commit comments

Comments
 (0)