星空网 > 软件开发 > ASP.net

跟我学习shiro权限框架(第一天)

shiro介绍

1.1     什么是shiro

shiro是apache的一个开源框架,是一个权限管理的框架,实现 用户认证、用户授权。

 

spring中有spring security (原名Acegi),是一个权限框架,它和spring依赖过于紧密,没有shiro使用简单。

shiro不依赖于spring,shiro不仅可以实现 web应用的权限管理,还可以实现c/s系统,分布式系统权限管理,shiro属于轻量框架,越来越多企业项目开始使用shiro。

 

 

使用shiro实现系统 的权限管理,有效提高开发效率,从而降低开发成本。

1.2     shiro架构

subject:主体,可以是用户也可以是程序,主体要访问系统,系统需要对主体进行认证、授权。

securityManager:安全管理器,主体进行认证和授权都 是通过securityManager进行。

 

authenticator:认证器,主体进行认证最终通过authenticator进行的。

 

authorizer:授权器,主体进行授权最终通过authorizer进行的。

 

sessionManager:web应用中一般是用web容器对session进行管理,shiro也提供一套session管理的方式。

SessionDao:  通过SessionDao管理session数据,针对个性化的session数据存储需要使用sessionDao。

 

cache Manager:缓存管理器,主要对session和授权数据进行缓存,比如将授权数据通过cacheManager进行缓存管理,和ehcache整合对缓存数据进行管理。

 

realm:域,领域,相当于数据源,通过realm存取认证、授权相关数据。

 

注意:在realm中存储授权和认证的逻辑。

 

cryptography:密码管理,提供了一套加密/解密的组件,方便开发。比如提供常用的散列、加/解密等功能。

 

比如 md5散列算法。

 

 

1.3     jar包

与其它java开源框架类似,将shiro的jar包加入项目就可以使用shiro提供的功能了。shiro-core是核心包必须选用,还提供了与web整合的shiro-web、与spring整合的shiro-spring、与任务调度quartz整合的shiro-quartz等,下边是shiro各jar包的maven坐标。

 

   <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-core</artifactId>

         <version>1.2.3</version>

      </dependency>

      <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-web</artifactId>

         <version>1.2.3</version>

      </dependency>

      <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-spring</artifactId>

         <version>1.2.3</version>

      </dependency>

      <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-ehcache</artifactId>

         <version>1.2.3</version>

      </dependency>

     <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-quartz</artifactId>

         <version>1.2.3</version>

      </dependency>

 

也可以通过引入shiro-all包括shiro所有的包:

   <dependency>

         <groupId>org.apache.shiro</groupId>

         <artifactId>shiro-all</artifactId>

         <version>1.2.3</version>

      </dependency>

 

参考lib目录:  

2       shiro认证

2.1    shiro认证流程

 

2.2     shiro入门程序工程 环境

jar包:shiro-core.jar

跟我学习shiro权限框架(第一天)
 博客持续更新,将所有shiro知识点逐步剖析,各位好学的朋友可以搁我一起同步~~

java企业级通用权限安全框架源码 SpringMVC mybatis or hibernate+ehcache shiro druid bootstrap HTML5

【java框架源码下载】

 




原标题:跟我学习shiro权限框架(第一天)

关键词:Shiro

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

国外商标注册:服务实力强,让你轻松出海:https://www.kjdsnews.com/a/1314008.html
国外品牌在国内申请商标注册:破解复杂的流程与细节:https://www.kjdsnews.com/a/1314009.html
国外品牌商标有什么新技术你必须知道!:https://www.kjdsnews.com/a/1314010.html
国内商标:唯一性是否有保障?:https://www.kjdsnews.com/a/1314011.html
商标申请:宣誓费用攻略:https://www.kjdsnews.com/a/1314012.html
商标注册:快7个月即可拿到证书:https://www.kjdsnews.com/a/1314013.html
皇帝的皇宫=:https://www.vstour.cn/a/363188.html
海南岛琼海市旅游景点 琼海市的旅游景点:https://www.vstour.cn/a/363189.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流