Shiro权限框架
--观点:
学习任何的知识,我们首先要知道它是什么,然后通过是什么(定义)来分析它的作用、行为。从而圈定学习的范围。我们将这个过程称为,学习思路!!
1.Shiro概述
1.1.Shiro是什么
官方说明:
href="#what-is-apache-shiro-"WhatisApacheShiro?
ApacheShiroisapowerfulandflexibleopen-sourcesecurityframeworkthatcleanlyhandlesauthentication,authorization,enterprisesessionmanagementandcryptography.
Shiro是一个非常强大的、易于使用的、开源的、权限框架。它包括了权限校验、权限授予、会话管理、安全加密等组件。
1.2.为什么需要使用Shiro(兴趣点)
如果你是需要设计RBAC(RoleBasedAccessControl)基础系统,需要编写大量用于权限控制的代码时。那么你需要使用Shiro。因为Shiro已经将RBAC系统大量的代码封装好,可以减少我们大量的工作量。
如:页面的显示的HTML控件根据登录用户的权限不同而不同。使用Shiro可以轻松解决。
1.3.Shiro的下载
shiro的下载路径:http://shiro.apache.org/download.html
--所有包的说明,根据列表的说明,下载我们需要的jar包
包名
Maven坐标
说明
shiro-all
NotRecommended
IncludesallbinaryfunctionalityforShiro
shiro-core
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.3.2</version>
</dependency>
Requiredinallenvironments.Slf4j'sslf4j-apijarandone
ofitsbindingjarsisrequired.commons-beanutilsisrequiredonlyifusingINIconfig.
只要使用shiro必须的核心包,它依赖slf4j和commons-beanutils以及还需要一个INI配置文件
shiro-web
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.3.2</version>
</dependency>
Enablessupportforweb-basedapplications.
支持基于Web的应用
shiro-aspectj
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-aspectj</artifactId>
<version>1.3.2</version>
</dependency>
EnablesAspectJsupportforShiroAOPandAnnotations.
shiro-cas
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-cas</artifactId>
<version>1.3.2</version>
</dependency>
EnablesJasigCASsupport.
NOTE:
Shiro-CASsupportisdeprecated,supporthasbeenmovedto
theApacheShirobasedbuji-pac4jproject.
对cas单点登录框架的支持
shiro-ehcache
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.3.2</version>
</dependency>
EnablesEhcache-basedfameworkcaching.
对echche缓存框架的支持
shiro-hazelcast
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-hazelcast</artifactId>
<version>1.3.2</version>
</dependency>
EnablesHazelcast-basedfameworkcaching.
shiro-features
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-features</artifactId>
<version>1.3.2</version>
</dependency>
OSGi/ApacheKarafintegration.
shiro-guice
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-guice</artifactId>
<version>1.3.2</version>
</dependency>
EnablesGoogleGuiceintegration.
guice类似spring的ioc框架。
shiro-quartz
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-quartz</artifactId>
<version>1.3.2</version>
</dependency>
EnablesQuartz-basedschedulingforShironativesessionvalidation.
quartz定时器框架
shiro-spring
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.3.2</version>
</dependency>
EnablesSpringFrameworkintegration.
1.4.包说明
--Shiro常用包
1.5.Shiro结构图
Authentication:权限校验,每次操作校验用户是否有访问权限
Authorization:授权,用户登录时,授予用户对应的权限
SessionManagement:会话管理,用于记录用户的登录状态
Cryptography:加密,加密算法的实现(SHA、MD5)
webSupport:对Web项目的支持,Shiro的标签!!
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h56953.shtml