shiro

Shiro authentication with sessionId or username+password

回眸只為那壹抹淺笑 提交于 2019-12-03 02:49:47
问题 I do not have much experience in Java authentication frameworks and authentication workflow in general (only some theoretical knowledge), so for educational purposes I'm trying to create this type of authentication for my HTTP application: Client Posts login+password to /login . Shiro logs in the user by given credentials. Server returns client his sessionId . Client requests some kind of resource /myresource?sessionId=1234567 . Shiro logs in the Subject by given sessionId . Then server does

How to stock and use a shiro's salt from database

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use shiro in application for the authenticate. I use hashed password with a salt and I store them in my database like this : private User createUserWithHashedPassword(String inName, String inFirstName, String inLastName, String inPassword){ ByteSource salt = randomNumberGenerator.nextBytes(32); byte[] byteTabSalt = salt.getBytes(); String strSalt = byteArrayToHexString(byteTabSalt); String hashedPasswordBase64 = new Sha256Hash(inPassword, salt, 1024).toBase64(); return new User(inName,inFirstName,inLastName,hashedPasswordBase64,strSalt); }

Spring security vs Apache Shiro [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Shiro vs. SpringSecurity [closed] 3 answers What I have researched so far most people are saying Apache Shiro is easy to use and easy to integrate with CAS (for SSO etc). Just to ask if anyone has experience using both of them and which one to use and why one is better than other? 回答1: I have recently had to evaluate both shiro and spring security. We went with spring security (in fact we extended spring security to use the shiro permission strings in a better way - with instance variables on

Inject CDI managed bean in custom Shiro AuthorizingRealm

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In an app I'm building we're using straight Java 6 EE and JBoss (no Spring, etc), with JPA/Hibernate, JSF, CDI and EJBs. I haven't found many good general security solutions (recommendations are welcome), but the best bet I found is Apache Shiro. However this seems to have a number of shortcomings. Some of which you can read about at Balus C's site: http://balusc.blogspot.com/2013/01/apache-shiro-is-it-ready-for-java-ee-6.html But I've stumbled on another big problem which is already mentioned here regarding dependency injection and proxying

Apache-Shiro CacheManager整合Redis提高性能

匿名 (未验证) 提交于 2019-12-03 00:44:02
<!-- shiro+redis缓存插件 --><dependency>   <groupId>org.crazycake</groupId> <artifactId>shiro-redis</artifactId> <version>3.1.0</version> </dependency> 原有String username = (String)principals.getPrimaryPrincipal();User user = userService.findAllUserInfoByUsername(username);改为: 源码地址: https://github.com/woxbwo/is-rbac-shiro-service/tree/master/src/main/java/com/is/shiro/service/config 来源:博客园 作者: woxbwo 链接:https://www.cnblogs.com/woxbwo/p/11421696.html

SpringBoot整合shiro、自定义sessionManager

匿名 (未验证) 提交于 2019-12-03 00:43:02
1.基础数据 首先引入shiro依赖jar包 <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>1.4.0</version> </dependency> <!--shiro缓存插件--> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-ehcache</artifactId> <version>1.2.2</version> </dependency> 这里贴三张表的字段设计 public class SysUser { private Integer userId; private String userAccount;//用户账号 private String userPassword;//用户密码 } public class SysRole { private Integer sysRoleId; private Byte sysRoleAva; //角色是否生效 private String sysRoleDes;//角色描述 private String sysRoleName;//角色名称 } public class SysAuth {

shiro异常类型

匿名 (未验证) 提交于 2019-12-03 00:41:02
<!-- 身份认证异常 --> <!-- 身份令牌异常,不支持的身份令牌 --> org.apache.shiro.authc.pam.UnsupportedTokenException <!-- 未知账户/没找到帐号,登录失败 --> org.apache.shiro.authc.UnknownAccountException <!-- 帐号锁定 --> org.apache.shiro.authc.LockedAccountException <!-- 用户禁用 --> org.apache.shiro.authc.DisabledAccountException <!-- 登录重试次数,超限。只允许在一段时间内允许有一定数量的认证尝试 --> org.apache.shiro.authc.ExcessiveAttemptsException <!-- 一个用户多次登录异常:不允许多次登录,只能登录一次 。即不允许多处登录--> org.apache.shiro.authc.ConcurrentAccessException <!-- 账户异常 --> org.apache.shiro.authc.AccountException <!-- 过期的凭据异常 --> org.apache.shiro.authc.ExpiredCredentialsException <!--

Shiro在SSM框架中的应用

匿名 (未验证) 提交于 2019-12-03 00:40:02
上一篇Shiro基础的连接   如果想使用Relam的操作,那么必须要保证有一个具体的认证类实现了Relam接口 web.xml增加shiro的配置 <!-- 此配置描述的是在项目开发过程之中,Spring容器所需要使用到的配置文件 -->     <context-param>       <param-name>contextConfigLocation</param-name>       <param-value>classpath:applicationContext.xml</param-value>     </context-param>    <!-- 进行shiro的过滤器的配置 --> <filter> <filter-name>shiroFilter</filter-name> <filter- class >org.springframework.web.filter.DelegatingFilterProxy</filter- class > <!-- 该参数表示shiro的生命周期将交由Spring容器进行管理(默认情况下,取值为false) --> <!-- 如果将其内容设置为true,则表示由Servlet容器进行管理 --> <init-param> <param-name>targetFilterLifecycle</param-name>

SpringBoot集成Apache Shiro

匿名 (未验证) 提交于 2019-12-03 00:40:02
转载: https://www.cnblogs.com/sankt/p/9278886.html 介绍demo项目前,简单说明一下Shiro框架的特性。 1. Apache Shiro Features 从上图可以看出Shiro具备应用程序安全框架的四大基石”:身份验证、授权、会话管理和密码。 Authentication : 有时被称为‘登录’,这是需要明确用户是谁 Authorization : 访问控制,即确定‘谁’对‘什么’有访问权限。 Session Management : 管理特定用户的会话,即使在非web或EJB应用程序中也是如此。 Cryptography : 使用加密算法保持数据安全,但易于使用。 在不同的应用程序环境中,还有更多的特性来支持和增强这些关注点,特别是: Web Support : Shiro的Web支持API帮助轻松地保护web应用程序。 Caching : 缓存是ApacheShiro的API中的第一等公民,以确保安全操作同时保持快速和高效。 Concurrency : ApacheShiro支持具有并发特性的多线程应用程序。 Testing : 提供测试支持,以帮助编写单元和集成测试,并确保代码如预期的安全。 Run as : 允许用户假定另一个用户的身份(如果允许的话)的特性,有时在管理场景中很有用。 Remember Me :