Skip to content

Commit

Permalink
correct indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
chDame committed Aug 3, 2022
1 parent 7b30a45 commit d5710e7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main/java/io/camunda/operate/auth/JwtAuthentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@ public abstract class JwtAuthentication implements AuthInterface {
public int getExpiration(String token) throws OperateException {
try {
String[] chunks = token.split("\\.");


String payload = new String(DECODER.decode(chunks[1]));
JsonNode jsonPayload = MAPPER.readValue(payload, JsonNode.class);
JsonNode exp = jsonPayload.get("exp");
if (exp==null) {
return 0;
} else {
return exp.asInt();
}
String payload = new String(DECODER.decode(chunks[1]));
JsonNode jsonPayload = MAPPER.readValue(payload, JsonNode.class);
JsonNode exp = jsonPayload.get("exp");
if (exp==null) {
return 0;
} else {
return exp.asInt();
}
} catch (JsonProcessingException e) {
throw new OperateException("Token is not readable", e);
}
}

public void setToken(CamundaOperateClient client, String token) throws OperateException {
client.setAuthHeader(new BasicHeader("Authorization", "Bearer " + token));
client.setTokenExpiration(getExpiration(token));
Expand Down

0 comments on commit d5710e7

Please sign in to comment.