Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce log level in HttpJwtAuthenticator if request cannot be authenticated #4913

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ private AuthCredentials extractCredentials0(final SecurityRequest request) {
}
}
}
log.error("Failed to parse JWT token using any of the available parsers");
if (log.isDebugEnabled()) {
Copy link
Collaborator

@nibix nibix Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to just change log.error() to log.debug() without the if statement. The same check will be done in the if just again inside the call:

https://github.com/apache/logging-log4j2/blob/20035c443e66b9623bde447facde15f54026fa29/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L2312-L2321

As we are just logging a constant without any further stuff, this should not incur any significant overhead.

Additionally, codecov will then see a 100% patch coverage.

log.debug("Unable to authenticate JWT Token with any configured signing key");
}
return null;
}

Expand Down
Loading