I need to use JWT in mi API, and the IDE tells me that the .signWith() method is deprecated. So far I use the @Deprecated annotation, but I think this is not so good practice.
This is my example code:
@Deprecated
public String generateToken(UserDetails userDetails) {
return Jwts.builder().setSubject(userDetails.getUsername()).setIssuedAt(new Date())
.setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 10))
.signWith(SignatureAlgorithm.HS256, KEY).compact();
}