博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
shiro设置加密算法源码解析
阅读量:4562 次
发布时间:2019-06-08

本文共 1187 字,大约阅读时间需要 3 分钟。

本文首次发布于,作者,转载请保留原文链接。

自定义Realm继承AuthorizingRealm父类。

HashedCredentialsMatcher 实例化并设置加密算法。

源码:

public AuthorizingRealm(CredentialsMatcher matcher) {        this((CacheManager)null, matcher);    }设置迭代次数:   public void setHashIterations(int hashIterations) {        if (hashIterations < 1) {            this.hashIterations = 1;        } else {            this.hashIterations = hashIterations;        }    }

最后把实例化HashedCredentialsMatcher对象通过父类构造方法设置。

源码:

public void setCredentialsMatcher(CredentialsMatcher credentialsMatcher) {        this.credentialsMatcher = credentialsMatcher;    }    public interface CredentialsMatcher {        boolean doCredentialsMatch(AuthenticationToken var1, AuthenticationInfo var2);    }    HashedCredentialsMatcher实现CredentialsMatcher接口

源码:

public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {        Object tokenHashedCredentials = this.hashProvidedCredentials(token, info);        Object accountCredentials = this.getCredentials(info);        return this.equals(tokenHashedCredentials, accountCredentials);    }

006tKfTcgy1fqj5aochgoj309k09kmwz.jpg

扫描关注:热爱生活的大叔
转载本站文章请注明作者和出处
热爱生活的大叔-uniquezhangqi

转载于:https://www.cnblogs.com/uniquezhangqi/p/9199469.html

你可能感兴趣的文章
字符串加密算法
查看>>
Oracle的实例恢复解析
查看>>
UICollectionView cellForItemAt 不被调用
查看>>
巧用网盘托管私人Git项目
查看>>
python全栈脱产第19天------常用模块---shelve模块、xml模块、configparser模块、hashlib模块...
查看>>
[LeetCode] House Robber
查看>>
virtualbox中kali虚拟机安装增强功能
查看>>
java生成六位验证码
查看>>
iOS的MVP设计模式
查看>>
stringstream
查看>>
【转】HDU 6194 string string string (2017沈阳网赛-后缀数组)
查看>>
前后端分离
查看>>
存储过程
查看>>
福特F-550 4x4 越野房车设计方案欣赏_房车欣赏_21世纪房车网
查看>>
建立个长春互联网群
查看>>
生成器
查看>>
将一个数的每一位都取出来的方法!
查看>>
2) 十分钟学会android--建立第一个APP,执行Android程序
查看>>
面试题8:二叉树下的一个节点
查看>>
hash冲突的解决方法
查看>>