fix(security): tampered token throws 500 error
All checks were successful
CI / Maven unit tests (push) Successful in 15s
CI / Build and push images (push) Successful in 1m24s
CI / Deploy to server (push) Successful in 7s

This commit is contained in:
2026-10-17 22:46:04 +01:00
parent 1923eab14e
commit 79a779ad7c

View File

@@ -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;
}
}