shiro

Failed to instantiate SLF4J LoggerFactory、Error creating bean with name 'shiroFilter'

╄→гoц情女王★ 提交于 2019-12-02 19:54:59
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/log4j/Level Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: org/apache/log4j/Level at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124) at org.slf4j

让Apache Shiro保护你的应用

廉价感情. 提交于 2019-12-02 19:52:27
什么是Apache Shiro? Apache Shiro(发音为“shee-roh”,日语“堡垒(Castle)”的意思)是一个强大易用的Java安全框架, 提供了认证、授权、加密和会话管理功能 ,可为任何应用提供安全保障 - 从命令行应用、移动应用到大型网络及企业应用 。 Shiro为解决下列问题(我喜欢称它们为 应用安全的四要素 )提供了保护应用的API: 认证 - 用户身份识别,常被称为用户“登录”; 授权 - 访问控制; 密码加密 - 保护或隐藏数据防止被偷窥; 会话管理 - 每用户相关的时间敏感的状态。 Shiro还支持一些辅助特性,如Web应用安全、单元测试和多线程,它们的存在强化了上面提到的四个要素。 为何要创建Apache Shiro? 对于一个框架来讲,使其有存在价值的最好例证就是有让你去用它的原因,它 应该能完成一些别人无法做到的事情 。要理解这一点,需要了解Shiro的历史以及创建它时的其他替代方法。 在2008年加入Apache软件基金会之前,Shiro已经5岁了,之前它被称为JSecurity项目,始于2003年初。当时,对于Java应用开发人员而言,没有太多的通用安全替代方案 - 我们被Java认证/授权服务(或称为JAAS)紧紧套牢了。JAAS有太多的缺点 - 尽管它的认证功能尚可忍受,但授权方面却显得拙劣,用起来令人沮丧。此外,

spring boot中使用shiro权限管理框架

旧城冷巷雨未停 提交于 2019-12-02 19:43:23
使用idea创建spring boot工程 勾选web里的web依赖 我们在pom.xml里自己导入shiro的依赖 具体依赖如下: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.5.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.liy</groupId> <artifactId>shiro<

Shiro学习笔记<1>入门--Hello Shiro

白昼怎懂夜的黑 提交于 2019-12-02 19:43:06
Apache Shiro是Apache的一个安全框架.对比Spring Security,可能没有Spring Security功能多,但是在实际并不需要那么重的东西.shiro简小精悍.大多项目绰绰有余.(JBOSS好像也有个什么安全框架...名字忘了,去JBOSS官网找了半天也没找到,找到个jboss sso好像是单点登录方面使用的安全框架) Shiro主要功能有认证,授权,加密,会话管理,与Web集成,缓存等. 1.shiro入门测试 新建一个简单的Maven项目,我们只是使用Junit和shiro-core包.POM最后是如下代码: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.credo</groupId> <artifactId>shiro-study</artifactId> <version>0.0.1

springboot整合Shiro功能案例

a 夏天 提交于 2019-12-02 19:00:51
Shiro 核心功能案例讲解 基于SpringBoot 有源码 从实战中学习Shiro的用法。本章使用SpringBoot快速搭建项目。整合SiteMesh框架布局页面。整合Shiro框架实现用身份认证,授权,数据加密功能。通过本章内容,你将学会用户权限的分配规则,SpringBoot整合Shiro的配置,Shiro自定义Realm的创建,Shiro标签式授权和注解式授权的使用场景,等实战技能,还在等什么,快来学习吧! 技术:SpringBoot,Shiro,SiteMesh,Spring,SpringDataJpa,SpringMVC,Bootstrap-sb-admin-1.0.4 说明:前端使用的是Bootstrap-sb-admin模版。注意文章贴出的代码可能不完整,请以github上源码为主,谢谢! 源码: https://github.com/ITDragonBl... 喜欢的朋友可以鼓励(star)下。 效果图: Shiro 功能介绍 四个核心:登录认证,权限验证,会话管理,数据加密。 六个支持:支持WEB开发,支持缓存,支持线程并发验证,支持测试,支持用户切换,支持"记住我"功能。 • Authentication :身份认证,也可以理解为登录,验证用户身份。 • Authorization :权限验证,也可以理解为授权,验证用户是否拥有某个权限

