@@ -68,8 +68,8 @@ public class ShiroConfiguration {
68
68
public AdminShiroRealm adminShiroRealm (){
69
69
logger .debug ("ShiroConfiguration.adminShiroRealm()" );
70
70
AdminShiroRealm adminShiroRealm = new AdminShiroRealm ();
71
- // adminShiroRealm.setCacheManager(redisCacheManager());//单redis缓存
72
- adminShiroRealm .setCacheManager (shiroJ2CacheCacheManager ());//j2cache二级缓存
71
+ adminShiroRealm .setCacheManager (redisCacheManager ());//单redis缓存
72
+ // adminShiroRealm.setCacheManager(shiroJ2CacheCacheManager());//j2cache二级缓存
73
73
//redisCacheManager和shiroJ2CacheCacheManager以上两种模式可任选其一,现在默认使用J2Cache
74
74
adminShiroRealm .setCredentialsMatcher (adminHashedCredentialsMatcher ());
75
75
return adminShiroRealm ;
@@ -113,26 +113,26 @@ public CustomSessionListener customSessionListener(){
113
113
public DefaultWebSessionManager defaultWebSessionManager () {
114
114
logger .debug ("ShiroConfiguration.defaultWebSessionManager()" );
115
115
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager ();
116
- //用户信息必须是序列化格式,要不创建用户信息创建不过去,此坑很大,
117
- // sessionManager.setSessionDAO(redisSessionDAO());//单redis的session存储
118
- sessionManager .setSessionDAO (shiroJ2CacheSession ());//J2Cache的session存储
119
- //redisSessionDAO和shiroJ2CacheSession以上两种模式可任选其一,现在默认使用J2Cache
120
- Collection <SessionListener > sessionListeners = new ArrayList <>();
121
- sessionListeners .add (customSessionListener ());
122
- sessionManager .setSessionListeners (sessionListeners );
123
- //单位为毫秒(1秒=1000毫秒) 3600000毫秒为1个小时
124
- sessionManager .setSessionValidationInterval (3600000 *12 );
125
- //3600000 milliseconds = 1 hour
126
- sessionManager .setGlobalSessionTimeout (3600000 *12 );
127
- //是否删除无效的,默认也是开启
128
- sessionManager .setDeleteInvalidSessions (true );
129
- //是否开启 检测,默认开启
130
- sessionManager .setSessionValidationSchedulerEnabled (true );
131
- //创建会话Cookie
132
- Cookie cookie = new SimpleCookie (ShiroHttpSession .DEFAULT_SESSION_ID_NAME );
133
- cookie .setName ("WEBID" );
134
- cookie .setHttpOnly (true );
135
- sessionManager .setSessionIdCookie (cookie );
116
+ // //用户信息必须是序列化格式,要不创建用户信息创建不过去,此坑很大,
117
+ // sessionManager.setSessionDAO(redisSessionDAO());//单redis的session存储
118
+ // // sessionManager.setSessionDAO(shiroJ2CacheSession());//J2Cache的session存储
119
+ // //redisSessionDAO和shiroJ2CacheSession以上两种模式可任选其一,现在默认使用J2Cache
120
+ // Collection<SessionListener> sessionListeners = new ArrayList<>();
121
+ // sessionListeners.add(customSessionListener());
122
+ // sessionManager.setSessionListeners(sessionListeners);
123
+ // //单位为毫秒(1秒=1000毫秒) 3600000毫秒为1个小时
124
+ // sessionManager.setSessionValidationInterval(3600000*12);
125
+ // //3600000 milliseconds = 1 hour
126
+ // sessionManager.setGlobalSessionTimeout(3600000*12);
127
+ // //是否删除无效的,默认也是开启
128
+ // sessionManager.setDeleteInvalidSessions(true);
129
+ // //是否开启 检测,默认开启
130
+ // sessionManager.setSessionValidationSchedulerEnabled(true);
131
+ // //创建会话Cookie
132
+ // Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME);
133
+ // cookie.setName("WEBID");
134
+ // cookie.setHttpOnly(true);
135
+ // sessionManager.setSessionIdCookie(cookie);
136
136
return sessionManager ;
137
137
}
138
138
@@ -186,11 +186,7 @@ public FilterRegistrationBean filterProxy(){
186
186
DelegatingFilterProxy proxy = new DelegatingFilterProxy ();
187
187
proxy .setTargetFilterLifecycle (true );
188
188
proxy .setTargetBeanName ("shiroFilter" );
189
- //该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理
190
189
registrationBean .setFilter (proxy );
191
- /*List<String> urlPatterns = new ArrayList<String>();
192
- urlPatterns.add("/*");
193
- registrationBean.setUrlPatterns(urlPatterns);*/
194
190
return registrationBean ;
195
191
}
196
192
@@ -235,8 +231,6 @@ public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityMana
235
231
236
232
//<!-- 过滤链定义,从上向下顺序执行,一般将 /**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
237
233
//<!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问-->
238
- filterChainDefinitionMap .put ("/monitor/**" , "anon" );
239
- filterChainDefinitionMap .put ("/error" , "anon" );
240
234
filterChainDefinitionMap .put ("/console/login" , "anon" );
241
235
filterChainDefinitionMap .put ("/console/logout" , "logout" );
242
236
//配置记住我或认证通过可以访问的地址
0 commit comments