Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baihang-report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
data-spider
baihang-report
Commits
f1c932a5
Commit
f1c932a5
authored
Oct 31, 2019
by
data爬虫-冯 军凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内网项目删除全县拦截
parent
c8c0fe8d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
95 deletions
+0
-95
AuthHandlerInterceptorAdapter.java
...roup/report/config/web/AuthHandlerInterceptorAdapter.java
+0
-70
WebMvcConfigure.java
...java/cn/quantgroup/report/config/web/WebMvcConfigure.java
+0
-25
No files found.
src/main/java/cn/quantgroup/report/config/web/AuthHandlerInterceptorAdapter.java
deleted
100644 → 0
View file @
c8c0fe8d
package
cn
.
quantgroup
.
report
.
config
.
web
;
import
cn.quantgroup.report.error.QGException
;
import
cn.quantgroup.report.error.QGExceptionType
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @Author fengjunkai
*/
@Slf4j
public
class
AuthHandlerInterceptorAdapter
extends
HandlerInterceptorAdapter
{
public
static
final
String
KEY
=
"key"
;
protected
boolean
ignore
;
public
AuthHandlerInterceptorAdapter
(
boolean
ignore
)
{
super
();
this
.
ignore
=
ignore
;
}
public
boolean
preHandle
(
HttpServletRequest
arg0
,
HttpServletResponse
arg1
,
Object
arg2
)
throws
Exception
{
log
.
info
(
"ip:{},path:{}"
,
arg0
.
getRemoteAddr
(),
arg0
.
getRequestURI
());
if
(
ignore
||
StringUtils
.
equalsIgnoreCase
(
"b5140fb2-2c85-4b5a-abcf-3e97528014db"
,
getKey
(
arg0
)))
{
return
true
;
}
throw
new
QGException
(
QGExceptionType
.
COMMON_AUTH_ERROR
);
}
private
String
getKey
(
HttpServletRequest
arg0
)
{
String
key
=
arg0
.
getParameter
(
KEY
);
if
(
StringUtils
.
isNoneBlank
(
key
))
{
return
key
;
}
key
=
arg0
.
getHeader
(
KEY
);
if
(
StringUtils
.
isNoneBlank
(
key
))
{
return
key
;
}
Cookie
[]
cookies
=
arg0
.
getCookies
();
if
(
cookies
!=
null
&&
cookies
.
length
>
0
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
cookie
.
getName
(),
KEY
))
{
return
cookie
.
getValue
();
}
}
}
return
null
;
}
/**
* 在controller执行之后的DispatcherServlet之后执行
*/
public
void
postHandle
(
HttpServletRequest
arg0
,
HttpServletResponse
arg1
,
Object
arg2
,
ModelAndView
arg3
)
throws
Exception
{
}
/**
* 在页面渲染完成返回给客户端之前执行
*/
public
void
afterCompletion
(
HttpServletRequest
arg0
,
HttpServletResponse
arg1
,
Object
arg2
,
Exception
arg3
)
throws
Exception
{
}
}
src/main/java/cn/quantgroup/report/config/web/WebMvcConfigure.java
deleted
100644 → 0
View file @
c8c0fe8d
package
cn
.
quantgroup
.
report
.
config
.
web
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
/**
* @Author fengjunkai
*/
@Configuration
public
class
WebMvcConfigure
extends
WebMvcConfigurerAdapter
{
@Value
(
"${isDebug}"
)
private
Boolean
isDebug
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
new
AuthHandlerInterceptorAdapter
(
isDebug
))
.
addPathPatterns
(
"/ex/**"
)
.
addPathPatterns
(
"/manualtool/**"
)
.
addPathPatterns
(
"/cache/**"
);
}
}
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