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
2f0ef6ba
Commit
2f0ef6ba
authored
Oct 12, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加登录校验接口
parent
fd8c1e3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
IgnoreLogin.java
...mon/src/main/java/com/gic/enterprise/ano/IgnoreLogin.java
+20
-0
AuthInterceptor.java
.../java/com/gic/enterprise/interceptor/AuthInterceptor.java
+12
-0
No files found.
gic-enterprise-common/src/main/java/com/gic/enterprise/ano/IgnoreLogin.java
0 → 100644
View file @
2f0ef6ba
package
com
.
gic
.
enterprise
.
ano
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
*
* @ClassName: IgnoreAuth
* @Description: 忽略登录认证的请求
* @author xugh
* @date 2018年5月28日 下午1:45:56
*
*/
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
IgnoreLogin
{
}
gic-enterprise-common/src/main/java/com/gic/enterprise/interceptor/AuthInterceptor.java
View file @
2f0ef6ba
package
com
.
gic
.
enterprise
.
interceptor
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.enterprise.ano.IgnoreLogin
;
import
com.gic.enterprise.base.UserInfo
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.context.UserContext
;
...
...
@@ -12,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -45,6 +47,16 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
RpcContext
.
getContext
().
getAttachments
().
put
(
Constants
.
USER_TOKEN
,
token
);
System
.
out
.
println
(
JSON
.
toJSONString
(
RpcContext
.
getContext
().
getArguments
()));
if
(!(
object
.
getClass
().
isAssignableFrom
(
HandlerMethod
.
class
)))
{
return
true
;
}
HandlerMethod
handler
=
(
HandlerMethod
)
object
;
IgnoreLogin
ignoreLogin
=
handler
.
getMethodAnnotation
(
IgnoreLogin
.
class
);
if
(
null
!=
ignoreLogin
)
{
return
true
;
}
//获取uri
String
uri
=
request
.
getRequestURI
();
String
isControl
=
request
.
getParameter
(
"isControl"
);
...
...
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