shiro

How do concepts of User (UserAccount) and Realm relate in Apache Shiro?

99封情书 提交于 2019-11-30 22:37:18
I'm reading up on Apache Shiro and like to see if I got this mental model right. From the docs : "A Realm is a component that can access application-specific security data such as users , roles , and permissions ". .. "Realms usually have a 1-to-1 correlation with a data source such as a relational database, LDAP directory, file system, or other similar resource. " Moreover, I've read that an application may include multiple realms for its authentication and authorization purposes. Ok so great, but how do this Realms relate to the concept of a User? is every Realm expected to be a partition

How to implement row-level security in Java?

怎甘沉沦 提交于 2019-11-30 19:46:47
I am currently evaluating authentication / authorization frameworks. Apache Shiro seems to be very nice but I am missing row-level security features. E.g. there might be special rows in a database which should only visible and accessible by users with special privileges. To avoid unnecessary round-trips, we currently modify the SQL queries to join with our authorization data to get only the visible rows for the current user. But this concepts doesn't feel 'right' to me, because we mix business code with security related code which should be orthogonal and independent from each other. What

shiro小记

落花浮王杯 提交于 2019-11-30 19:14:12
今天主要看了shiro的认证,授权功能初步了解了一下,其他的功能用的不多,之后再看。 认证 下面的例子是以继承了AuthenticatingRealm的自定义Realm来实现自定义认证。 认证依赖于方法doGetAuthenticationInfo,需要返回一个AuthenticationInfo,通常返回一个他的子类SimpleAuthenticationInfo,构造方法的第一个参数是用户名,第二个是验证密码,第三个是当前realm的className。 package com.demo.realms; import org.apache.shiro.authc.*; import org.apache.shiro.realm.AuthenticatingRealm; public class MyRealm extends AuthenticatingRealm { @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) { System.out.println("MyRealm认证中---->用户:"+token.getPrincipal()); // 可以从token中获取用户名来从数据库中查询数据 UsernamePasswordToken

你需要具备这些条件才能更好的学习Spring Security 和Apache Shiro

ⅰ亾dé卋堺 提交于 2019-11-30 18:59:18
前言 web应用达到生产需要就必须有安全控制。java web领域经常提及的两大开源框架主要有两种选择 Spring Security和Apache Shiro 。所以学习这两种框架也是java开发者提高水平的必经之路。从今天开始连续一段时间内,研究一下Spring Security。如果想学习的同学可以关注一下公众号: Felordcn 或者通过 https://felord.cn 来及时获取相关的干货。 Spring Security 和Apache Shiro 相对于Apache Shiro,Spring Security提供了更多的诸如 LDAP 、 OAuth2.0 、 ACL 、 Kerberos 、 SAML 、 SSO 、 OpenID 等诸多的安全认证、鉴权协议,可以按需引用。对认证/鉴权更加灵活,粒度更细。可以结合你自己的业务场景进行更加合理的定制化开发。在最新的Spring Security 5.x中更是提供了响应式应用(reactive application)提供了安全控制支持。从语言上来讲,支持使用kotlin、groovy进行开发。 Spring Security因为是利用了Spring IOC 和AOP的特性而无法脱离Spring独立存在。而Apache Shiro可以独立存在。但是Java Web领域Spring可以说是事实上的J2EE规范

shiro权限管理(认证和授权)

跟風遠走 提交于 2019-11-30 18:49:34
Shiro介绍 1.shiro介绍:Shirp是apache旗下一个开源框架,它将软件系统的安全认证相关的功能抽取出来,实现用户身份认证,权限授权,加密,会话管理等功能,组成一个通用的安全认证框架。 2.Shiro框架 3.对象: a) Subject:主体,外部应用与subject进行交互,subject记录了当前操作用户,将用户的概念理解为当前操作的主体,可能是通过浏览器请求的用户,也可能是一个运行的程序。Subject在shiro中是一个接口,接口中定义了很多认证授权的相关方法,外部程序通过subject进行认证授权,而subject是通过SecurityManager安全管理器进行认证授权。 b) SecurityManager:安全管理器,对全部的subject进行安全管理,它是shiro的核心,负责对所有的subject进行安全管理。通过SecurityManager可以完成subject的认证,授权等,实质上SecurityManager是通过Authenticator进行认证,通过Authorizer进行授权,通过SessuionManager进行会话管理等。SecurityManager是一个接口,继承了Authenticator,Authorizer,SessionManager三个接口。 c) Authenticator:认证器,对用户身份进行认证

persistence.xml to import database parameters values from .properties file

别说谁变了你拦得住时间么 提交于 2019-11-30 18:45:33
Edit: not duplicate but almost I would like to have my app persistence.xml to be something like <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="appName" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="${db.dialect'}"/> <property name=

springboot大量案例编写,快速搭建公司开发环境,助你一臂之力

天大地大妈咪最大 提交于 2019-11-30 18:09:32
大概涉及到的案例有 第一次搭建springboot2入门 第一次搭建springboot2入门 springboot2如何配置 如何结合mybatis 如何结合jdbcTemplate 如何多个mybatis数据源 如何jdbcTemplate多数据源 如何设置springboot2的aop 如何结合Thymeleaf前台框架 如何结合redis 如何配置ehcache 如何使用shiro开发认证 如何使用shiro记住登录 如何使用shiro权限获取 如何在shiro里面使用redis 如何在shiro里面使用ehcache 如何在shiro中管理session springboot如何使用jackson springboot如何测试 springboot如何使用swagger2 springboot和邮件结合 springboot过滤器的使用 springboot中mybatis分页使用 springboot和spring-security结合 springboot和spring-security如何验证 springboot和spring-security如何授权 springboot和spring-security结合短信发送验证码 springboot跨域 springboot异步请求 springboot和dubbo整合 spingboot和WebFlux整合

How do concepts of User (UserAccount) and Realm relate in Apache Shiro?

自作多情 提交于 2019-11-30 17:13:06
问题 I'm reading up on Apache Shiro and like to see if I got this mental model right. From the docs: "A Realm is a component that can access application-specific security data such as users , roles , and permissions ". .. "Realms usually have a 1-to-1 correlation with a data source such as a relational database, LDAP directory, file system, or other similar resource. " Moreover, I've read that an application may include multiple realms for its authentication and authorization purposes. Ok so great

SpringBoot2.1.6 + Shiro + Redis + MybatisPlus 整合

◇◆丶佛笑我妖孽 提交于 2019-11-30 13:17:55
本文参考文献: https://www.cnblogs.com/caichaoqi/p/8900677.html#4371099 本文作为个人学习笔记整理,避免后期找不到处理方案: 1、pom.xml文件     <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!-- shiro+redis缓存插件 --> <dependency> <groupId>org.crazycake</groupId> <artifactId>shiro-redis</artifactId> <version>2.4.2.1-RELEASE</version> </dependency> <!-- shiro-spring --> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <artifactId