From 79a779ad7ca00f8d78a73f58b4260f0263b41394 Mon Sep 17 00:00:00 2001 From: Dylan De Faoite Date: Sat, 17 Oct 2026 22:46:04 +0100 Subject: [PATCH] fix(security): tampered token throws 500 error --- src/main/java/com/ddf/vodsystem/security/JwtService.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ddf/vodsystem/security/JwtService.java b/src/main/java/com/ddf/vodsystem/security/JwtService.java index df2a05e..e5b863f 100644 --- a/src/main/java/com/ddf/vodsystem/security/JwtService.java +++ b/src/main/java/com/ddf/vodsystem/security/JwtService.java @@ -4,12 +4,9 @@ import java.util.Date; import com.auth0.jwt.JWT; import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.algorithms.Algorithm; -import com.auth0.jwt.exceptions.JWTDecodeException; -import com.auth0.jwt.exceptions.TokenExpiredException; +import com.auth0.jwt.exceptions.JWTVerificationException; import com.auth0.jwt.interfaces.DecodedJWT; import com.ddf.vodsystem.dto.properties.AuthProperties; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.oauth2.jwt.JwtException; import org.springframework.stereotype.Service; @Service @@ -60,7 +57,7 @@ public class JwtService { } return jwt.getClaim(USER_ID_CLAIM).asLong(); - } catch (JwtException | IllegalArgumentException | TokenExpiredException | JWTDecodeException ignored) { + } catch (JWTVerificationException | IllegalArgumentException ignored) { return null; } }