SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

CheckToken #

Checks an authentication token's validity.

Arguments #

public CompletableFuture<ConcurrentHashMap<String, Object>> checkToken(final String token)
  throws NotConnectedException, InternalException
ArgumentTypeDescription
token
String
Authentication token

Return #

A ConcurrentHashMap which has the following properties:

PropertyTypeDescription
valid
boolean
Token validity
state
String
Explain why the token is invalid
expires_at
int
Token expiration timestamp

Usage #

ConcurrentHashMap<String, Object> credentials = new ConcurrentHashMap<>();
credentials.put("username", "foo");
credentials.put("password", "bar");
ConcurrentHashMap<String, Object> response = kuzzle.getAuthController().login("local", credentials).get();
ConcurrentHashMap<String, Object> responseToken = kuzzle.getAuthController().checkToken(response.get("jwt").toString()).get();