Shiro 下的principal 注意


在用户登陆证realm

认证返回结果注意

 return new SimpleAuthenticationInfo(sysUserDO,sysUserDO.getPassword(),ByteSource.Util.bytes(sysUserDO.getSalt()),getName());

这里

sysUserDO 第一个参数可为用户名
 return new SimpleAuthenticationInfo(username,sysUserDO.getPassword(),ByteSource.Util.bytes(sysUserDO.getSalt()),getName());

这里其实是user和username的集合,后端是分两个字段接收的

后段代码  下面进行了判断,不是Collection 即为用户名

    public SimplePrincipalCollection(Object principal, String realmName) {
        if (principal instanceof Collection) {
            addAll((Collection) principal, realmName);
        } else {
            add(principal, realmName);
        }
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM