web中采用shiro实现登录认证与权限授权管理

Apache Shiro是Java的一个安全框架。


官网对shiro的介绍:Apache Shiro™ is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application – from the smallest mobile applications to the largest web and enterprise applications.

  翻译一下:Apache Shiro™是强大且易于使用的Java安全框架,可执行认证,授权,加密和会话管理借助Shiro易于理解的API,您可以快速轻松地确保任何应用程序 - 从最小的移动应用程序到最大的Web和企业应用程序。


本篇介绍shiro进行登陆认证和权限授权,并与web集成。

1、在pom.xml中引入shiro的jar包

<!-- shiro -->  
        <dependency>  
            <groupId>org.apache.shiro</groupId>  
            <artifactId>shiro-core</artifactId>  
            <version>1.2.1</version>  
        </dependency>  
        <dependency>  
            <groupId>org.apache.shiro</groupId>  
            <artifactId>shiro-web</artifactId>  
            <version>1.2.1</version>  
        </dependency>  
        <dependency>  
            <groupId>org.apache.shiro</groupId>  
            <artifactId>shiro-ehcache</artifactId>  
            <version>1.2.1</version>  
        </dependency>  
        <dependency>  
            <groupId>org.apache.shiro</groupId>  
            <artifactId>shiro-spring</artifactId>  
            <version>1.2.1</version>  
        </dependency>
2、在web.xml中添加shiro过滤器(启动web程序的时候,javaweb会自动读取web.xml文件,创建servelet上下文并共享
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值