Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
03694f4e
Commit
03694f4e
authored
Jan 14, 2019
by
ms-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
1a101f61
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
27 deletions
+21
-27
ShiroConfig.java
src/main/java/net/mingsoft/config/ShiroConfig.java
+5
-6
application.yml
src/main/resources/application.yml
+16
-21
No files found.
src/main/java/net/mingsoft/config/ShiroConfig.java
View file @
03694f4e
...
@@ -22,7 +22,7 @@ import net.mingsoft.basic.security.BaseAuthRealm;
...
@@ -22,7 +22,7 @@ import net.mingsoft.basic.security.BaseAuthRealm;
@Configuration
@Configuration
public
class
ShiroConfig
{
public
class
ShiroConfig
{
@Value
(
"
managerPath
"
)
@Value
(
"
${ms.manager.path}
"
)
private
String
managerPath
;
private
String
managerPath
;
@Bean
@Bean
...
@@ -36,12 +36,11 @@ public class ShiroConfig {
...
@@ -36,12 +36,11 @@ public class ShiroConfig {
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
// 拦截器.
// 拦截器.
Map
<
String
,
String
>
filterChainDefinitionMap
=
new
LinkedHashMap
<
String
,
String
>();
Map
<
String
,
String
>
filterChainDefinitionMap
=
new
LinkedHashMap
<
String
,
String
>();
// 配置不会被拦截的链接 顺序判断,因为前端模板采用了thymeleaf,这里不能直接使用 ("/static/**",
// 配置不会被拦截的链接 顺序判断,因为前端模板采用了thymeleaf,这里不能直接使用 ("/static/**", "anon")来配置匿名访问,必须配置到每个静态目录
// "anon")来配置匿名访问,必须配置到每个静态目录
filterChainDefinitionMap
.
put
(
"/static/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/static/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/html/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/html/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
managerPath
+
"/
ms/
checkLogin.do"
,
"anon"
);
filterChainDefinitionMap
.
put
(
managerPath
+
"/checkLogin.do"
,
"anon"
);
filterChainDefinitionMap
.
put
(
managerPath
+
"/
ms/
login.do"
,
"anon"
);
filterChainDefinitionMap
.
put
(
managerPath
+
"/login.do"
,
"anon"
);
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap
.
put
(
"/logout"
,
"logout"
);
filterChainDefinitionMap
.
put
(
"/logout"
,
"logout"
);
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
...
@@ -50,7 +49,7 @@ public class ShiroConfig {
...
@@ -50,7 +49,7 @@ public class ShiroConfig {
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
shiroFilterFactoryBean
.
setLoginUrl
(
"/login"
);
shiroFilterFactoryBean
.
setLoginUrl
(
"/login"
);
// 登录成功后要跳转的链接
// 登录成功后要跳转的链接
shiroFilterFactoryBean
.
setSuccessUrl
(
"/index"
);
//
shiroFilterFactoryBean.setSuccessUrl("/index");
// 未授权界面;
// 未授权界面;
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
"/403"
);
shiroFilterFactoryBean
.
setUnauthorizedUrl
(
"/403"
);
...
...
src/main/resources/application.yml
View file @
03694f4e
...
@@ -2,14 +2,25 @@ server:
...
@@ -2,14 +2,25 @@ server:
port
:
8081
port
:
8081
tomcat
:
tomcat
:
max-http-header-size
:
10240
#单位:字节
max-http-header-size
:
10240
#单位:字节
ms
:
ms
:
manager
:
ms
manager
:
path
:
ms
view
:
view
:
path
:
/WEB-INF/manager
path
:
/WEB-INF/manager
session
:
timeout
:
1800000
#会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
managerPath
:
/ms
validation.interval
:
120000
#会话清理间隔时间, 单位:毫秒,2m=120000ms
upload
:
floder
:
path
:
/upload
file
:
denied
:
exe
allowed
:
jpg
max
:
size
:
1
in
:
memory
:
size
:
4096
spring
:
spring
:
profiles
:
profiles
:
...
@@ -53,10 +64,6 @@ mybatis:
...
@@ -53,10 +64,6 @@ mybatis:
configuration
:
configuration
:
database-id
:
mysql
database-id
:
mysql
session
:
timeout
:
1800000
#会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms
validation.interval
:
120000
#会话清理间隔时间, 单位:毫秒,2m=120000ms
# slf4j日志配置
# slf4j日志配置
logging
:
logging
:
# 配置级别
# 配置级别
...
@@ -66,14 +73,3 @@ logging:
...
@@ -66,14 +73,3 @@ logging:
com.mingsoft
:
trace
com.mingsoft
:
trace
upload
:
floder
:
path
:
/upload
file
:
denied
:
exe
allowed
:
jpg
max
:
size
:
1
in
:
memory
:
size
:
4096
\ No newline at end of file
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