NIFI-9201 NullPointerException in AbstractKerberosUser if the tgt is not renewable (#5383)

This commit is contained in:
denes 2021-09-13 17:04:39 +02:00 committed by GitHub
parent 5e2ec9b454
commit 3fbd9c9e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -263,16 +263,18 @@ public abstract class AbstractKerberosUser implements KerberosUser {
private long getRefreshTime(final KerberosTicket tgt) {
final long start = tgt.getStartTime().getTime();
final long end = tgt.getEndTime().getTime();
final long renewUntil = tgt.getRenewTill().getTime();
if (LOGGER.isTraceEnabled()) {
final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
final String startDate = dateFormat.format(new Date(start));
final String endDate = dateFormat.format(new Date(end));
final String renewUntilDate = dateFormat.format(new Date(renewUntil));
LOGGER.trace("TGT for {} is valid starting at [{}]", principal, startDate);
LOGGER.trace("TGT for {} expires at [{}]", principal, endDate);
LOGGER.trace("TGT for {} renews until [{}]", principal, renewUntilDate);
if (tgt.getRenewTill() == null) {
LOGGER.trace("TGT for {} is non-renewable", principal);
} else {
LOGGER.trace("TGT for {} renews until [{}]", principal, dateFormat.format(tgt.getRenewTill()));
}
}
return start + (long) ((end - start) * TICKET_RENEW_WINDOW);