Closed thanasisk closed 9 years ago
Hi @thanasisk,
What version of Splunk are your search heads? If they're setup with search head clustering on 6.2+, the latest version of the Java SDK will use cookie-based authentication behind the scenes to solve this exact problem.
We are planning to bring cookie-based authentication to the Ruby SDK shortly.
@thanasisk thanks for the report! At the moment, while you can pass in a token when you construct the Service
object, you can't use Basic Auth as we assume we will use Splunk authentication.
We'll look into fixing this, but as we're prepping for our user conference in late September, it may take a little bit until we can get to it. In the meantime, if you want to submit a PR with a fix, we'd be more than happy to help get that in!
I have Ruby skills but I will need some guidelines in order to implement this. Can you provide some info here or you want to contact me offline (in which case I can pass along my contact details).
@thanasisk sorry for delay in replying!
We're happy to help guide - here is some info:
The key change is likely here: https://github.com/splunk/splunk-sdk-ruby/blob/master/lib/splunk-sdk-ruby/context.rb#L420
Specifically, it currently assumes that any token you pass into the Context
class will be a "Splunk" one. What that then means is that we unconditionally prepend Splunk
to it. However, since you want to pass a Basic Auth header, that is not the right behavior.
The easiest change is likely to see if token
is starting with Basic
, and in which case to use explicitly. Another possibility is to add the ability to set username and password and then add a switch to tell it to use basic auth, in which case it will just do the encoding for you. The latter may be cleaner but would require a bit more work.
@itay thanks for the reply. I have submitted a PR
Hi @thanasisk
Thanks again for bringing this to our attention and the PR! We've just released v1.0.5 with this feature.
Hello, the examples provided do NOT work with Load Balanced search heads. for Java the solution is as follows:
Service service = new Service(ENDPOINT, 443, "https"); String credentials = ":";
String basicAuthHeader = Base64.encode(credentials.getBytes());
service.setToken("Basic " + basicAuthHeader);
however ruby-sdk does NOT provide an equivalent method such as setToken or example. Can you please expand the code in SDK/examples to provide such an example? I tried creating the token manually and passing it to the config string but to no avail