shiro中的自定义realm支持md5
来源:互联网 发布:网狐微信h5棋牌源码 编辑:程序博客网 时间:2024/06/05 14:31
一.引入jar包
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
二.自定义realm
创建的类继承抽象类AuthorizingRealm
实现它的两个方法
//用于认证的方法
protected AuthenticationInfo doGetAuthenticationInfo(
AuthenticationToken token) throws AuthenticationException
//用于授权的方法
protected AuthorizationInfo doGetAuthorizationInfo(
PrincipalCollection principals)
三.创建shiro-realmMD5.ini文件
[main]
#定义凭证匹配器
credentialsMatcher=org.apache.shiro.authc.credential.HashedCredentialsMatcher
#散列算法
credentialsMatcher.hashAlgorithmName=md5
#散列次数
credentialsMatcher.hashIterations=1
#将凭证匹配器设置到realm
customRealm=cn.swt.realm.CustomRealmMD5
customRealm.credentialsMatcher=$credentialsMatcher
securityManager.realms=$customRealm
四.书写测试类
五.测试结果
- shiro中的自定义realm支持md5
- Shiro第二篇【介绍Shiro、认证流程、自定义realm、自定义realm支持md5】
- 6、 Shiro中的自定义Realm
- Shiro入门7:修改自定义realm支持散列MD5密码对比
- shiro自定义Realm
- Shiro入门-自定义realm
- Shiro自定义Realm
- shiro自定义Realm实现
- Shiro 自定义realm认证
- 【shiro】--- 自定义realm
- Shiro(四) 自定义Realm
- shiro身份验证入门结合shiro的MD5加密技术自定义Realm-简单Demo
- 关于Shiro中的Realm
- shiro 权限框架自定义Realm
- (六)shiro自定义realm
- shiro笔记3《自定义Realm》
- shiro使用总结-自定义Realm
- 自定义realm shiro加密配置
- Spring cloud系列八 Hystrix的用处、解决的问题、工作流程图、断路器流程
- Banner轮播图的使用
- itext生成PDF,天坑
- 基础练习 数列特征
- L1-037. A除以B
- shiro中的自定义realm支持md5
- git合并多个commit压缩成一个点
- 求质数
- eclipse反编译到c++报错代码,步步查看堆栈
- Spring DateSoure 注解注入
- 密码学——公钥与私钥
- error: ‘for’ loop initial declarations are only allowed in C99 mode
- Tablayout的基础使用
- Gradient Descent梯度下降算法 优化