├── README.md
├── Shiro-Demo.iml
├── pom.xml
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ └── koali
│ │ │ ├── dao
│ │ │ └── UserDao.java
│ │ │ ├── pojo
│ │ │ └── User.java
│ │ │ ├── realm
│ │ │ └── myrealm.java
│ │ │ ├── service
│ │ │ ├── Impl
│ │ │ │ └── UserServiceImpl.java
│ │ │ └── UserService.java
│ │ │ └── web
│ │ │ ├── AdminController.java
│ │ │ ├── PageController.java
│ │ │ └── UserContrllor.java
│ ├── resources
│ │ ├── jdbc.properties
│ │ ├── mapper
│ │ │ └── UserDao.xml
│ │ ├── mybatis-config.xml
│ │ └── spring
│ │ │ ├── spring-dao.xml
│ │ │ ├── spring-service.xml
│ │ │ └── spring-web.xml
│ └── webapp
│ │ ├── WEB-INF
│ │ └── web.xml
│ │ ├── admin
│ │ └── alist.jsp
│ │ ├── index.jsp
│ │ ├── main.jsp
│ │ └── user
│ │ └── ulist.jsp
└── test
│ └── java
│ └── com
│ └── koali
│ ├── dao
│ └── UserDaoTest.java
│ └── service
│ └── UserServiceTest.java
└── target
├── ShiroDemo
├── META-INF
│ └── MANIFEST.MF
├── WEB-INF
│ ├── classes
│ │ ├── com
│ │ │ └── koali
│ │ │ │ ├── dao
│ │ │ │ └── UserDao.class
│ │ │ │ ├── pojo
│ │ │ │ └── User.class
│ │ │ │ ├── realm
│ │ │ │ └── myrealm.class
│ │ │ │ ├── service
│ │ │ │ ├── Impl
│ │ │ │ │ └── UserServiceImpl.class
│ │ │ │ └── UserService.class
│ │ │ │ └── web
│ │ │ │ ├── AdminController.class
│ │ │ │ ├── PageController.class
│ │ │ │ └── UserContrllor.class
│ │ ├── jdbc.properties
│ │ ├── mapper
│ │ │ └── UserDao.xml
│ │ ├── mybatis-config.xml
│ │ └── spring
│ │ │ ├── spring-dao.xml
│ │ │ ├── spring-service.xml
│ │ │ └── spring-web.xml
│ ├── lib
│ │ ├── aopalliance-1.0.jar
│ │ ├── c3p0-0.9.1.1.jar
│ │ ├── commons-beanutils-1.8.3.jar
│ │ ├── commons-fileupload-1.3.1.jar
│ │ ├── commons-io-2.2.jar
│ │ ├── commons-lang3-3.4.jar
│ │ ├── commons-logging-1.2.jar
│ │ ├── druid-1.0.25.jar
│ │ ├── jackson-annotations-2.5.0.jar
│ │ ├── jackson-core-2.5.4.jar
│ │ ├── jackson-databind-2.5.4.jar
│ │ ├── javax.servlet-api-3.1.0.jar
│ │ ├── jstl-1.2.jar
│ │ ├── logback-classic-1.1.1.jar
│ │ ├── logback-core-1.1.1.jar
│ │ ├── mybatis-3.3.0.jar
│ │ ├── mybatis-spring-1.2.3.jar
│ │ ├── mysql-connector-java-5.1.35.jar
│ │ ├── shiro-core-1.2.2.jar
│ │ ├── shiro-spring-1.2.2.jar
│ │ ├── shiro-web-1.2.2.jar
│ │ ├── slf4j-api-1.7.12.jar
│ │ ├── spring-aop-4.1.7.RELEASE.jar
│ │ ├── spring-beans-4.1.7.RELEASE.jar
│ │ ├── spring-context-4.1.7.RELEASE.jar
│ │ ├── spring-core-4.1.7.RELEASE.jar
│ │ ├── spring-expression-4.1.7.RELEASE.jar
│ │ ├── spring-jdbc-4.1.7.RELEASE.jar
│ │ ├── spring-test-4.1.7.RELEASE.jar
│ │ ├── spring-tx-4.1.7.RELEASE.jar
│ │ ├── spring-web-4.1.7.RELEASE.jar
│ │ ├── spring-webmvc-4.1.7.RELEASE.jar
│ │ └── standard-1.1.2.jar
│ └── web.xml
├── admin
│ └── alist.jsp
├── index.jsp
├── main.jsp
└── user
│ └── ulist.jsp
├── classes
├── com
│ └── koali
│ │ ├── dao
│ │ └── UserDao.class
│ │ ├── pojo
│ │ └── User.class
│ │ ├── realm
│ │ └── myrealm.class
│ │ ├── service
│ │ ├── Impl
│ │ │ └── UserServiceImpl.class
│ │ └── UserService.class
│ │ └── web
│ │ ├── AdminController.class
│ │ ├── PageController.class
│ │ └── UserContrllor.class
├── jdbc.properties
├── mapper
│ └── UserDao.xml
├── mybatis-config.xml
└── spring
│ ├── spring-dao.xml
│ ├── spring-service.xml
│ └── spring-web.xml
└── test-classes
└── com
└── koali
├── dao
└── UserDaoTest.class
└── service
└── UserServiceTest.class
/README.md:
--------------------------------------------------------------------------------
1 | Apache Shiro是一个安全框架,对于身份验证还有权限管理比较简单(一点都不简单),尤其是在看了网上很多博客教程,各种坑,真不知那些人怎么想的,乱写代码就乱发。
2 | 本篇文章用的环境如下:
3 | ```javascript
4 | 1.Intellij IDEA 2017.1
5 | 2.JDK1.8
6 | 3.Maven3.0
7 | ```
8 | ****
9 | 这里是Shiro的是官方的地址(貌似是吧)https://github.com/apache/shiro
10 | 这里是我觉得写的最用心最不错的教程:http://blog.csdn.net/Angel_G/article/category/6655167
11 | ***
12 | 从我给的第一个官方的Shiro网址里我截取了一部分的配置文件,可以看出,Shiro相关的有用户名,密码,权限,还有许可。
13 | ```javacript
14 | # user 'lonestarr' with password 'vespa' and roles 'goodguy' and 'schwartz'
15 | lonestarr = vespa, goodguy, schwartz
16 | # The 'schwartz' role can do anything (*) with any lightsaber:
17 | schwartz = lightsaber:*
18 | ```
19 | 接下来就是在SSM基础上添加Shiro框架。
20 | 步骤1:
21 | 在Pom.xml添加依赖:
22 | ```javascript
23 |
24 |
25 | org.apache.shiro
26 | shiro-spring
27 | 1.2.2
28 |
29 | ```
30 | 在已经搭建完的SSM框架上,我们创建数据库还有表
31 | ```javascript
32 | create database shiro;
33 | use shiro;
34 | CREATE TABLE `user` (
35 | `id` int(11) NOT NULL AUTO_INCREMENT,
36 | `username` varchar(255) DEFAULT NULL,
37 | `password` varchar(255) DEFAULT NULL,
38 | PRIMARY KEY (`id`)
39 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
40 |
41 | ```
42 | 然后写dao层,service层,web层(很简单就是查一条数据而已)。
43 | ***
44 | 步骤2:
45 | 整合Shiro安全框架
46 | 首先在web.xml添加Filter
47 | ```javascript
48 |
49 |
50 | shiroFilter
51 | org.springframework.web.filter.DelegatingFilterProxy
52 |
53 |
54 | targetFilterLifecycle
55 | true
56 |
57 |
58 |
59 | shiroFilter
60 | /*
61 |
62 | ```
63 | 然后再spring-web.xml添加配置
64 | ```javascript
65 |
66 |
67 |
68 |
69 |
70 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
91 |
92 |
100 |
101 |
102 | /admin/alist*=authc,perms[admin:manage]
103 | /user/ulist*=authc,perms[user:manage]
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | ```
112 | 接下来写我们验证信息的Realm
113 |
114 | myrealm
115 | ```javascript
116 | public class myrealm extends AuthorizingRealm {
117 | @Autowired
118 | private UserService userService;
119 |
120 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
121 | String currentUsername = (String)super.getAvailablePrincipal(principalCollection);
122 | System.out.println("-----------------------doGetAuthorizationInfo----------------------");
123 | System.out.println("当前名字:"+currentUsername);
124 | SimpleAuthorizationInfo simpleAuthorInfo = new SimpleAuthorizationInfo();
125 | simpleAuthorInfo.addRole("admin");
126 | //添加权限
127 | simpleAuthorInfo.addStringPermission("admin:manage");
128 | return simpleAuthorInfo;
129 | }
130 |
131 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
132 | UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
133 | System.out.print("验证当前Subject时获取到token:");
134 | System.out.println(ReflectionToStringBuilder.toString(token, ToStringStyle.MULTI_LINE_STYLE));
135 | User user = userService.selectUserByNameService(token.getUsername());
136 | String password = new String((char[])token.getCredentials());
137 | System.out.println("--------------密码是:------"+password);
138 | if (user.getPassword().equals(password)) {
139 | AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(user.getUsername(), user.getPassword(), this.getName());
140 | this.setAuthenticationSession(user.getUsername());
141 | return authcInfo;
142 | }
143 | return null;
144 | }
145 |
146 | private void setAuthenticationSession(Object value) {
147 | Subject currentUser = SecurityUtils.getSubject();
148 | if (null != currentUser) {
149 | Session session = currentUser.getSession();
150 | System.out.println("当前Session超时时间为[" + session.getTimeout() + "]毫秒");
151 | session.setTimeout(1000 * 60 * 60 * 2);
152 | System.out.println("修改Session超时时间为[" + session.getTimeout() + "]毫秒");
153 | session.setAttribute("currentUser", value);
154 | }
155 | }
156 | }
157 | ```
158 | 至此整合搭建完毕!
159 | 测试一:
160 | 输入错误的用户名或者密码
161 |
162 | 
163 |
164 |
165 | 
166 | 结果登陆不了
167 | 测试二:
168 | 输入正确的账号密码:
169 |
170 | 
171 | 登陆成功!
172 | 由于在MyRealm中我们给用户露娜添加了
173 | ```javascript
174 | / /添加权限
175 | simpleAuthorInfo.addStringPermission("admin:manage");
176 | //然后我们在spring-web.xml中添加资源的访问是这样子的
177 |
178 |
179 | /admin/alist*=authc,perms[admin:manage]
180 | /user/ulist*=authc,perms[user:manage]
181 |
182 |
183 | ```
184 | 也就是说明我们的用户露娜所拥有的权限是(admin:manage),他可以访问/admin/alist,而不能访问user/ulist。
185 | 测试三:
186 |
187 |
188 | 
189 |
190 | 结果是用户露娜真的可以访问admin,不能访问user/ulist。权限控制启到作用。
191 |
--------------------------------------------------------------------------------
/Shiro-Demo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | com.koali
5 | ShiroDemo
6 | war
7 | 1.0-SNAPSHOT
8 | ShiroDemo Maven Webapp
9 | http://maven.apache.org
10 |
11 |
12 | junit
13 | junit
14 | 4.11
15 | test
16 |
17 |
18 | org.slf4j
19 | slf4j-api
20 | 1.7.12
21 |
22 |
23 | ch.qos.logback
24 | logback-core
25 | 1.1.1
26 |
27 |
28 |
29 | ch.qos.logback
30 | logback-classic
31 | 1.1.1
32 |
33 |
34 |
35 |
36 |
37 | mysql
38 | mysql-connector-java
39 | 5.1.35
40 | runtime
41 |
42 |
43 |
44 | c3p0
45 | c3p0
46 | 0.9.1.1
47 |
48 |
49 |
50 | com.alibaba
51 | druid
52 | 1.0.25
53 |
54 |
55 |
56 | org.mybatis
57 | mybatis
58 | 3.3.0
59 |
60 |
61 |
62 | org.mybatis
63 | mybatis-spring
64 | 1.2.3
65 |
66 |
67 |
68 |
69 | taglibs
70 | standard
71 | 1.1.2
72 |
73 |
74 | jstl
75 | jstl
76 | 1.2
77 |
78 |
79 | com.fasterxml.jackson.core
80 | jackson-databind
81 | 2.5.4
82 |
83 |
84 | javax.servlet
85 | javax.servlet-api
86 | 3.1.0
87 |
88 |
89 |
90 |
91 | org.springframework
92 | spring-core
93 | 4.1.7.RELEASE
94 |
95 |
96 | org.springframework
97 | spring-beans
98 | 4.1.7.RELEASE
99 |
100 |
101 | org.springframework
102 | spring-context
103 | 4.1.7.RELEASE
104 |
105 |
106 |
107 | org.springframework
108 | spring-jdbc
109 | 4.1.7.RELEASE
110 |
111 |
112 | org.springframework
113 | spring-tx
114 | 4.1.7.RELEASE
115 |
116 |
117 |
118 | org.springframework
119 | spring-web
120 | 4.1.7.RELEASE
121 |
122 |
123 | org.springframework
124 | spring-webmvc
125 | 4.1.7.RELEASE
126 |
127 |
128 |
129 | org.springframework
130 | spring-test
131 | 4.1.7.RELEASE
132 |
133 |
134 | commons-fileupload
135 | commons-fileupload
136 | 1.3.1
137 |
138 |
139 | org.apache.commons
140 | commons-lang3
141 | 3.4
142 |
143 |
144 | org.apache.shiro
145 | shiro-spring
146 | 1.2.2
147 |
148 |
149 |
150 | ShiroDemo
151 |
152 |
153 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.koali.dao;
2 |
3 | import com.koali.pojo.User;
4 |
5 | /**
6 | * Created by Elric on 2017/4/20.
7 | */
8 | public interface UserDao {
9 | User selectByName(String username);
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/pojo/User.java:
--------------------------------------------------------------------------------
1 | package com.koali.pojo;
2 |
3 | /**
4 | * Created by Elric on 2017/4/20.
5 | */
6 | public class User {
7 |
8 | private int id;
9 | private String username;
10 | private String password;
11 | public int getId() {
12 | return id;
13 | }
14 |
15 | public void setId(int id) {
16 | this.id = id;
17 | }
18 |
19 | public String getUsername() {
20 | return username;
21 | }
22 |
23 | public String getPassword() {
24 | return password;
25 | }
26 |
27 | public void setUsername(String username) {
28 | this.username = username;
29 | }
30 |
31 | public void setPassword(String password) {
32 | this.password = password;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "User{" +
38 | "id=" + id +
39 | ", username='" + username + '\'' +
40 | ", password='" + password + '\'' +
41 | '}';
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/realm/myrealm.java:
--------------------------------------------------------------------------------
1 | package com.koali.realm;
2 |
3 | import com.koali.pojo.User;
4 | import com.koali.service.UserService;
5 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
6 | import org.apache.commons.lang3.builder.ToStringStyle;
7 | import org.apache.shiro.SecurityUtils;
8 | import org.apache.shiro.authc.*;
9 | import org.apache.shiro.authz.AuthorizationInfo;
10 | import org.apache.shiro.authz.SimpleAuthorizationInfo;
11 | import org.apache.shiro.realm.AuthorizingRealm;
12 | import org.apache.shiro.session.Session;
13 | import org.apache.shiro.subject.PrincipalCollection;
14 | import org.apache.shiro.subject.Subject;
15 | import org.springframework.beans.factory.annotation.Autowired;
16 |
17 | /**
18 | * Created by Elric on 2017/4/20.
19 | */
20 | public class myrealm extends AuthorizingRealm {
21 | @Autowired
22 | private UserService userService;
23 |
24 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
25 | String currentUsername = (String)super.getAvailablePrincipal(principalCollection);
26 | System.out.println("-----------------------doGetAuthorizationInfo----------------------");
27 | System.out.println("当前名字:"+currentUsername);
28 | SimpleAuthorizationInfo simpleAuthorInfo = new SimpleAuthorizationInfo();
29 | simpleAuthorInfo.addRole("admin");
30 | //添加权限
31 | simpleAuthorInfo.addStringPermission("admin:manage");
32 | return simpleAuthorInfo;
33 | }
34 |
35 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
36 | UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
37 | System.out.print("验证当前Subject时获取到token:");
38 | System.out.println(ReflectionToStringBuilder.toString(token, ToStringStyle.MULTI_LINE_STYLE));
39 | User user = userService.selectUserByNameService(token.getUsername());
40 | String password = new String((char[])token.getCredentials());
41 | System.out.println("--------------密码是:------"+password);
42 | if (user.getPassword().equals(password)) {
43 | AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(user.getUsername(), user.getPassword(), this.getName());
44 | this.setAuthenticationSession(user.getUsername());
45 | return authcInfo;
46 | }
47 | return null;
48 | }
49 |
50 | private void setAuthenticationSession(Object value) {
51 | Subject currentUser = SecurityUtils.getSubject();
52 | if (null != currentUser) {
53 | Session session = currentUser.getSession();
54 | System.out.println("当前Session超时时间为[" + session.getTimeout() + "]毫秒");
55 | session.setTimeout(1000 * 60 * 60 * 2);
56 | System.out.println("修改Session超时时间为[" + session.getTimeout() + "]毫秒");
57 | session.setAttribute("currentUser", value);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/service/Impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.koali.service.Impl;
2 |
3 | import com.koali.dao.UserDao;
4 | import com.koali.pojo.User;
5 | import com.koali.service.UserService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * Created by Elric on 2017/4/20.
11 | */
12 | @Service
13 | public class UserServiceImpl implements UserService{
14 | @Autowired
15 | private UserDao userDao;
16 | public User selectUserByNameService(String username) {
17 | return userDao.selectByName(username);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.koali.service;
2 |
3 | import com.koali.pojo.User;
4 |
5 | /**
6 | * Created by Elric on 2017/4/20.
7 | */
8 | public interface UserService {
9 | User selectUserByNameService(String username);
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/web/AdminController.java:
--------------------------------------------------------------------------------
1 | package com.koali.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | /**
7 | * Created by Elric on 2017/4/20.
8 | */
9 | @Controller
10 | @RequestMapping("/admin")
11 | public class AdminController {
12 | @RequestMapping("/admin")
13 | public String showAdmin(){
14 | return "alist";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/web/PageController.java:
--------------------------------------------------------------------------------
1 | package com.koali.web;
2 |
3 | import com.koali.service.UserService;
4 | import org.apache.ibatis.annotations.Param;
5 | import org.apache.shiro.SecurityUtils;
6 | import org.apache.shiro.authc.AuthenticationException;
7 | import org.apache.shiro.authc.UsernamePasswordToken;
8 | import org.apache.shiro.subject.Subject;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.http.HttpRequest;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.servlet.view.InternalResourceViewResolver;
14 |
15 |
16 | /**
17 | * Created by Elric on 2017/4/20.
18 | */
19 | @Controller
20 | public class PageController {
21 | @Autowired
22 | private UserService userService;
23 | @RequestMapping("/")
24 | public String showIndex(){
25 | return "index";
26 | }
27 | @RequestMapping("/login")
28 | public String showAdmin(@Param("username") String username,@Param("password") String password){
29 | System.out.println("用户名密码:"+username+password);
30 | System.out.println("-------------------------------------------------------");
31 |
32 | UsernamePasswordToken token = new UsernamePasswordToken(username,password);
33 | token.setRememberMe(true);
34 | Subject currentUser = SecurityUtils.getSubject();
35 | try {
36 | currentUser.login(token);
37 | }catch (AuthenticationException e){
38 | e.printStackTrace();
39 | }
40 | //验证是否登录成功
41 | if(currentUser.isAuthenticated()){
42 | System.out.println("用户[" + username + "]登录认证通过(这里可进行一些认证通过后的系统参数初始化操作)");
43 | return "main";
44 | }else{
45 | token.clear();
46 | return InternalResourceViewResolver.FORWARD_URL_PREFIX + "/";
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/koali/web/UserContrllor.java:
--------------------------------------------------------------------------------
1 | package com.koali.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | /**
7 | * Created by Elric on 2017/4/20.
8 | */
9 | @Controller
10 | @RequestMapping("/user")
11 | public class UserContrllor {
12 | @RequestMapping("/user")
13 | public String showUser(){
14 | return "ulist";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/resources/jdbc.properties:
--------------------------------------------------------------------------------
1 | jdbc.driver=com.mysql.jdbc.Driver
2 | jdbc.url=jdbc:mysql://localhost:3306/shiro?useUnicode=true&characterEncoding=utf-8
3 | jdbc.username=Elric
4 | jdbc.password=881010
--------------------------------------------------------------------------------
/src/main/resources/mapper/UserDao.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/src/main/resources/mybatis-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/resources/spring/spring-dao.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/main/resources/spring/spring-service.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/resources/spring/spring-web.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
55 |
56 |
57 | /admin/alist*=authc,perms[admin:manage]
58 | /user/ulist*=authc,perms[user:manage]
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 | contextConfigLocation
8 | classpath:spring/spring-*.xml
9 |
10 |
11 |
12 | org.springframework.web.context.ContextLoaderListener
13 |
14 |
15 |
16 | SpringMVC
17 | org.springframework.web.servlet.DispatcherServlet
18 |
19 | contextConfigLocation
20 | classpath:spring/spring-web.xml
21 |
22 |
23 |
24 | SpringMVC
25 | /
26 |
27 |
28 |
29 |
30 | shiroFilter
31 | org.springframework.web.filter.DelegatingFilterProxy
32 |
33 |
34 | targetFilterLifecycle
35 | true
36 |
37 |
38 |
39 | shiroFilter
40 | /*
41 |
42 |
43 |
44 | 45
45 |
46 |
47 |
48 | characterEncodingFilter
49 | org.springframework.web.filter.CharacterEncodingFilter
50 |
51 | encoding
52 | UTF-8
53 |
54 |
55 | forceEncoding
56 | true
57 |
58 |
59 |
60 | characterEncodingFilter
61 | /*
62 |
63 |
--------------------------------------------------------------------------------
/src/main/webapp/admin/alist.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Created by IntelliJ IDEA.
3 | User: Elric
4 | Date: 2017/4/20
5 | Time: 20:48
6 | To change this template use File | Settings | File Templates.
7 | --%>
8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
9 |
10 |
11 | Title
12 |
13 |
14 | Admin界面
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" pageEncoding="UTF-8"%>
2 |
3 |
8 |
--------------------------------------------------------------------------------
/src/main/webapp/main.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" pageEncoding="UTF-8"%>
2 | 当前登录的用户为:${currentUser}
3 |
4 |
5 | 普通用户可访问的页面
6 |
7 |
8 | 管理员可访问的页面
--------------------------------------------------------------------------------
/src/main/webapp/user/ulist.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Created by IntelliJ IDEA.
3 | User: Elric
4 | Date: 2017/4/20
5 | Time: 20:48
6 | To change this template use File | Settings | File Templates.
7 | --%>
8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
9 |
10 |
11 | Title
12 |
13 |
14 | User界面
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/test/java/com/koali/dao/UserDaoTest.java:
--------------------------------------------------------------------------------
1 | package com.koali.dao;
2 |
3 | import com.koali.pojo.User;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.test.context.ContextConfiguration;
8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Created by Elric on 2017/4/20.
14 | */
15 | @RunWith(SpringJUnit4ClassRunner.class)
16 | @ContextConfiguration("classpath:spring/spring-*.xml")
17 | public class UserDaoTest {
18 | @Autowired
19 | private UserDao userDao;
20 | @Test
21 | public void selectByName() throws Exception {
22 | User user = userDao.selectByName("露娜");
23 | System.out.println(user.toString());
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/src/test/java/com/koali/service/UserServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.koali.service;
2 |
3 | import com.koali.pojo.User;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.test.context.ContextConfiguration;
8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Created by Elric on 2017/4/20.
14 | */
15 | @RunWith(SpringJUnit4ClassRunner.class)
16 | @ContextConfiguration("classpath:spring/spring-*.xml")
17 | public class UserServiceTest {
18 | @Autowired
19 | private UserService userService;
20 | @Test
21 | public void selectUserByNameService() throws Exception {
22 | User user = userService.selectUserByNameService("露娜");
23 | System.out.println(user.toString());
24 | }
25 | }
--------------------------------------------------------------------------------
/target/ShiroDemo/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Built-By: Elric
3 | Created-By: IntelliJ IDEA
4 | Build-Jdk: 1.8.0_101
5 |
6 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/dao/UserDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/dao/UserDao.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/pojo/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/pojo/User.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/realm/myrealm.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/realm/myrealm.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/service/Impl/UserServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/service/Impl/UserServiceImpl.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/service/UserService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/service/UserService.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/web/AdminController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/web/AdminController.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/web/PageController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/web/PageController.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/com/koali/web/UserContrllor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/classes/com/koali/web/UserContrllor.class
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/jdbc.properties:
--------------------------------------------------------------------------------
1 | jdbc.driver=com.mysql.jdbc.Driver
2 | jdbc.url=jdbc:mysql://localhost:3306/shiro?useUnicode=true&characterEncoding=utf-8
3 | jdbc.username=Elric
4 | jdbc.password=881010
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/mapper/UserDao.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/mybatis-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/spring/spring-dao.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/spring/spring-service.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/classes/spring/spring-web.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
55 |
56 |
57 | /admin/alist*=authc,perms[admin:manage]
58 | /user/ulist*=authc,perms[user:manage]
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/aopalliance-1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/aopalliance-1.0.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/c3p0-0.9.1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/c3p0-0.9.1.1.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/commons-beanutils-1.8.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/commons-beanutils-1.8.3.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/commons-fileupload-1.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/commons-fileupload-1.3.1.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/commons-io-2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/commons-io-2.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/commons-lang3-3.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/commons-lang3-3.4.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/commons-logging-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/commons-logging-1.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/druid-1.0.25.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/druid-1.0.25.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/jackson-annotations-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/jackson-annotations-2.5.0.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/jackson-core-2.5.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/jackson-core-2.5.4.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/jackson-databind-2.5.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/jackson-databind-2.5.4.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/javax.servlet-api-3.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/javax.servlet-api-3.1.0.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/jstl-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/jstl-1.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/logback-classic-1.1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/logback-classic-1.1.1.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/logback-core-1.1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/logback-core-1.1.1.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/mybatis-3.3.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/mybatis-3.3.0.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/mybatis-spring-1.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/mybatis-spring-1.2.3.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/mysql-connector-java-5.1.35.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/mysql-connector-java-5.1.35.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/shiro-core-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/shiro-core-1.2.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/shiro-spring-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/shiro-spring-1.2.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/shiro-web-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/shiro-web-1.2.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/slf4j-api-1.7.12.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/slf4j-api-1.7.12.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-test-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-test-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/lib/standard-1.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/ShiroDemo/WEB-INF/lib/standard-1.1.2.jar
--------------------------------------------------------------------------------
/target/ShiroDemo/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 | contextConfigLocation
8 | classpath:spring/spring-*.xml
9 |
10 |
11 |
12 | org.springframework.web.context.ContextLoaderListener
13 |
14 |
15 |
16 | SpringMVC
17 | org.springframework.web.servlet.DispatcherServlet
18 |
19 | contextConfigLocation
20 | classpath:spring/spring-web.xml
21 |
22 |
23 |
24 | SpringMVC
25 | /
26 |
27 |
28 |
29 |
30 | shiroFilter
31 | org.springframework.web.filter.DelegatingFilterProxy
32 |
33 |
34 | targetFilterLifecycle
35 | true
36 |
37 |
38 |
39 | shiroFilter
40 | /*
41 |
42 |
43 |
44 | 45
45 |
46 |
47 |
48 | characterEncodingFilter
49 | org.springframework.web.filter.CharacterEncodingFilter
50 |
51 | encoding
52 | UTF-8
53 |
54 |
55 | forceEncoding
56 | true
57 |
58 |
59 |
60 | characterEncodingFilter
61 | /*
62 |
63 |
--------------------------------------------------------------------------------
/target/ShiroDemo/admin/alist.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Created by IntelliJ IDEA.
3 | User: Elric
4 | Date: 2017/4/20
5 | Time: 20:48
6 | To change this template use File | Settings | File Templates.
7 | --%>
8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
9 |
10 |
11 | Title
12 |
13 |
14 | Admin界面
15 |
16 |
17 |
--------------------------------------------------------------------------------
/target/ShiroDemo/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" pageEncoding="UTF-8"%>
2 |
3 |
8 |
--------------------------------------------------------------------------------
/target/ShiroDemo/main.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" pageEncoding="UTF-8"%>
2 | 当前登录的用户为:${currentUser}
3 |
4 |
5 | 普通用户可访问的页面
6 |
7 |
8 | 管理员可访问的页面
--------------------------------------------------------------------------------
/target/ShiroDemo/user/ulist.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Created by IntelliJ IDEA.
3 | User: Elric
4 | Date: 2017/4/20
5 | Time: 20:48
6 | To change this template use File | Settings | File Templates.
7 | --%>
8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
9 |
10 |
11 | Title
12 |
13 |
14 | User界面
15 |
16 |
17 |
--------------------------------------------------------------------------------
/target/classes/com/koali/dao/UserDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/dao/UserDao.class
--------------------------------------------------------------------------------
/target/classes/com/koali/pojo/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/pojo/User.class
--------------------------------------------------------------------------------
/target/classes/com/koali/realm/myrealm.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/realm/myrealm.class
--------------------------------------------------------------------------------
/target/classes/com/koali/service/Impl/UserServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/service/Impl/UserServiceImpl.class
--------------------------------------------------------------------------------
/target/classes/com/koali/service/UserService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/service/UserService.class
--------------------------------------------------------------------------------
/target/classes/com/koali/web/AdminController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/web/AdminController.class
--------------------------------------------------------------------------------
/target/classes/com/koali/web/PageController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/web/PageController.class
--------------------------------------------------------------------------------
/target/classes/com/koali/web/UserContrllor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/classes/com/koali/web/UserContrllor.class
--------------------------------------------------------------------------------
/target/classes/jdbc.properties:
--------------------------------------------------------------------------------
1 | jdbc.driver=com.mysql.jdbc.Driver
2 | jdbc.url=jdbc:mysql://localhost:3306/shiro?useUnicode=true&characterEncoding=utf-8
3 | jdbc.username=Elric
4 | jdbc.password=881010
--------------------------------------------------------------------------------
/target/classes/mapper/UserDao.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/target/classes/mybatis-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/target/classes/spring/spring-dao.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/target/classes/spring/spring-service.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/target/classes/spring/spring-web.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
55 |
56 |
57 | /admin/alist*=authc,perms[admin:manage]
58 | /user/ulist*=authc,perms[user:manage]
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/target/test-classes/com/koali/dao/UserDaoTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/test-classes/com/koali/dao/UserDaoTest.class
--------------------------------------------------------------------------------
/target/test-classes/com/koali/service/UserServiceTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linzhangtong/ShiroDemo/d4059c50be387056412451d12606ba1539d7b6b7/target/test-classes/com/koali/service/UserServiceTest.class
--------------------------------------------------------------------------------