想学Shior、那就先了解它
1. 什么是权限?
权限分为很多种,功能权限,数据权限,管理权限等等。简单来说让指定的用户只能去操作指定的权限也就是增删改查
2. 主流的权限框架 Spring Security 、 Apache Shiro
**Spring Security:**是一个功能强大且高度定制的身份验证和访问控制框架。它是保护基于Spring的应用程序的事实上的标准。SpringSecurity是一个侧重于向Java应用程序提供身份验证和授权的框架。与所有Spring项目一样,SpringSecurity的真正强大之处在于它能够很容易地扩展以满足自定义需求。
(全面和可扩展的身份验证和授权支持、防止攻击,如会话固定、点击劫持、跨站点请求伪造等、ServletAPI集成、与SpringWebMVC的可选集成等)
Apache Shiro: 是一个功能强大、易于使用的Java安全框架,可以执行身份验证、授权、加密和会话管 理。通过Shiro易于理解的API,您可以快速轻松地保护任何应用程序——从最小的移动应用程序到最大的web和企业应用程序。
3. 两个的优缺点
-
Apache Shiro比Spring Security , 前者使用更简单
-
Shiro 功能强大、 简单、灵活不跟任何的框架或者容器绑定,可以独立运行
-
Spring Security脱离Spring体系则很难开发
-
SpringSecutiry 支持Oauth鉴权 Shiro需要自己实现
所以Shiro 相对于新手来说是个很不错的选择
4. Shiro 的四个模块
Authentication:Sometimes referred to as ‘login’, this is the act of proving a user is who they say they are.
(身份验证:有时也称为“登录”,这是证明用户是谁的行为。)
Authorization: The process of access control, i.e. determining ‘who’ has access to ‘what’.
(授权:访问控制的过程,即确定“谁”有权访问“什么”。)
Session Management:Managing user-specific sessions, even in non-web or EJB applications.
(会话管理:管理特定于用户的会话,即使是在非web或EJB应用程序中。)
Cryptography: Keeping data secure using cryptographic algorithms while still being easy to use.
(密码学:使用加密算法保护数据安全,同时仍然易于使用。)
5. 详细的架构