shiro整合spring,springMVC配置

功能描述:

Authentication:身份认证/登录,验证用户是不是具有相应的身份。
Authorization:授权,即权限验证,验证某个已认证的用户是否具有某个权限,即判断用户能否进行某个操作。
Session Management:会话管理,即用户登录后就是一次会话,在没有退出之前,它的所有信息都在这个会话中。
Cryptography:加密,保护数据的安全性,如密码加密存储到数据库。
Web Support:web项目集成,非常容易集成到Web项目中。
Caching:缓存。比如用户登录后,其用户信息和权限都保存到缓存中,提高效率。
Concurrency:多线程的授权验证。支持在多线程之间进行并发验证。
Tesing:提供测试支持。
Run As:允许一个用户以另外一种身份来操作项目(对方允许的情况)。
Remember Me:记住我。即一次登录后,下次再来就不需要再重新登录了。

1.导包

在这里插入图片描述

2.配置web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>Shiro</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <!-- spring配置文件 -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- SpringMVC的配置文件 -->
<servlet>
    <servlet-name>springDispatcherServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:springmvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>springDispatcherServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<!-- 添加shiro过滤器,用来拦截shiro请求 -->
<filter>
    <filter-name>shiroFilter</filter-name>
    <filter-class>
	    org.springframework.web.filter.Delega
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值