Skip to content

Commit

Permalink
STORM-3229: Add in better error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert (Bobby) Evans committed Sep 18, 2018
1 parent 6d0f2eb commit b1a535d
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,21 @@ public Optional<char[]> getPasswordFor(String userName) {
if (keyCache == null) {
return Optional.empty();
}
byte[] user = null;
WorkerTokenInfo deser = null;
try {
user = Base64.getDecoder().decode(userName);
deser = Utils.deserialize(user, WorkerTokenInfo.class);
} catch (Exception e) {
LOG.debug("Could not decode {}, might just be a plain digest request...", userName, e);
return Optional.empty();
}

try {
byte[] user = Base64.getDecoder().decode(userName);
WorkerTokenInfo deser = Utils.deserialize(user, WorkerTokenInfo.class);
byte[] password = getSignedPasswordFor(user, deser);
return Optional.of(Base64.getEncoder().encodeToString(password).toCharArray());
} catch (Exception e) {
LOG.debug("Could not decode {}, might just be a plain digest request...", userName, e);
LOG.error("Could not get password for token {}/{}", deser.get_userName(), deser.get_topologyId(), e);
return Optional.empty();
}
}
Expand Down

0 comments on commit b1a535d

Please sign in to comment.