Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
e64ec4b3
Commit
e64ec4b3
authored
Jul 15, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删掉旧的session过期时间
parent
79ad5c92
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
42 deletions
+2
-42
src/main/java/com/stylefeng/guns/config/SpringSessionConfig.java
+1
-1
src/main/java/com/stylefeng/guns/config/properties/GunsProperties.java
+0
-19
src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
+0
-19
src/main/java/com/stylefeng/guns/core/intercept/SessionTimeoutInterceptor.java
+1
-1
src/main/resources/application.yml
+0
-2
No files found.
src/main/java/com/stylefeng/guns/config/SpringSessionConfig.java
View file @
e64ec4b3
...
@@ -8,7 +8,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
...
@@ -8,7 +8,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
* @author fengshuonan
* @author fengshuonan
* @date 2017-07-13 21:05
* @date 2017-07-13 21:05
*/
*/
@EnableRedisHttpSession
@EnableRedisHttpSession
(
maxInactiveIntervalInSeconds
=
1800
)
//session过期时间
public
class
SpringSessionConfig
{
public
class
SpringSessionConfig
{
...
...
src/main/java/com/stylefeng/guns/config/properties/GunsProperties.java
View file @
e64ec4b3
...
@@ -28,10 +28,6 @@ public class GunsProperties {
...
@@ -28,10 +28,6 @@ public class GunsProperties {
private
Boolean
haveCreatePath
=
false
;
private
Boolean
haveCreatePath
=
false
;
private
Integer
sessionInvalidateTime
=
30
*
60
;
//session 失效时间(默认为30分钟 单位:秒)
private
Integer
sessionValidationInterval
=
15
*
60
;
//session 验证失效时间(默认为15分钟 单位:秒)
public
String
getFileUploadPath
()
{
public
String
getFileUploadPath
()
{
//如果没有写文件上传路径,保存到临时目录
//如果没有写文件上传路径,保存到临时目录
if
(
isEmpty
(
fileUploadPath
))
{
if
(
isEmpty
(
fileUploadPath
))
{
...
@@ -71,19 +67,4 @@ public class GunsProperties {
...
@@ -71,19 +67,4 @@ public class GunsProperties {
this
.
swaggerOpen
=
swaggerOpen
;
this
.
swaggerOpen
=
swaggerOpen
;
}
}
public
Integer
getSessionInvalidateTime
()
{
return
sessionInvalidateTime
;
}
public
void
setSessionInvalidateTime
(
Integer
sessionInvalidateTime
)
{
this
.
sessionInvalidateTime
=
sessionInvalidateTime
;
}
public
Integer
getSessionValidationInterval
()
{
return
sessionValidationInterval
;
}
public
void
setSessionValidationInterval
(
Integer
sessionValidationInterval
)
{
this
.
sessionValidationInterval
=
sessionValidationInterval
;
}
}
}
src/main/java/com/stylefeng/guns/config/web/ShiroConfig.java
View file @
e64ec4b3
...
@@ -51,25 +51,6 @@ public class ShiroConfig {
...
@@ -51,25 +51,6 @@ public class ShiroConfig {
return
new
ServletContainerSessionManager
();
return
new
ServletContainerSessionManager
();
}
}
///**
// * session管理器
// */
//@Bean
//public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) {
// DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// sessionManager.setCacheManager(cacheShiroManager);
// sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000);
// sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000);
// sessionManager.setDeleteInvalidSessions(true);
// sessionManager.setSessionValidationSchedulerEnabled(true);
// Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME);
// cookie.setName("shiroCookie");
// cookie.setHttpOnly(true);
// sessionManager.setSessionIdCookie(cookie);
// return sessionManager;
//}
/**
/**
* 缓存管理器 使用Ehcache实现
* 缓存管理器 使用Ehcache实现
*/
*/
...
...
src/main/java/com/stylefeng/guns/core/intercept/SessionTimeoutInterceptor.java
View file @
e64ec4b3
...
@@ -31,7 +31,7 @@ public class SessionTimeoutInterceptor extends BaseController {
...
@@ -31,7 +31,7 @@ public class SessionTimeoutInterceptor extends BaseController {
String
servletPath
=
HttpKit
.
getRequest
().
getServletPath
();
String
servletPath
=
HttpKit
.
getRequest
().
getServletPath
();
if
(
servletPath
.
equals
(
"/kaptcha"
)
||
servletPath
.
equals
(
"/login"
))
{
if
(
servletPath
.
equals
(
"/kaptcha"
)
||
servletPath
.
equals
(
"/login"
)
||
servletPath
.
equals
(
"/global/sessionError"
)
)
{
return
point
.
proceed
();
return
point
.
proceed
();
}
else
{
}
else
{
if
(
ShiroKit
.
getSession
().
getAttribute
(
"sessionFlag"
)
==
null
){
if
(
ShiroKit
.
getSession
().
getAttribute
(
"sessionFlag"
)
==
null
){
...
...
src/main/resources/application.yml
View file @
e64ec4b3
...
@@ -8,8 +8,6 @@ guns:
...
@@ -8,8 +8,6 @@ guns:
kaptcha-open
:
false
#是否开启登录时验证码 (true/false)
kaptcha-open
:
false
#是否开启登录时验证码 (true/false)
session-open
:
false
#是否开启session验证 (true/false)
session-open
:
false
#是否开启session验证 (true/false)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
session-invalidate-time
:
1800
#session失效时间 单位:秒
session-validation-interval
:
900
#多久检测一次失效的session 单位:秒
muti-datasource-open
:
false
#是否开启多数据源(true/false)
muti-datasource-open
:
false
#是否开启多数据源(true/false)
################### 项目启动端口 ###################
################### 项目启动端口 ###################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment