Skip to content

Commit

Permalink
KNOX-2966 - Improved logging around KnoxSSO cookie management (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
smolnar82 authored Oct 10, 2023
1 parent 0136181 commit 895022c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public interface KnoxSSOMessages {
@Message( level = MessageLevel.ERROR, text = "Original URL not found in request.")
void originalURLNotFound();

@Message( level = MessageLevel.INFO, text = "JWT cookie successfully added.")
void addedJWTCookie();
@Message( level = MessageLevel.INFO, text = "JWT cookie {0} successfully added.")
void addedJWTCookie(String token);

@Message( level = MessageLevel.ERROR, text = "Unable to issue token.")
void unableToIssueToken(@StackTrace( level = MessageLevel.DEBUG) Exception e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ private long getExpiry() {
}

private void addJWTHadoopCookie(String original, JWT token) {
LOGGER.addingJWTCookie(token.toString());
final String logSafeToken = Tokens.getTokenDisplayText(token.toString());
LOGGER.addingJWTCookie(logSafeToken);
/*
* In order to account for google chrome changing default value
* of SameSite from None to Lax we need to craft Set-Cookie
Expand All @@ -424,7 +425,7 @@ private void addJWTHadoopCookie(String original, JWT token) {
}
setCookie.append("; SameSite=").append(this.sameSiteValue);
response.setHeader("Set-Cookie", setCookie.toString());
LOGGER.addedJWTCookie();
LOGGER.addedJWTCookie(logSafeToken);
} catch (Exception e) {
LOGGER.unableAddCookieToResponse(e.getMessage(),
Arrays.toString(e.getStackTrace()));
Expand Down

0 comments on commit 895022c

Please sign in to comment.