spring boot + shiro 整合报错:Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false]

核能气质少年 提交于 2019-12-02 18:44:25
1、 2019-10-29 11:39:06.809 WARN 14068 --- [nio-8081-exec-1] o.a.shiro.authc.AbstractAuthenticator : Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException). java.lang.NullPointerException: null at com.example.shiro.config.CustomRealm.doGetAuthenticationInfo(CustomRealm.java:60) ~[classes/:na] at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:571) ~[shiro-core-1.4.1.jar:1.4.1] at org

Shiro入门学习实战之shi.ini实现认证及源码分析(二)

你。 提交于 2019-12-02 18:12:28
一、Shiro.ini文件 1.文件说明 ①ini(InitializationFile)初始文件:Window系统文件扩展名 ②Shiro使用时可以连接数据库,也可以不连接数据库(可以使用shiro.ini配置静态数据) 2.shiro文件组成部分 ①[main]:定义全局变量(内置securityManager对象) ②[users]定义用户名和密码 ③[roles]定义角色 ④[urls]定义哪些内置的urls生效,在web应用时使用 二、Shiro实现认证+Shiro.ini   学习任何一门新的技术,都是从官网找到get started: http://shiro.apache.org/tutorial.html ,My First Shiro Application官网步骤精简版如下: 1.新建module,添加pom依赖 <properties> <shiro.version>1.4.1</shiro.version> <logging.version>1.2</logging.version> </properties> <dependencies> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>${shiro.version

Shiro authentication with sessionId or username+password

喜你入骨 提交于 2019-12-02 17:33:14
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 the regular workflow of getting the /myresource (with Shiro managing method-level access rights).

面试项目经验准备

假装没事ソ 提交于 2019-12-02 16:09:05
2. 什么是REST REST不是”rest”这个单词,而是几个单词的缩写 REpresentation State Transfer,直接翻译:表现层状态转移,这个翻译不太好理解。网上找到一个比较通俗的说法是:URL定位资源,用HTTP动词(GET,POST,DELETE,PUSH等)描述操作 3. 什么是Restful 基于REST构建的API就是Restful风格。 4. 为什么使用Restful (1). 我们团队之前一直使用JSP作为表现层,但是这样的技术限制了我们的开发效率,我们需要将前端组给出静态html页面转换为jsp页面,并且写一些js代码,甚至是一些前端代码。这样会严重限制我们的开发效率,也不能让后端组专注于业务功能的开发,所以目前越来越多的互联网公司开始实行前后端分离。 (2). 近年随着移动互联网的发展,各种类型的客户端层出不穷,Restful可以通过一套统一的接口为PC、微信(H5)、IOS和Android提供服务,这样的接口不需要前端样式,只提供数据。Restful架构如下: 举一个实际的例子: 比如用户愚公币交易记录列表, PC网站里需要这个功能, Android App里面也需要这个功能, IOS App里面也需要这个功能。 按照我们现有的开发模式,我们就要写了2套(PC和APP端)获取用户说说列表的功能。也就是需要在2个地方都写连接数据库配置信息

解决shiro登陆超时ajax请求跳转

[亡魂溺海] 提交于 2019-12-02 15:06:33
使用JQueryEasyUI的时候,普通请求在shrio登陆超时的时候都可以正常跳转,而ajax请求在登陆超时的时候就不跳转,上网找了下资料,都表达的不明确,而且设置一大堆,还得写过滤器。无意中找到JQuery设置全局 AJAX 默认选项。具体代码如下! $.ajaxSetup({ complete:function(XMLHttpRequest,textStatus){ if(textStatus=="parsererror"){ $.messager.alert('提示信息', "登陆超时!请重新登陆!", 'info',function(){ window.location.href = 'login.jsp'; }); } else if(textStatus=="error"){ $.messager.alert('提示信息', "请求超时!请稍后再试!", 'info'); } } }); 来源: oschina 链接: https://my.oschina.net/u/568577/blog/295525