INTEXT-94: Fix Auth bug for Splunk 6.x

JIRA: https://jira.spring.io/browse/INTEXT-94

* Upgrade to Splunk Client 1.3
This commit is contained in:
Artem Bilan
2014-06-06 17:32:25 +03:00
parent a4ca9e6671
commit 9df12e5a2b
2 changed files with 8 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
version=1.1.0.BUILD-SNAPSHOT
junitVersion=4.11
jodaTimeVersion=2.3
splunkVersion=1.0.0
splunkVersion=1.3.0
log4jVersion=1.2.17
springIntegrationVersion=4.0.2.RELEASE
commonsPoolVersion=1.6

View File

@@ -25,6 +25,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.DatatypeConverter;
import com.splunk.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -103,7 +105,7 @@ public class SplunkServiceFactory implements ServiceFactory {
catch (Exception e) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info(String.format("could not connect to Splunk Server @ %s:%d - %s, try next one",
splunkServer.getHost(), splunkServer.getPort(), e.getMessage()));
splunkServer.getHost(), splunkServer.getPort(), e.getMessage()));
}
}
}
@@ -133,6 +135,10 @@ public class SplunkServiceFactory implements ServiceFactory {
args.put("username", splunkServer.getUsername());
args.put("password", splunkServer.getPassword());
String auth = splunkServer.getUsername() + ":" + splunkServer.getPassword();
String authToken = "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes());
args.put("token", authToken);
return new Callable<Service>() {
public Service call()
throws Exception {