diff --git a/services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/directives/auth/jwt/JwtAuthenticationDirective.java b/services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/directives/auth/jwt/JwtAuthenticationDirective.java index 0ff4ddcd0e..4244daf5aa 100755 --- a/services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/directives/auth/jwt/JwtAuthenticationDirective.java +++ b/services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/directives/auth/jwt/JwtAuthenticationDirective.java @@ -107,10 +107,10 @@ public Route authenticate(final String correlationId, final Function { final PublicKey publicKey = publicKeyOpt - .orElseThrow(() -> buildJwtUnauthorizedException(correlationId, - timer)); + .orElseThrow( + () -> buildJwtUnauthorizedException(correlationId)); - validateToken(jwt, publicKey, correlationId, timer); + validateToken(jwt, publicKey, correlationId); final List authSubjects = authorizationSubjectsProvider @@ -155,7 +155,7 @@ private static DittoRuntimeException buildMissingJwtException(final String corre } private void validateToken(final JsonWebToken authorizationToken, final PublicKey publicKey, - final String correlationId, final StartedTimer timer) { + final String correlationId) { final DefaultJwtParser defaultJwtParser = new DefaultJwtParser(); try { @@ -163,14 +163,11 @@ private void validateToken(final JsonWebToken authorizationToken, final PublicKe } catch (final ExpiredJwtException | MalformedJwtException | SignatureException | IllegalArgumentException e) { LOGGER.info("Got Exception '{}' during parsing JWT: {}", e.getClass().getSimpleName(), e.getMessage(), e); - throw buildJwtUnauthorizedException(correlationId, timer); + throw buildJwtUnauthorizedException(correlationId); } } - private static DittoRuntimeException buildJwtUnauthorizedException(final String correlationId, - final StartedTimer timer) { - timer.tag(TracingTags.AUTH_SUCCESS, false) - .stop(); + private static DittoRuntimeException buildJwtUnauthorizedException(final String correlationId) { return GatewayAuthenticationFailedException.newBuilder("The JWT could not be verified") .description("Check if your token is not expired and set the token accordingly.")