Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-enterprise-base
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-enterprise-base
Commits
53e6f9cc
Commit
53e6f9cc
authored
Sep 27, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加错误码:登录信息失效,请重新登录
parent
cc855e8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
AuthInterceptor.java
.../java/com/gic/enterprise/interceptor/AuthInterceptor.java
+15
-8
No files found.
gic-enterprise-common/src/main/java/com/gic/enterprise/interceptor/AuthInterceptor.java
View file @
53e6f9cc
...
...
@@ -22,13 +22,14 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
private
static
final
Logger
log
=
LogManager
.
getLogger
(
AuthInterceptor
.
class
);
private
static
final
Map
<
String
,
Object
>
ignoreUriMap
=
new
HashMap
<>(
16
);
private
static
final
Map
<
String
,
Object
>
ignoreUriBeforeLoginMap
=
new
HashMap
<>(
16
);
private
static
final
Map
<
String
,
Object
>
ignoreUriAfterLoginMap
=
new
HashMap
<>(
16
);
static
{
ignoreUriMap
.
put
(
"/gic-auth-web/login"
,
"1"
);
ignoreUriMap
.
put
(
"/gic-auth-web/logout"
,
"1"
);
ignoreUriMap
.
put
(
"/gic-auth-web/list-enterprise-by-phone"
,
"1"
);
ignoreUriMap
.
put
(
"/gic-auth-web/login-user-menu"
,
"1"
);
ignoreUriMap
.
put
(
"/gic-auth-web/login-user-operation-item"
,
"1"
);
ignoreUri
BeforeLogin
Map
.
put
(
"/gic-auth-web/login"
,
"1"
);
ignoreUri
BeforeLogin
Map
.
put
(
"/gic-auth-web/logout"
,
"1"
);
ignoreUri
BeforeLogin
Map
.
put
(
"/gic-auth-web/list-enterprise-by-phone"
,
"1"
);
ignoreUri
AfterLogin
Map
.
put
(
"/gic-auth-web/login-user-menu"
,
"1"
);
ignoreUri
AfterLogin
Map
.
put
(
"/gic-auth-web/login-user-operation-item"
,
"1"
);
}
@Override
...
...
@@ -41,14 +42,20 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
String
uri
=
request
.
getRequestURI
();
log
.
info
(
"用户接口访问路由:{}"
,
uri
);
//不需要拦截的路径
if
(
ignoreUriMap
.
containsKey
(
uri
))
{
if
(
ignoreUri
BeforeLogin
Map
.
containsKey
(
uri
))
{
return
true
;
}
//判断是否有权限的路径
UserDetail
userDetail
=
UserDetailUtils
.
getUserDetail
();
if
(
userDetail
==
null
||
userDetail
.
getUserInfo
()
==
null
)
{
throw
new
CommonException
(
ErrorCode
.
SYSTEM_ERROR
.
getErrorCode
(),
"登录信息不存在
,请重新登录"
);
throw
new
CommonException
(
ErrorCode
.
LOGIN_INVALID
.
getErrorCode
(),
"登录信息失效
,请重新登录"
);
}
//不需要拦截的路径
if
(
ignoreUriAfterLoginMap
.
containsKey
(
uri
))
{
return
true
;
}
if
(
userDetail
.
getUserInfo
().
getSuperAdmin
().
intValue
()
==
1
)
{
//超级管理员不限制
return
true
;
...
...
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