Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
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
head_group
xyqb-user2
Commits
389c9022
Commit
389c9022
authored
Nov 25, 2017
by
richard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改ip拦截策略
parent
3da06fe4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
Constants.java
src/main/java/cn/quantgroup/xyqb/Constants.java
+2
-2
PasswordErrorFiniteValidateAdvisor.java
...qb/aspect/captcha/PasswordErrorFiniteValidateAdvisor.java
+4
-0
No files found.
src/main/java/cn/quantgroup/xyqb/Constants.java
View file @
389c9022
...
@@ -39,9 +39,9 @@ public interface Constants {
...
@@ -39,9 +39,9 @@ public interface Constants {
String
REDIS_PASSWORD_ERROR_COUNT
=
"password_error_count:"
;
String
REDIS_PASSWORD_ERROR_COUNT
=
"password_error_count:"
;
String
REDIS_PASSWORD_ERROR_COUNT_FOR_IPV4
=
"password_error_count_4_ipv4:"
;
String
REDIS_PASSWORD_ERROR_COUNT_FOR_IPV4
=
"password_error_count_4_ipv4:"
;
String
IPV4_LOCK
=
"lock_ipv4:"
;
String
IPV4_LOCK
=
"lock_ipv4:"
;
Long
IPV4_LOCK_MINUTES
=
30L
;
Long
IPV4_LOCK_MINUTES
=
3
*
6
0L
;
Long
IPV4_COUNT_MINUTES
=
1L
;
Long
IPV4_COUNT_MINUTES
=
1L
;
Long
IPV4_LOCK_ON_COUNTS
=
20
0L
;
Long
IPV4_LOCK_ON_COUNTS
=
15
0L
;
int
DANGEROUS_TIME_START
=
22
;
int
DANGEROUS_TIME_START
=
22
;
int
DANGEROUS_TIME_END
=
6
;
int
DANGEROUS_TIME_END
=
6
;
String
CLEAR_LOCK_FOR_IPV4
=
"x-clear-lock-11241842-y"
;
String
CLEAR_LOCK_FOR_IPV4
=
"x-clear-lock-11241842-y"
;
...
...
src/main/java/cn/quantgroup/xyqb/aspect/captcha/PasswordErrorFiniteValidateAdvisor.java
View file @
389c9022
...
@@ -21,6 +21,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
...
@@ -21,6 +21,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Pattern
;
/**
/**
* 密码错误限次的校验
* 密码错误限次的校验
...
@@ -60,6 +61,9 @@ public class PasswordErrorFiniteValidateAdvisor {
...
@@ -60,6 +61,9 @@ public class PasswordErrorFiniteValidateAdvisor {
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
// 客户端IP
// 客户端IP
String
clientIp
=
getIp
(
request
);
String
clientIp
=
getIp
(
request
);
if
(
StringUtils
.
startsWith
(
clientIp
,
"139.198."
)){
return
pjp
.
proceed
();
}
String
lockIpv4Key
=
getLockIpv4Key
(
clientIp
);
String
lockIpv4Key
=
getLockIpv4Key
(
clientIp
);
String
lock
=
redisTemplate
.
opsForValue
().
get
(
lockIpv4Key
);
String
lock
=
redisTemplate
.
opsForValue
().
get
(
lockIpv4Key
);
if
(
Objects
.
equals
(
Boolean
.
TRUE
.
toString
(),
lock
)){
if
(
Objects
.
equals
(
Boolean
.
TRUE
.
toString
(),
lock
)){
...
...
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