anan7741 2021-09-27 10:57 采纳率: 0%
浏览 29

springboot shiro 很奇怪,在密码和计算和库值相等情况下,验证死活不通过

很奇怪,在密码和计算和库值相等情况下,验证死活不通过

  /**
     * description: 主要是用来进行身份认证的,也就是说验证用户输入的账号和密码是否正确。
     *
     * @return 身份验证信息
     */
    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
        //获取用户的输入的账号.
        ShiroToken token = (ShiroToken) authcToken;


        Admin admin = adminService.selectByMobile(token.getUsername());
        Admin a2=new Admin();
        a2.setPassword(token.getPwd());
        a2.setCreateTime(admin.getCreateTime());
        System.out.println("输入值:"+a2.getPassword());
        System.out.println("计算值:"+passwordUtil.getEncryptPwd(a2.getPassword(),a2.getCreateTime()));
        if (null == admin) {
            throw new UnknownAccountException("账号不存在");
        }
        token.setId(admin.getId());
        AftUser aftUser = admin;
        System.out.println("库 值:"+aftUser.getPassword());
        System.out.println("盐:"+ aftUser.getCreateTime());

        return new SimpleAuthenticationInfo(aftUser, aftUser.getPassword(), passwordUtil.getAftSalt(aftUser),
                getName());
    
    }
输入值:123456
计算值:41b9bf03ac0bb6988f6fc81433658a07
库 值:41b9bf03ac0bb6988f6fc81433658a07
盐:Thu Nov 01 11:13:18 CST 2018

2021/09/27-10:49:14 ERROR [dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [com.kede.core.shiro.token.ShiroToken - admin, rememberMe=false] did not match the expected credentials.] with root cause
org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [com.kede.core.shiro.token.ShiroToken - admin, rememberMe=false] did not match the expected credentials.

  • 写回答

2条回答 默认 最新

  • Tomshidi 2021-09-27 11:06
    关注

    不会是用了 == 判断了两个字符串吧

    评论

报告相同问题?

问题事件

  • 请采纳用户回复 1月6日
  • 创建了问题 9月27日

悬赏问题

  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目