Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
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
首航-临时账号
api
Commits
dbc87957
Commit
dbc87957
authored
Jul 25, 2022
by
罗胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022-07-25 罗胜
1.登录加密
parent
8426466b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
162 additions
and
1 deletions
+162
-1
GConstants.java
src/com/ejweb/core/conf/GConstants.java
+1
-1
BasicVerifyFilter.java
src/com/ejweb/core/filter/BasicVerifyFilter.java
+1
-0
OilAnalysisService.java
src/com/ejweb/modules/airport/service/OilAnalysisService.java
+2
-0
HuaweiUCSyncService.java
src/com/ejweb/modules/im/service/HuaweiUCSyncService.java
+0
-0
ShortMessageService.java
src/com/ejweb/modules/message/service/ShortMessageService.java
+10
-0
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+12
-0
DtoaUtils.java
src/com/ejweb/modules/user/utils/DtoaUtils.java
+136
-0
No files found.
src/com/ejweb/core/conf/GConstants.java
View file @
dbc87957
...
...
@@ -206,7 +206,7 @@ public class GConstants {
return
System
.
getProperty
(
key
);
}
public
static
String
getValue
(
String
key
,
String
want
)
{
public
static
String
getValue
(
String
key
,
String
want
)
{
String
val
=
getValue
(
key
);
if
(
val
==
null
)
return
want
;
...
...
src/com/ejweb/core/filter/BasicVerifyFilter.java
View file @
dbc87957
...
...
@@ -110,6 +110,7 @@ public class BasicVerifyFilter implements Filter {
// 基本参数不为NULL
if
(
content
!=
null
)
{
message
=
"无效请求"
;
System
.
out
.
println
(
content
);
BaseUserBean
baseUserBean
=
JSON
.
parseObject
(
content
,
BaseUserBean
.
class
);
// BaseUserBean baseUserBean = JSON.parseObject("{\"userSign\":\"1000849147\"}", BaseUserBean.class); //测试使用
String
userSign
=
baseUserBean
.
getUserSign
();
...
...
src/com/ejweb/modules/airport/service/OilAnalysisService.java
View file @
dbc87957
...
...
@@ -212,4 +212,6 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
return
oilAnalysisDao
.
getOilReasons
(
startTime
,
endTime
);
}
}
src/com/ejweb/modules/im/service/HuaweiUCSyncService.java
View file @
dbc87957
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/com/ejweb/modules/message/service/ShortMessageService.java
View file @
dbc87957
...
...
@@ -25,6 +25,8 @@ import org.apache.log4j.Logger;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -139,6 +141,14 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
return
false
;
}
public
static
void
main
(
String
[]
args
)
throws
UnsupportedEncodingException
{
String
url
=
"http://usertest.jdair.net/ussinterface/uss/json/mobile/messSend.json?ai.cp=10.68.26.52&ai.cc=5&mobile=15995791570&msg=95375"
;
HCFetcher
fetcher
=
HCFetcher
.
getInstance
();
FetchEntity
entity
=
fetcher
.
post
(
url
,
null
);
System
.
out
.
println
(
111
);
}
/**
* 添加发送短信记录
*
...
...
src/com/ejweb/modules/user/api/UserController.java
View file @
dbc87957
...
...
@@ -20,7 +20,9 @@ import com.ejweb.modules.role.service.UserRolesService;
import
com.ejweb.modules.user.bean.*
;
import
com.ejweb.modules.user.entity.*
;
import
com.ejweb.modules.user.service.UserService
;
import
com.ejweb.modules.user.utils.DtoaUtils
;
import
com.jdair.util.http.client.HTTPClientUtil
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.poi.hssf.usermodel.*
;
...
...
@@ -31,7 +33,11 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
sun.misc.BASE64Decoder
;
import
javax.crypto.Cipher
;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
...
...
@@ -162,6 +168,9 @@ public class UserController {
System
.
out
.
println
(
"[UserController login][STATUS_CODE_4102]总共用时:"
+
Util
.
getDurationTime
(
duration
));
return
responseBean
;
}
//用户名密码解密
loginBean
.
setLoginName
(
DtoaUtils
.
decrypt
(
loginBean
.
getLoginName
()));
loginBean
.
setPassword
(
DtoaUtils
.
decrypt
(
loginBean
.
getPassword
()));
String
blackUsername
=
redisUtils
.
get
(
"black_username:"
+
loginBean
.
getLoginName
(),
indexDb
);
boolean
sealup
=
false
;
if
(
null
!=
redisUsername
&&
Integer
.
parseInt
(
redisUsername
)
>=
usernameLimitTimes
&&
StringUtils
.
isEmpty
(
blackUsername
))
{
...
...
@@ -1127,4 +1136,7 @@ public class UserController {
}
}
}
src/com/ejweb/modules/user/utils/DtoaUtils.java
0 → 100644
View file @
dbc87957
package
com
.
ejweb
.
modules
.
user
.
utils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
DtoaUtils
{
private
static
String
base64hash
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
public
static
boolean
isMatcher
(
String
inStr
,
String
reg
)
{
Pattern
pattern
=
Pattern
.
compile
(
reg
);
Matcher
matcher
=
pattern
.
matcher
(
inStr
);
if
(
matcher
.
matches
())
{
return
true
;
}
return
false
;
}
/**
* btoa method
* @param inStr
* @return
*/
public
static
String
btoa
(
String
inStr
)
{
if
(
inStr
==
null
||
isMatcher
(
inStr
,
"([^\\u0000-\\u00ff])"
))
{
return
null
;
}
StringBuilder
result
=
new
StringBuilder
();
int
i
=
0
;
int
mod
=
0
;
int
ascii
;
int
prev
=
0
;
while
(
i
<
inStr
.
length
())
{
ascii
=
inStr
.
charAt
(
i
);
mod
=
i
%
3
;
switch
(
mod
)
{
case
0
:
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
(
ascii
>>
2
)));
break
;
case
1
:
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
((
prev
&
3
)
<<
4
|
(
ascii
>>
4
))));
break
;
case
2
:
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
((
prev
&
0x0f
)
<<
2
|
(
ascii
>>
6
))));
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
(
ascii
&
0x3f
)));
break
;
}
prev
=
ascii
;
i
++;
}
if
(
mod
==
0
)
{
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
((
prev
&
3
)
<<
4
)));
result
.
append
(
"=="
);
}
else
if
(
mod
==
1
)
{
result
.
append
(
String
.
valueOf
(
base64hash
.
charAt
((
prev
&
0x0f
)
<<
2
)));
result
.
append
(
"="
);
}
return
result
.
toString
();
}
/**
* atob method 逆转encode的思路即可
* @param inStr
* @return
*/
public
static
String
atob
(
String
inStr
)
{
if
(
inStr
==
null
)
return
null
;
inStr
=
inStr
.
replaceAll
(
"\\s|="
,
""
);
StringBuilder
result
=
new
StringBuilder
();
int
cur
;
int
prev
=
-
1
;
int
mod
;
int
i
=
0
;
while
(
i
<
inStr
.
length
())
{
cur
=
base64hash
.
indexOf
(
inStr
.
charAt
(
i
));
mod
=
i
%
4
;
switch
(
mod
)
{
case
0
:
break
;
case
1
:
result
.
append
(
String
.
valueOf
((
char
)
(
prev
<<
2
|
cur
>>
4
)));
break
;
case
2
:
result
.
append
(
String
.
valueOf
((
char
)
((
prev
&
0x0f
)
<<
4
|
cur
>>
2
)));
break
;
case
3
:
result
.
append
(
String
.
valueOf
((
char
)
((
prev
&
3
)
<<
6
|
cur
)));
break
;
}
prev
=
cur
;
i
++;
}
return
result
.
toString
();
}
/**
* 加密字符串
* @return
*/
public
static
String
encryption
(
String
str
)
{
String
encode
;
try
{
encode
=
URLEncoder
.
encode
(
str
,
"utf-8"
);
encode
=
encode
.
replaceAll
(
"\\+"
,
"%20"
);
//URLEncoder.encode 会将空格解释为+号
String
btoa
=
DtoaUtils
.
btoa
(
encode
);
return
btoa
;
}
catch
(
UnsupportedEncodingException
e
)
{
System
.
out
.
println
(
"加密失败!"
);
}
return
str
;
}
/**
* 解密字符串
* @return
*/
public
static
String
decrypt
(
String
str
)
{
String
atob
=
DtoaUtils
.
atob
(
str
);
try
{
String
decode
=
URLDecoder
.
decode
(
atob
,
"utf-8"
);
return
decode
;
}
catch
(
UnsupportedEncodingException
e
)
{
System
.
out
.
println
(
"atob加密函数出现错误。"
);
}
return
str
;
}
}
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