shiro 配置-ini配置方式
来源:互联网 发布:淘宝购买不了系统繁忙 编辑:程序博客网 时间:2024/06/07 09:19
ini文件格式
1. [main]
[main]sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher MyRealm = com.company.security.shiro.DatabaseRealmmyRealm.connectionTimeout = 30000myRealm.username= jsmithmyRealm.password = secretmyRealm.credentialsMatcher = $sha256MatchersecurityManager.sessionManager.globalSessionTimeout = 1800000
上述实例包括
1.定义对象
2.设置对象属性,如果是原始类型的值,就直接设置。如果是引用类型的值,就用$+名称的方式来设置。密码值,map,set,list
3.可以使用遍历对象图的方式来设置数据
4.securityManager是缺省对象
[main]配置的内容
- 定义加密方式 密码进制 认证域 认证策略 认证器
- 给认证域 设置加密方式
- 给认证器 设置认证域和认证策略
- 给securityManager 设置认证器
[main]#sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher #sha256Matcher.storedCredentialsHexEncoded = false#iniRealm.credentialsMatcher = $sha256MatchermyRealm1 = cn.javass.hello.MyRealm1myRealm2 = cn.javass.hello.MyRealm2authenticator=org.apache.shiro.authc.pam.ModularRealmAuthenticatorauthcStrategy=org.apache.shiro.authc.pam.AllSuccessfulStrategyauthenticator.authenticationStrategy = $authcStrategyauthenticator.realms = $myRealm1, $myRealm2securityManager.authenticator = $authenticator
2. [users] 定义一组静态的用户账户
[users]javass=cc,role1
每行的格式: username = password,rolename1,rolename2……
自动初始化realm:仅定义非空的[users]或[roles],section会自动创建IniRealm的实例,并使它在[main]可以用并且名为iniRealm
加密密码 16进制
// 获取密码的hex加密字符串 16进制String ss = new Sha256Hash("cc").toHex();
[main]sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher iniRealm.credentialsMatcher = $sha256Matcher[users]javass = 355b1bbfc96725cdce8f4a2708fda310a80e6d13315aec4e5eed2a75fe8032ce,role1
加密密码 64进制
//获取密码的hex加密字符串 64进制String ss1 = new Sha256Hash("cc").toBase64();
[main]sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher sha256Matcher.storedCredentialsHexEncoded = falseiniRealm.credentialsMatcher = $sha256Matcher[users]javass = NVsbv8lnJc3Oj0onCP2jEKgObRMxWuxOXu0qdf6AMs4=,role1
3. [roles]
把角色和权限关联起来
[roles]role1="p1:create,update",p2
每行格式: rolename = permissionName1,permissionName2……
4.[urls]
和web相关 ,到web时再学习
阅读全文
0 0
- shiro 配置-ini配置方式
- shiro.ini 配置详解
- shiro ini 配置
- shiro.ini 配置详解
- shiro-ini 配置
- Shiro基础知识04-----INI配置
- shiro 框架之ini配置
- Shiro学习(4)INI配置
- Shiro学习(4)INI配置
- Shiro框架Ini配置(四)
- 关于shiro的.ini文件配置
- Apache shiro集群实现 (二) shiro 的INI配置
- Apache shiro集群实现 (二) shiro 的INI配置
- Apache shiro集群实现 (二) shiro 的INI配置
- Shiro学习笔记(4)——ini 配置
- 第四章 INI配置——《跟我学Shiro》
- 第四章 INI配置——《跟我学Shiro》
- zeppelin-0.6.2-bin-all/conf/shiro.ini配置详情
- jquery的each()
- 理解 JS 回调函数中的 this
- 硬盘dd技巧,硬盘拷贝操作步骤和技巧
- QPSQL driver not loaded
- UVa 213Message Decoding新手解法
- shiro 配置-ini配置方式
- 构造方法和普通方法的区别
- 查看Linux服务器的负载情况
- AI实现方式探索和演变 ——神经网络+增强学习
- 课本P77.习题5.(3)整数十进制转换成二~九进制
- web——栅格系统
- 一个简单的socket监听的服务器实例
- 随意间翻看的一封信
- SqlServer Case When用法