004-shiro简介
一、什么是shiro
shiro是apache的一个开源框架,是一个权限管理的框架,实现 用户认证、用户授权。
spring中有spring security (原名Acegi),是一个权限框架,它和spring依赖过于紧密,没有shiro使用简单。
shiro不依赖于spring,shiro不仅可以实现 web应用的权限管理,还可以实现c/s系统,分布式系统权限管理,shiro属于轻量框架,越来越多企业项目开始使用shiro。
使用shiro实现系统 的权限管理,有效提高开发效率,从而降低开发成本。
二、shiro架构
subject【org.apache.shiro.subject.Subject】:主体,可以是用户也可以是程序,主体要访问系统,系统需要对主体进行认证、授权。
securityManager【org.apache.shiro.mgt.SecurityManager】:安全管理器,主体进行认证和授权都 是通过securityManager进行。
authenticator【org.apache.shiro.authc.Authenticator】:认证器,主体进行认证最终通过authenticator进行的。
authorizer【org.apache.shiro.authz.Authorizer】:授权器,主体进行授权最终通过authorizer进行的。
sessionManager【org.apache.shiro.session.SessionManager】:web应用中一般是用web容器对session进行管理,shiro也提供一套session管理的方式。
SessionDao: 通过SessionDao管理session数据,针对个性化的session数据存储需要使用sessionDao。
cache Manager【org.apahce.shiro.cache.CacheManager】:缓存管理器,主要对session和授权数据进行缓存,比如将授权数据通过cacheManager进行缓存管理,和ehcache整合对缓存数据进行管理。
realm【org.apache.shiro.realm.Realm】:域,领域,相当于数据源,通过realm存取认证、授权相关数据。
注意:在realm中存储授权和认证的逻辑。
cryptography【org.apache.shiro.crypto.*】:密码管理,提供了一套加密/解密的组件,方便开发。比如提供常用的散列、加/解密等功能。
比如 md5散列算法。
三、相关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
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-all</artifactId>
<version>1.2.3</version>
</dependency>
004-shiro简介的更多相关文章
- 跟开涛老师学shiro -- shiro简介
1.1 简介 Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可能没有Spring Securi ...
- (1)shiro简介和第一个demo
之前一直在用shiro开发,不过只是会使用,并没有深入了解,最近有时间学习了一下,把最近学习所得分享一下. shiro简介 Apache Shiro是一个强大且易用的Java安全框架,执行身份验证.授 ...
- springboot+mybatis+shiro——shiro简介
转载:[一]shiro入门 之 Shiro简介 一.shiro介绍: 官方网址:http://shiro.apache.org/introduction.html,shiro的功能包括:认证.授权.加 ...
- Shiro简介、入门案例、web容器的集成
目的: shiro简介 Shiro入门案例 Shiro与web容器的集成 shiro简介(中文官网:https://www.w3cschool.cn/shiro/andc1if0.html) 1.什么 ...
- (一)shiro简介和用户登录demo及角色管理
一.shiro简介 Apache Shiro是Java的一个安全框架.Shiro可以非常容易的开发出足够好的应用,其不仅可以用在JavaSE环境,也可以用在JavaEE环境.Shiro可以帮助我们完成 ...
- 【Shiro】一、Apache Shiro简介
一.Apache Shiro简介 1.简介 一个安全性框架 特点:功能丰富.使用简单.运行独立 核心功能: Authentication(认证):你是谁? Authorization(授权):谁能干什 ...
- 第一章 Shiro简介——《跟我学Shiro》(转)
目录贴:跟我学Shiro目录贴 1.1 简介 Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可 ...
- Shiro简介
1.简介 Apache Shiro是一个功能强大且易于使用的Java安全框架,进行身份验证,授权,加密和会话管理,可用于保护任何应用程序 - 从命令行应用程序,移动应用程序到大型的Web应用和企业应用 ...
- 第一章:shiro简介
1.1 简介 Apache Shiro是java的一个安全框架,相当简单,没有Spring Security功能强大,但是实际工作中大多使用shiro就够了.可以帮助我们完成:认证,授权,加密,会话管 ...
- 《跟我学Shiro》学习笔记 第一章:Shiro简介
前言 现在在学习Shiro,参照着张开涛老师的博客进行学习,然后自己写博客记录一下学习中的知识点,一来可以加深理解,二来以后遗忘了可以查阅.没有学习过Shiro的小伙伴,也可以和我一起学习,大家共同进 ...
随机推荐
- 【问题记录】mybatis开启事务方法时,一级缓存可能引发的问题
首先,上代码: public void listMybatisModel() { List<MybatisModel> mybatisModels = mapper.listMybatis ...
- 两款 REST 测试工具
用CURL命令行测试REST API 无疑是低效率的,这里把最近使用的两款 Chrome 插件总结下 POSTMAN 简单易用 REST Console 功能强大 使用的话用POSTMAN就够用了,但 ...
- The Boss on Mars
The Boss on Mars Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 自动化软件部署的shell脚本
在实际项目中,我们经常用到需要自动化部署软件的情况,这种情况下,我们就不能人为地在命令行下敲击命令了,一切都需要通过shell脚本自动化完成.所谓自动化完成,其实也就是通过写shell程序,模拟人为敲 ...
- git clone ....git
[root@st153 git_test3]# git clone git@gitlab.gaobo.com:root/pythontest1.gitCloning into 'pythontest1 ...
- pl/sql 实例精解 05
本章主要讨论 case 语句 1: case [SELECTOR] 2: when expression 1 then statement 1; 3: when expression 2 then s ...
- 使用BestSync同步软件与坚果云同步
坚果云的免费用户可以享受每个月的1G上传与3G下载流量,同时号称是国内唯一支持WebDAV的云.我的工作备份的文档不多,正好手头有BestSync同步软件可以用.决定试试BestSync的与WebDA ...
- 嵌入式开发之davinci--- 8148/8168/8127 中的图像采集格式Sensor信号输出YUV、RGB、RAW DATA、JPEG 4种方式区别
简单来说,YUV: luma (Y) + chroma (UV) 格式, 一般情况下sensor支持YUV422格式,即数据格式是按Y-U-Y-V次序输出的RGB: 传统的红绿蓝格式,比如RGB565 ...
- XStream的基本使用
先准备两个bean public class Book { private int bookId; private String bookName; private String bookCode; ...
- Python_selenium之窗口切换
Python_selenium之窗口切换 1. 运用switch_to.window()方法来进行窗口切换 2. 思路拆分: 浏览器获取百度贴吧网址 点击定位到一个元素,获取当前的句柄 获得所有的句柄 ...