最近,在学shiro的碰到如下报错:
登录认证失败!!!org.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - haha, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
随便记录一下。
//定义一个盐值
ByteSource salt=ByteSource.Util.bytes(user.getId());//按用户id创建盐值
报错代码就一行。原本想着用用户id来创建颜值的,结果报错了。查了下,发现是用户id是int类型的,而bytes方法没有形参为int的构造方法。所以就转成String 或其他类型就ok了。