moresandeep commented on a change in pull request #284: KNOX-2266 - Tokens
Should Include a Unique Identifier
URL: https://github.com/apache/knox/pull/284#discussion_r390035230
##########
File path:
gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
##########
@@ -246,9 +249,14 @@ public Response renew(String token) {
String renewer = SubjectUtils.getCurrentEffectivePrincipalName();
if (allowedRenewers.contains(renewer)) {
try {
+ JWTToken jwt = new JWTToken(token);
// If renewal fails, it should be an exception
- expiration = tokenStateService.renewToken(token,
+ expiration = tokenStateService.renewToken(jwt,
renewInterval.orElse(tokenStateService.getDefaultRenewInterval()));
+ log.renewedToken(getTopologyName(),
TokenUtils.getTokenDisplayText(token), TokenUtils.getTokenId(jwt));
+ } catch (ParseException e) {
+ log.invalidToken(getTopologyName(),
TokenUtils.getTokenDisplayText(token), e);
+ error = e.getMessage();
Review comment:
e.getMessage() will throw NPE in case message is null.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services