fix(security): tampered token throws 500 error
This commit is contained in:
@@ -4,12 +4,9 @@ import java.util.Date;
|
|||||||
import com.auth0.jwt.JWT;
|
import com.auth0.jwt.JWT;
|
||||||
import com.auth0.jwt.JWTVerifier;
|
import com.auth0.jwt.JWTVerifier;
|
||||||
import com.auth0.jwt.algorithms.Algorithm;
|
import com.auth0.jwt.algorithms.Algorithm;
|
||||||
import com.auth0.jwt.exceptions.JWTDecodeException;
|
import com.auth0.jwt.exceptions.JWTVerificationException;
|
||||||
import com.auth0.jwt.exceptions.TokenExpiredException;
|
|
||||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
import com.ddf.vodsystem.dto.properties.AuthProperties;
|
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;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -60,7 +57,7 @@ public class JwtService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return jwt.getClaim(USER_ID_CLAIM).asLong();
|
return jwt.getClaim(USER_ID_CLAIM).asLong();
|
||||||
} catch (JwtException | IllegalArgumentException | TokenExpiredException | JWTDecodeException ignored) {
|
} catch (JWTVerificationException | IllegalArgumentException ignored) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user