jwts signwith method depreacted

Summary

jwts signWith method deprecated

With JJWT >= 0.10.0, signWith(SignatureAlgorithm var1, String var2) has been deprecated because of the confusion between raw strings and Base64-encoded strings:

정말 친절하게 잘 설명되어 있다. 요지는 기존에 구현되어 있던 method 의 key 파라미터가 raw strings 과 Base64-encoded strings 간의 혼란으로 인해 deprecated 되었다는 내용이다.

또한, 우리가 잘 기억하고 써먹어야 할 부분은

As a result, it is recommended to use either the JWT builder’s signWith(Key) or signWith(Key, SignatureAlgorithm) methods which guarantee a type-safe Key argument. For example: Jwts.builder() //… .signWith(key) // or signWith(key, preferredSignatureAlgorithm) .compact(); signWith(Key) is recommended to let JJWT figure out the strongest algorithm possible based on the strength of your supplied key. signWith(Key,SignatureAlgorithm) allows you to specify a desired algorithm if you don’t want the strongest possible one.

Both methods will reject any Key that doesn’t meet the minimum RFC requirements.

이 부분이지 않을까 싶다.

결론적으로, 위와 같은 혼란을 없애고 jjwt 에서 자체적으로 제공하는 utility 함수인 secretKeyFor 를 통해 알고리즘 스펙에 맞는 적절한 랜덤키를 생성해 사용하는 것을 권장한다는 내용.

comments powered by Disqus