Apache Shiro

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(会话管理)
(pac4j)
 
(未显示1个用户的10个中间版本)
第1行: 第1行:
 
{{SeeWikipedia}}
 
{{SeeWikipedia}}
  
 +
Apache Shiro
 +
 +
==简介==
 
Apache Shiro:[[Java]]安全框架,提供了认证、授权、加密和会话管理功能,可为任何应用提供安全保障,从命令行应用、移动应用到大型网络及企业应用。
 
Apache Shiro:[[Java]]安全框架,提供了认证、授权、加密和会话管理功能,可为任何应用提供安全保障,从命令行应用、移动应用到大型网络及企业应用。
 
[[文件:apache-shiro.png|right]]
 
[[文件:apache-shiro.png|right]]
==简介==
+
 
Shiro功能:
+
==功能==
 +
Authentication(认证), Authorization(授权), Session Management(会话管理), Cryptography(加密)被 Shiro 开发团队称之为应用安全的四大基石。
 +
 
 +
Shiro 功能:
 
*基于POJO/J2SE(IoC友好);
 
*基于POJO/J2SE(IoC友好);
 
*认证:用户身份识别;
 
*认证:用户身份识别;
第45行: 第51行:
 
*[http://sangeeth.github.io/java/shiro/rbac-using-shiro.html RBAC using Apache Shiro]
 
*[http://sangeeth.github.io/java/shiro/rbac-using-shiro.html RBAC using Apache Shiro]
  
==案例==
+
==pac4j==
 +
集成 [[Central Authentication Service]] (CAS), [[OAuth]], [[SAML]], [[OpenID]] Connect, [[LDAP]], [[JSON Web Token|JWT]] ...
 +
 
 +
[[文件:pac4j-apache-shiro.png]]
 +
 
 +
[https://github.com/bujiio/buji-pac4j pac4j security engine for Shiro]
 +
 
 +
==Spring==
 +
集成对 [[Spring]] Framework 和 Spring Boot 的支持
 +
*[https://shiro.apache.org/spring-framework.html Spring Framwork]
 +
*[https://shiro.apache.org/spring-boot.html Spring Boot]
 +
 
 +
==集成==
 +
[http://shiro.apache.org/integration.html Apache Shiro Integrations]
 +
 
 +
==用户==
 
*[[Apache Usergrid]]
 
*[[Apache Usergrid]]
 
*[[Apache Isis]]
 
*[[Apache Isis]]
 
*[[Moqui]]
 
*[[Moqui]]
 +
*[[Axelor]] Open Platform
  
 
==文档==
 
==文档==
第58行: 第80行:
 
image:Apache-Shiro.png|架构
 
image:Apache-Shiro.png|架构
 
image:shiro-features.png|功能
 
image:shiro-features.png|功能
 +
image:Apache-Shiro-Authentication-Sequence.png|认证序列
 
</gallery>
 
</gallery>
  
 
==链接==
 
==链接==
 
*[http://shiro.apache.org/ Apache Shiro官网]
 
*[http://shiro.apache.org/ Apache Shiro官网]
 +
*[https://github.com/apache/shiro Apache Shiro @ GitHub]
 
*[http://docs.huihoo.com/apache/shiro/ Shiro文档]
 
*[http://docs.huihoo.com/apache/shiro/ Shiro文档]
 
*[http://docs.huihoo.com/mavendoc/apache/shiro Apache Shir Maven Doc]
 
*[http://docs.huihoo.com/mavendoc/apache/shiro Apache Shir Maven Doc]
第70行: 第94行:
 
[[category:java]]
 
[[category:java]]
 
[[category:apache]]
 
[[category:apache]]
[[category:huihoo]]
 

2021年7月31日 (六) 03:03的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Apache Shiro Thanks, Wikipedia.

Apache Shiro

目录

[编辑] 简介

Apache Shiro:Java安全框架,提供了认证、授权、加密和会话管理功能,可为任何应用提供安全保障,从命令行应用、移动应用到大型网络及企业应用。

Apache-shiro.png

[编辑] 功能

Authentication(认证), Authorization(授权), Session Management(会话管理), Cryptography(加密)被 Shiro 开发团队称之为应用安全的四大基石。

Shiro 功能:

  • 基于POJO/J2SE(IoC友好);
  • 认证:用户身份识别;
  • 授权:访问控制;
  • 密码加密:保护或隐藏数据防止被偷窥;
  • 会话管理:每用户相关的时间敏感的状态;
  • 集群管理:支持Ehcache, Coherence, GigaSpaces等方案;
  • 事件监听:监听会话期间的生命周期事件,如:会话超时时更新用户记录;
  • 用于单点登录(SSO)

[编辑] 核心概念

Apache Shiro有三个核心概念:Subject,SecurityManager和Realms

[编辑] Subject

import org.apache.shiro.subject.Subject;
import org.apache.shiro.SecurityUtils;
...
Subject currentUser = SecurityUtils.getSubject();

一旦获得Subject,你就可以立即获得你希望用Shiro为当前用户做的90%的事情,如登录、登出、访问会话、执行授权检查等 - 稍后还会看到更多。

[编辑] SecurityManager

Subject的“幕后”推手是SecurityManager。Subject代表了当前用户的安全操作,SecurityManager则管理所有用户的安全操作。它是Shiro框架的核心,充当“保护伞”,引用了多个内部嵌套安全组件,它们形成了对象图。

[编辑] Realms

Realm充当了Shiro与应用安全数据间的“桥梁”或者“连接器”。也就是说,当切实与像用户帐户这类安全相关数据进行交互,执行认证(登录)和授权(访问控制)时,Shiro会从应用配置的Realm中查找很多内容。

Realm实质上是一个安全相关的DAO:它封装了数据源的连接细节,并在需要时将相关数据提供给Shiro。

[编辑] 会话管理

Shiro的架构允许可插拔的会话数据存储,如企业缓存、关系数据库、NoSQL系统等。

[编辑] RBAC

RBAC是一套成熟的权限模型。在传统权限模型中,我们直接把权限赋予用户。而在RBAC中,增加了“角色”的概念,我们首先把权限赋予角色,再把角色赋予用户。这样,由于增加了角色,授权会更加灵活方便。在RBAC中,根据权限的复杂程度,又可分为RBAC0、RBAC1、RBAC2、RBAC3。其中,RBAC0是基础,RBAC1、RBAC2、RBAC3都是以RBAC0为基础的升级。我们可以根据自家产品权限的复杂程度,选取适合的权限模型。

RBAC.png

[编辑] pac4j

集成 Central Authentication Service (CAS), OAuth, SAML, OpenID Connect, LDAP, JWT ...

Pac4j-apache-shiro.png

pac4j security engine for Shiro

[编辑] Spring

集成对 Spring Framework 和 Spring Boot 的支持

[编辑] 集成

Apache Shiro Integrations

[编辑] 用户

[编辑] 文档

[编辑] 图集

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