com.auth0.jwt.exceptions.SignatureVerificationException报错解决
使用Shiro+jwt验签时报这个错误
com.auth0.jwt.exceptions.SignatureVerificationException: The Token's Signature resulted invalid when verified using the Algorithm: HmacSHA512
其实就是签发签名的secret是未加密的,在签发加密和验签解密的时候会导致字节流不一致,报签名错误。只要使用加密后的screct去签发验签就好了。
比如用前端传的密码(未加密)签发加密和验签解密,ro为前端请求传过来的json对象,这时候就会报错。
String token = JwtUtil.sign(userContext, ro.getPassword());
改成加密过后的密码就可以了(数据库存的)
String token = JwtUtil.sign(userContext, user.getPassword());
顺便Diss下那些收费的。