Skip to content

Commit 98f9e3f

Browse files
README file updated
**Update:** - Splunk token is replaced **Session token**. - Bearer is replaced with **Authentication**. - Splunk Docs URL is pointing to latest release.
1 parent 842b8a0 commit 98f9e3f

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -135,65 +135,65 @@ public class SplunkLogin {
135135
}
136136
```
137137

138-
#### Login using Splunk Token
138+
#### Login using Session Token
139139
```java
140140
import com.splunk.Service;
141141
import com.splunk.ServiceArgs;
142142

143143
/**
144-
* Login using Splunk token
144+
* Login using Session token
145145
*/
146146
public class SplunkLogin {
147147

148148
static Service service = null;
149149
/**
150-
* Splunk Token.
150+
* Session Token.
151151
* Actual token length would be longer than this token length.
152152
*/
153-
static String splunkToken = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
153+
static String token = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
154154

155155
public static void main(String args[]) {
156156
ServiceArgs loginArgs = new ServiceArgs();
157157
loginArgs.setPort(8089);
158158
loginArgs.setHost("localhost");
159159
loginArgs.setScheme("https");
160-
loginArgs.setToken(String.format("Splunk %s", splunkToken));
160+
loginArgs.setToken(String.format("Splunk %s", token));
161161

162162
// Initialize the SDK client
163163
service = Service.connect(loginArgs);
164164
}
165165
}
166166
```
167-
* Login using username and password will create Splunk token internally.
168-
* Login using Credentials (username & password) OR directly using Splunk token are similar.
169-
* In above two approaches, there is one limitation that expiration time of Splunk token cannot be extended. User has to re-login every time when token expires.
170-
* To overcome this limitation, **Bearer** token is used instead of Splunk token.
171-
* In **Bearer** token, user has a provision to set token expiration time. Splunk allows user to set relative/absolute time for token expiration.
172-
* In other words, **Bearer** token is configurable whereas Splunk token cannot be configured.
173-
174-
#### Login using Bearer Token (RECOMMENDED)
167+
* Login using username and password will create Session token internally.
168+
* Login using Credentials (username & password) OR directly using Session token are similar.
169+
* In above two approaches, there is one limitation that expiration time of Session token cannot be extended. User has to re-login every time when token expires.
170+
* To overcome this limitation, **Authentication** token is used instead of Session token.
171+
* In **Authentication** token, user has a provision to set token expiration time. Splunk allows user to set relative/absolute time for token expiration.
172+
* In other words, **Authentication** token is configurable whereas Session token cannot be configured.
173+
174+
#### Login using Authentication Token (RECOMMENDED)
175175
```java
176176
import com.splunk.Service;
177177
import com.splunk.ServiceArgs;
178178

179179
/**
180-
* Login using Bearer token
180+
* Login using Authentication token
181181
*/
182182
public class SplunkLogin {
183183

184184
static Service service = null;
185185
/**
186-
* Bearer Token.
186+
* Authentication Token.
187187
* Actual token length would be longer than this token length.
188188
*/
189-
static String bearerToken = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
189+
static String token = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
190190

191191
public static void main(String args[]) {
192192
ServiceArgs loginArgs = new ServiceArgs();
193193
loginArgs.setPort(8089);
194194
loginArgs.setHost("localhost");
195195
loginArgs.setScheme("https");
196-
loginArgs.setToken(String.format("Bearer %s", bearerToken));
196+
loginArgs.setToken(String.format("Bearer %s", token));
197197

198198
// Initialize the SDK client
199199
service = Service.connect(loginArgs);
@@ -210,8 +210,8 @@ import com.splunk.Service;
210210
import com.splunk.ServiceArgs;
211211

212212
/**
213-
* Logged in using Bearer token.
214-
* Assuming that bearer token is already created from Splunk web.
213+
* Logged in using Authentication token.
214+
* Assuming that authentication token is already created from Splunk web.
215215
* Create Job using search creation.
216216
* Read results and print _raw fields
217217
*/
@@ -220,18 +220,18 @@ public class SearchExample {
220220
static Service service = null;
221221

222222
/**
223-
* Bearer Token.
223+
* Authentication Token.
224224
* Actual token length would be longer than this token length.
225225
*/
226-
static String bearerToken = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
226+
static String token = "1k_Ostpl6NBe4iVQ5d6I3Ohla_U5";
227227

228228
public static void main(String args[]) {
229229

230230
ServiceArgs loginArgs = new ServiceArgs();
231231
loginArgs.setPort(8089);
232232
loginArgs.setHost("localhost");
233233
loginArgs.setScheme("https");
234-
loginArgs.setToken(String.format("Bearer %s", bearerToken));
234+
loginArgs.setToken(String.format("Bearer %s", token));
235235

236236
// Initialize the SDK client
237237
service = Service.connect(loginArgs);
@@ -262,7 +262,7 @@ public class SearchExample {
262262
}
263263
```
264264

265-
For more information on authentication using tokens, please visit [Splunk Docs](https://docs.splunk.com/Documentation/Splunk/8.2.3/Security/Setupauthenticationwithtokens).
265+
For more information on authentication using tokens, please visit [Splunk Docs](https://docs.splunk.com/Documentation/Splunk/latest/Security/Setupauthenticationwithtokens).
266266

267267
### Unit tests
268268

0 commit comments

Comments
 (0)