shiro 配置-ini配置方式
2017-09-26 16:29
148 查看
ini文件格式
上述实例包括
1.定义对象
2.设置对象属性,如果是原始类型的值,就直接设置。如果是引用类型的值,就用$+名称的方式来设置。密码值,map,set,list
3.可以使用遍历对象图的方式来设置数据
4.securityManager是缺省对象
[main]配置的内容
定义加密方式 密码进制 认证域 认证策略 认证器
给认证域 设置加密方式
给认证器 设置认证域和认证策略
给securityManager 设置认证器
每行的格式: username = password,rolename1,rolename2……
自动初始化realm:仅定义非空的[users]或[roles],section会自动创建IniRealm的实例,并使它在[main]可以用并且名为iniRealm
加密密码 16进制
加密密码 64进制
每行格式: rolename = permissionName1,permissionName2……
1. [main]
[main] sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher MyRealm = com.company.security.shiro.DatabaseRealm myRealm.connectionTimeout = 30000 myRealm.username= jsmith myRealm.password = secret myRealm.credentialsMatcher = $sha256Matcher securityManager.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 = $sha256Matcher myRealm1 = cn.javass.hello.MyRealm1 myRealm2 = cn.javass.hello.MyRealm2 authenticator=org.apache.shiro.authc.pam.ModularRealmAuthenticator authcStrategy=org.apache.shiro.authc.pam.AllSuccessfulStrategy authenticator.authenticationStrategy = $authcStrategy authenticator.realms = $myRealm1, $myRealm2 securityManager.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 = false iniRealm.credentialsMatcher = $sha256Matcher [users] javass = NVsbv8lnJc3Oj0onCP2jEKgObRMxWuxOXu0qdf6AMs4=,role1
3. [roles]
把角色和权限关联起来[roles] role1="p1:create,update",p2
每行格式: rolename = permissionName1,permissionName2……
4.[urls]
和web相关 ,到web时再学习相关文章推荐
- Java安全框架 Apache Shiro学习-1-ini 配置
- shiro ini 配置
- shiro.ini 配置详解
- spring中 shiro logout 配置方式
- 多种方式找出PHP配置文件php.ini的路径总结
- Apache shiro集群实现 (二) shiro 的INI配置
- Apache shiro集群实现 (二) shiro 的INI配置
- Shiro基础知识04-----INI配置
- 储存应用程序的配置信息ini实现方式
- Apache shiro集群实现 (二) shiro 的INI配置
- shiro框架(四)- INI配置
- 无须修改php.ini等配置文件,修复session_start错误的方式
- shiro.ini配置FormAuthenticationFilter验证、缓存、session、并发限制
- [置顶] 自学-Shiro中多个Realms的另外一种配置方式-11
- java鬼混笔记:shiro 1、基本ini配置文件的登录认证
- 跟开涛老师学shiro -- INI配置
- 简单两步快速实现shiro的配置和使用,包含登录验证、角色验证、权限验证以及shiro登录注销流程(基于spring的方式,使用maven构建)
- spring整合shiro使用注解方式配置
- Apache Shiro学习笔记(四)INI配置
- shiro 框架之ini配置