Skip to content

Commit c6a936e

Browse files
committed
Improve jwt logging on failed auth
Update docs/changelog/122247.yaml
1 parent cde8493 commit c6a936e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/changelog/122247.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122247
2+
summary: Improve jwt logging on failed auth
3+
area: Authentication
4+
type: bug
5+
issues: []

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/jwt/JwtRealm.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,11 @@ public void authenticate(final AuthenticationToken authenticationToken, final Ac
263263
+ tokenPrincipal
264264
+ "] with header ["
265265
+ jwtAuthenticationToken.getSignedJWT().getHeader()
266-
+ "] and claimSet ["
267-
+ jwtAuthenticationToken.getJWTClaimsSet()
268266
+ "]";
269267

270268
if (logger.isTraceEnabled()) {
271-
logger.trace(msg, ex);
269+
// Large claim sets can cause stack overflow error, so only log when trace enabled
270+
logger.trace(msg + " and claimSet [" + jwtAuthenticationToken.getJWTClaimsSet() + "]", ex);
272271
} else {
273272
logger.debug(msg + " Cause: " + ex.getMessage()); // only log the stack trace at trace level
274273
}

0 commit comments

Comments
 (0)