forked from codingXiaxw/shiro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c96b42
commit b0b1171
Showing
62 changed files
with
1,030 additions
and
383 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
out/artifacts/Shiro_war_exploded/WEB-INF/classes/config/shiro-ehcache.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../config/ehcache.xsd"> | ||
<!--diskStore:缓存数据持久化的目录 地址 --> | ||
<diskStore path="/Users/codingboy/develop/ehcache" /> | ||
<defaultCache | ||
maxElementsInMemory="1000" | ||
maxElementsOnDisk="10000000" | ||
eternal="false" | ||
overflowToDisk="false" | ||
diskPersistent="false" | ||
timeToIdleSeconds="120" | ||
timeToLiveSeconds="120" | ||
diskExpiryThreadIntervalSeconds="120" | ||
memoryStoreEvictionPolicy="LRU"> | ||
</defaultCache> | ||
</ehcache> |
136 changes: 136 additions & 0 deletions
136
out/artifacts/Shiro_war_exploded/WEB-INF/classes/config/spring/applicationContext-shiro.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
|
||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd | ||
http://www.springframework.org/schema/mvc | ||
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd | ||
http://www.springframework.org/schema/context | ||
http://www.springframework.org/schema/context/spring-context-3.2.xsd | ||
http://www.springframework.org/schema/aop | ||
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd | ||
http://www.springframework.org/schema/tx | ||
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd "> | ||
|
||
|
||
<!--web.xml中shiro的filter对应的bean--> | ||
<!-- Shiro 的Web过滤器 --> | ||
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> | ||
<property name="securityManager" ref="securityManager" /> | ||
<!-- loginUrl认证提交地址,如果没有认证将会请求此地址进行认证,请求此地址将由formAuthenticationFilter进行表单认证 --> | ||
<property name="loginUrl" value="/login.action" /> | ||
<!--认证成功统一跳转到first.actio,建议不配置,不配置的话shiro认证成功会自动到上一个请求路径--> | ||
<property name="successUrl" value="/first.action"/> | ||
<property name="unauthorizedUrl" value="/refuse.jsp" /> | ||
|
||
<!--自定义filter--> | ||
<property name="filters"> | ||
<map> | ||
<!-- 将自定义的FormAuthenticationFilter注入shiroFiler中 --> | ||
<entry key="authc" value-ref="formAuthenticationFilter" /> | ||
</map> | ||
</property> | ||
|
||
<!-- 过虑器链定义,从上向下顺序执行,一般将/**放在最下边 --> | ||
<property name="filterChainDefinitions"> | ||
<value> | ||
<!--对静态资源设置匿名访问--> | ||
/images/**=anon | ||
/js/**=anon | ||
/style/**=anon | ||
|
||
<!--验证码--> | ||
/validatecode.jsp=anon | ||
|
||
<!--请求这个地址就自动退出--> | ||
/logout.action=logout | ||
|
||
<!--商品查询需要商品查询权限,取消url拦截配置,采用注解授权--> | ||
<!--/items/queryItems.action=perms[item:query]--> | ||
<!--<!–商品修改需要商品修改权限–>--> | ||
<!--/items/editItems.action=perms[item:edit]--> | ||
|
||
<!--配置记住我或认证通过可以访问的地址--> | ||
/index.jsp=user | ||
/first.action=user | ||
|
||
<!-- -/**=authc 表示所有的url都必须认证通过才可以访问- --> | ||
/** = authc | ||
|
||
|
||
<!--/**=anon 表示所有的url都可以匿名访问--> | ||
|
||
</value> | ||
</property> | ||
</bean> | ||
|
||
<!--securityManage--> | ||
<!-- 安全管理器 --> | ||
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> | ||
<property name="realm" ref="customRealm" /> | ||
|
||
<!--注入缓存管理器--> | ||
<property name="cacheManager" ref="cacheManager"/> | ||
|
||
<!--注入会话管理器--> | ||
<property name="sessionManager" ref="sessionManager" /> | ||
|
||
<!-- 记住我 --> | ||
<property name="rememberMeManager" ref="rememberMeManager"/> | ||
|
||
|
||
</bean> | ||
|
||
<!--自定义realm--> | ||
<bean id="customRealm" class="shiro.CustomRealm"> | ||
<!--将凭证匹配器设置到realm中,realm按照凭证匹配器要求进行散列--> | ||
<property name="credentialsMatcher" ref="credentialsMatcher"/> | ||
</bean> | ||
|
||
<!-- 凭证匹配器 --> | ||
<bean id="credentialsMatcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> | ||
<property name="hashAlgorithmName" value="md5" /> | ||
<property name="hashIterations" value="1" /> | ||
</bean> | ||
|
||
<!-- 缓存管理器 --> | ||
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"> | ||
<property name="cacheManagerConfigFile" value="classpath:shiro-ehcache.xml"/> | ||
</bean> | ||
|
||
|
||
<!-- 会话管理器 --> | ||
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> | ||
<!-- session的失效时长,单位毫秒 --> | ||
<property name="globalSessionTimeout" value="600000"/> | ||
<!-- 删除失效的session --> | ||
<property name="deleteInvalidSessions" value="true"/> | ||
</bean> | ||
|
||
|
||
<!--自定义form认证过滤器--> | ||
<bean id="formAuthenticationFilter" | ||
class="shiro.CustomFromAuthenticationFilter"> | ||
<!-- 表单中账号的input名称 --> | ||
<property name="usernameParam" value="username" /> | ||
<!-- 表单中密码的input名称 --> | ||
<property name="passwordParam" value="password" /> | ||
<!--记住我input的名称--> | ||
<property name="rememberMeParam" value="rememberMe"/> | ||
</bean> | ||
|
||
<!-- rememberMeManager管理器 --> | ||
<bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager"> | ||
<property name="cookie" ref="rememberMeCookie" /> | ||
</bean> | ||
<!-- 记住我cookie --> | ||
<bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie"> | ||
<!--rememberMe时cookie的名字--> | ||
<constructor-arg value="rememberMe" /> | ||
<!-- 记住我cookie生效时间30天 --> | ||
<property name="maxAge" value="2592000" /> | ||
</bean> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+780 Bytes
out/artifacts/Shiro_war_exploded/WEB-INF/classes/controller/ClearShiroCache.class
Binary file not shown.
Binary file modified
BIN
+470 Bytes
(160%)
out/artifacts/Shiro_war_exploded/WEB-INF/classes/controller/FirstAction.class
Binary file not shown.
Binary file modified
BIN
+121 Bytes
(100%)
out/artifacts/Shiro_war_exploded/WEB-INF/classes/controller/ItemsController.class
Binary file not shown.
Binary file modified
BIN
-239 Bytes
(87%)
out/artifacts/Shiro_war_exploded/WEB-INF/classes/controller/LoginController.class
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
out/artifacts/Shiro_war_exploded/WEB-INF/classes/po/SysPermission.class
Binary file not shown.
Binary file modified
BIN
-10 Bytes
(100%)
out/artifacts/Shiro_war_exploded/WEB-INF/classes/service/impl/SysServiceImpl.class
Binary file not shown.
Binary file added
BIN
+1.53 KB
out/artifacts/Shiro_war_exploded/WEB-INF/classes/shiro/CustomFromAuthenticationFilter.class
Binary file not shown.
Binary file added
BIN
+4.36 KB
out/artifacts/Shiro_war_exploded/WEB-INF/classes/shiro/CustomRealm.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
pageEncoding="UTF-8"%> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>拒绝访问</title> | ||
</head> | ||
<body> | ||
无权访问! | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../config/ehcache.xsd"> | ||
<!--diskStore:缓存数据持久化的目录 地址 --> | ||
<diskStore path="/Users/codingboy/develop/ehcache" /> | ||
<defaultCache | ||
maxElementsInMemory="1000" | ||
maxElementsOnDisk="10000000" | ||
eternal="false" | ||
overflowToDisk="false" | ||
diskPersistent="false" | ||
timeToIdleSeconds="120" | ||
timeToLiveSeconds="120" | ||
diskExpiryThreadIntervalSeconds="120" | ||
memoryStoreEvictionPolicy="LRU"> | ||
</defaultCache> | ||
</ehcache> |
Oops, something went wrong.