Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
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
gechengyang
nouiWithSpringMVC
Commits
a5f78102
Commit
a5f78102
authored
Jul 27, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.整理用户信息
2.完善打包插件
parent
f5f1108e
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
83 additions
and
171 deletions
+83
-171
pom.xml
pom.xml
+25
-0
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+0
-1
NoUiContext.java
...n/java/org/sss/presentation/noui/context/NoUiContext.java
+6
-9
NoUiPresentation.java
...a/org/sss/presentation/noui/context/NoUiPresentation.java
+2
-2
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+16
-12
FileBrowserController.java
...s/presentation/noui/controller/FileBrowserController.java
+2
-2
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+4
-4
LoginInfo.java
src/main/java/org/sss/presentation/noui/jwt/LoginInfo.java
+3
-3
OpenTransInterceptor.java
...a/org/sss/presentation/noui/jwt/OpenTransInterceptor.java
+0
-90
TokenInterceptor.java
.../java/org/sss/presentation/noui/jwt/TokenInterceptor.java
+10
-14
NoUiPresentationUtil.java
.../org/sss/presentation/noui/util/NoUiPresentationUtil.java
+4
-4
NoUiUtils.java
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
+4
-25
ResourceAcccessEncryptUtil.java
...ss/presentation/noui/util/ResourceAcccessEncryptUtil.java
+3
-3
StringUtil.java
src/main/java/org/sss/presentation/noui/util/StringUtil.java
+4
-2
No files found.
pom.xml
View file @
a5f78102
...
...
@@ -23,6 +23,7 @@
<properties>
<project.build.sourceEncoding>
GBK
</project.build.sourceEncoding>
<maven-dependency-plugin.version>
3.2.0
</maven-dependency-plugin.version>
<maven-jar-plugin_version>
3.2.0
</maven-jar-plugin_version>
<spring.version>
5.1.3.RELEASE
</spring.version>
<slf4j-api_version>
1.7.25
</slf4j-api_version>
<jul-to-slf4j_version>
1.7.30
</jul-to-slf4j_version>
...
...
@@ -349,6 +350,30 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<version>
${maven-jar-plugin_version}
</version>
<configuration>
<includes>
<include>
**/*.class
</include>
<include>
**/META-INF/*
</include>
</includes>
<archive>
<manifest>
<!-- 配置加入依赖包 -->
<addClasspath>
true
</addClasspath>
<useUniqueVersions>
false
</useUniqueVersions>
<addDefaultImplementationEntries>
true
</addDefaultImplementationEntries>
<!-- 启动类,子类配置 -->
<!-- <mainClass>com.brilliance.esb.main.Starter</mainClass>-->
</manifest>
<!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
<addMavenDescriptor>
false
</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<version>
${maven-dependency-plugin.version}
</version>
<!-- 复制依赖 -->
...
...
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
a5f78102
...
...
@@ -20,7 +20,6 @@ public class Constants {
public
final
static
String
SESSION
=
"session"
;
public
final
static
String
BACKGROUND_FLAG
=
"BackGroundRequest-"
;
public
final
static
String
APP_FLAG
=
"AppRequest-"
;
public
static
final
String
PAGINATION
=
"pagination"
;
public
static
final
String
PAGINATION_INDEX
=
"index"
;
...
...
src/main/java/org/sss/presentation/noui/context/NoUiContext.java
View file @
a5f78102
...
...
@@ -3,7 +3,7 @@ package org.sss.presentation.noui.context;
import
log.Log
;
import
log.LogFactory
;
import
org.sss.common.impl.AbstractContext
;
import
org.sss.presentation.noui.jwt.
RedisLoginInfo
;
import
org.sss.presentation.noui.jwt.
LoginInfo
;
import
org.sss.presentation.noui.util.NoUiUtils
;
public
class
NoUiContext
extends
AbstractContext
{
...
...
@@ -16,9 +16,6 @@ public class NoUiContext extends AbstractContext {
@Override
public
void
logout
(
DataType
arg0
,
String
arg1
)
{
// if(redisLoginInfo != null){
// NoUiUtils.logout(redisLoginInfo.getUserId(),redisLoginInfo.getTerminalType());
// }
log
.
info
(
"logout start:datatype["
+
arg0
+
"],userid["
+
arg1
+
"]"
);
if
(
arg0
.
equals
(
DataType
.
USER_NAME
)){
NoUiUtils
.
logout
(
arg1
,
"*"
);
...
...
@@ -31,14 +28,14 @@ public class NoUiContext extends AbstractContext {
return
null
;
}
private
RedisLoginInfo
redisLoginInfo
;
private
LoginInfo
loginInfo
;
public
RedisLoginInfo
getRedisLoginInfo
()
public
LoginInfo
getLoginInfo
()
{
return
this
.
redisLoginInfo
;
return
this
.
loginInfo
;
}
public
void
set
RedisLoginInfo
(
RedisLoginInfo
redisLoginInfo
)
public
void
set
LoginInfo
(
LoginInfo
loginInfo
)
{
this
.
redisLoginInfo
=
redisLoginInfo
;
this
.
loginInfo
=
loginInfo
;
}
}
src/main/java/org/sss/presentation/noui/context/NoUiPresentation.java
View file @
a5f78102
...
...
@@ -81,7 +81,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
@Override
public
Object
readFromSession
(
String
name
)
{
return
((
NoUiContext
)
this
.
ctx
).
get
Redis
LoginInfo
().
getContextMap
().
get
(
name
);
return
((
NoUiContext
)
this
.
ctx
).
getLoginInfo
().
getContextMap
().
get
(
name
);
}
@Override
...
...
@@ -96,7 +96,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
@Override
public
void
writeToSession
(
String
name
,
Object
value
)
{
((
NoUiContext
)
this
.
ctx
).
get
Redis
LoginInfo
().
getContextMap
().
put
(
name
,
value
);
((
NoUiContext
)
this
.
ctx
).
getLoginInfo
().
getContextMap
().
put
(
name
,
value
);
}
public
String
getMessageCode
()
{
...
...
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
a5f78102
...
...
@@ -22,8 +22,11 @@ import org.sss.presentation.noui.context.NoUiContext;
import
org.sss.presentation.noui.context.NoUiContextManager
;
import
org.sss.presentation.noui.context.NoUiPresentation
;
import
org.sss.presentation.noui.context.TxInfo
;
import
org.sss.presentation.noui.jwt.RedisLoginInfo
;
import
org.sss.presentation.noui.util.*
;
import
org.sss.presentation.noui.jwt.LoginInfo
;
import
org.sss.presentation.noui.util.DataSecurityUtil
;
import
org.sss.presentation.noui.util.EhcacheUtils
;
import
org.sss.presentation.noui.util.NoUiPresentationUtil
;
import
org.sss.presentation.noui.util.StringUtil
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -70,14 +73,15 @@ public abstract class AbstractCommonController {
context
.
getSession
().
storeData
(
key
,
paramsMap
.
get
(
key
));
}
// 设置old sysmod
RedisLoginInfo
redisL
oginInfo
=
null
;
LoginInfo
l
oginInfo
=
null
;
if
(!
StringUtils
.
isEmpty
(
noUiRequest
.
getUserId
())){
//开放模式下
redisLoginInfo
=
(
RedisLoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
loginInfo
=
(
LoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
if
(
loginInfo
!=
null
)
{
if
(
loginInfo
.
getSysmod
()!=
null
){
NoUiPresentationUtil
.
setSysmod
(
context
,
(
byte
[])
loginInfo
.
getSysmod
());
}
context
.
setLoginInfo
(
loginInfo
);
}
if
(
redisLoginInfo
!=
null
)
{
NoUiPresentationUtil
.
setSysmod
(
context
,
(
byte
[])
redisLoginInfo
.
getSysmod
());
context
.
setRedisLoginInfo
(
redisLoginInfo
);
}
// 交易跳转
...
...
@@ -161,12 +165,12 @@ public abstract class AbstractCommonController {
IOUtils
.
write
(
data
,
response
.
getOutputStream
());
}
// 保存新的
Redis
LoginInfo
if
(
redisLoginInfo
!=
null
)
//当为开放模式下,redisLoginInfo 为空
// 保存新的LoginInfo
if
(
loginInfo
!=
null
)
//当为开放模式下
{
byte
[]
sysmodBytes
=
NoUiPresentationUtil
.
sysmodToBytes
(
context
);
redisL
oginInfo
.
setSysmod
(
sysmodBytes
);
EhcacheUtils
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisL
oginInfo
);
l
oginInfo
.
setSysmod
(
sysmodBytes
);
EhcacheUtils
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
l
oginInfo
);
}
Map
<
String
,
Object
>
paginationData
=
new
HashMap
<>();
Map
<
String
,
Object
>
afterReturnData
=
handleReturnData
(
eventType
,
context
,
noUiRequest
,
alias
,
paginationData
);
...
...
src/main/java/org/sss/presentation/noui/controller/FileBrowserController.java
View file @
a5f78102
...
...
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.sss.presentation.noui.api.response.NoUiVersion
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.jwt.
Redis
LoginInfo
;
import
org.sss.presentation.noui.jwt.LoginInfo
;
import
org.sss.presentation.noui.util.EhcacheUtils
;
import
org.sss.presentation.noui.util.StringUtil
;
...
...
@@ -53,7 +53,7 @@ public class FileBrowserController {
//redis获取token
Set
<
String
>
keys
=
EhcacheUtils
.
keys
(
Constants
.
SESSION
+
"."
+
usrName
);
if
(!
keys
.
isEmpty
())
{
token
=
((
Redis
LoginInfo
)
keys
.
toArray
()[
0
]).
getToken
();
token
=
((
LoginInfo
)
keys
.
toArray
()[
0
]).
getToken
();
}
else
return
false
;
StringBuilder
sb
=
new
StringBuilder
(
usrName
);
...
...
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
a5f78102
...
...
@@ -23,7 +23,7 @@ import org.sss.presentation.noui.context.NoUiContextManager;
import
org.sss.presentation.noui.context.TxInfo
;
import
org.sss.presentation.noui.jwt.JWT
;
import
org.sss.presentation.noui.jwt.JwtLogin
;
import
org.sss.presentation.noui.jwt.
Redis
LoginInfo
;
import
org.sss.presentation.noui.jwt.LoginInfo
;
import
org.sss.presentation.noui.util.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -110,14 +110,14 @@ public class LoginController {
// redis中存储用户相关信息
IDatafield
inridf
=
(
IDatafield
)
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
"sysmod\\usr\\inr"
);
RedisLoginInfo
redisLoginInfo
=
new
Redis
LoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
,
noUiRequest
.
getTerminalType
());
redisL
oginInfo
.
setUserInr
((
String
)
inridf
.
getValue
());
//设置当前用户主键
LoginInfo
loginInfo
=
new
LoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
,
noUiRequest
.
getTerminalType
());
l
oginInfo
.
setUserInr
((
String
)
inridf
.
getValue
());
//设置当前用户主键
request
.
getSession
().
setAttribute
(
"token"
,
token
);
NoUiUtils
.
logout
(
userId
,
"*"
);
//清理可能存在的历史缓存
EhcacheUtils
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisL
oginInfo
);
EhcacheUtils
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
l
oginInfo
);
EhcacheUtils
.
set
(
StringUtil
.
getCacheSessionId
(
noUiRequest
.
getUserId
()),
request
.
getSession
().
getId
());
//解决初次登陆,超期限登陆
...
...
src/main/java/org/sss/presentation/noui/jwt/
Redis
LoginInfo.java
→
src/main/java/org/sss/presentation/noui/jwt/LoginInfo.java
View file @
a5f78102
...
...
@@ -4,7 +4,7 @@ import java.io.Serializable;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
RedisLoginInfo
implements
Serializable
{
public
class
LoginInfo
implements
Serializable
{
/**
*
*/
...
...
@@ -44,11 +44,11 @@ public class RedisLoginInfo implements Serializable {
this
.
contextMap
=
contextMap
;
}
public
RedisLoginInfo
()
{
public
LoginInfo
()
{
}
public
RedisLoginInfo
(
String
userId
,
String
token
,
long
expiredTime
,
Object
sysmod
,
String
terminalType
)
{
public
LoginInfo
(
String
userId
,
String
token
,
long
expiredTime
,
Object
sysmod
,
String
terminalType
)
{
this
.
userId
=
userId
;
this
.
token
=
token
;
this
.
expiredTime
=
expiredTime
;
...
...
src/main/java/org/sss/presentation/noui/jwt/OpenTransInterceptor.java
deleted
100644 → 0
View file @
f5f1108e
package
org
.
sss
.
presentation
.
noui
.
jwt
;
import
com.google.gson.Gson
;
import
log.Log
;
import
log.LogFactory
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.sss.presentation.noui.api.request.NoUiRequest
;
import
org.sss.presentation.noui.api.response.ErrorCodes
;
import
org.sss.presentation.noui.api.response.NoUiVersion
;
import
org.sss.presentation.noui.api.response.Result
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.context.NoUiContextManager
;
import
org.sss.presentation.noui.util.EhcacheUtils
;
import
org.sss.presentation.noui.util.NumericUtil
;
import
org.sss.presentation.noui.util.StringUtil
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.PrintWriter
;
public
class
OpenTransInterceptor
implements
HandlerInterceptor
{
protected
static
final
Log
log
=
LogFactory
.
getLog
(
OpenTransInterceptor
.
class
);
@Autowired
private
NoUiVersion
noUiVersion
;
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
arg3
)
throws
Exception
{
}
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
model
)
throws
Exception
{
}
// 拦截每个请求
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
response
.
setCharacterEncoding
(
Constants
.
ENCODING
);
NoUiRequest
noUiRequest
=
new
NoUiRequest
(
request
,
""
,
null
);
String
token
=
noUiRequest
.
getToken
();
String
userId
=
noUiRequest
.
getUserId
();
String
terminalType
=
noUiRequest
.
getTerminalType
();
// APP WEB
RedisLoginInfo
redisLoginInfo
=
null
;
if
(!
StringUtils
.
isEmpty
(
noUiRequest
.
getUserId
()))
//开放模式下
redisLoginInfo
=
(
RedisLoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
//如果是已登录状态,要刷新超时时间
if
(
redisLoginInfo
!=
null
&&
System
.
currentTimeMillis
()
<=
redisLoginInfo
.
getExpiredTime
())
{
// 重新刷入登陆时间
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisLoginInfo
.
getSysmod
(),
noUiRequest
.
getTerminalType
());
EhcacheUtils
.
set
(
Constants
.
SESSION
+
"."
+
userId
+
"."
+
terminalType
,
nweRedisLoginInfo
);
EhcacheUtils
.
set
(
StringUtil
.
getCacheSessionId
(
userId
),
request
.
getSession
().
getId
());
}
String
url
=
request
.
getRequestURI
();
String
trnnam
=
null
;
int
idx1
=
url
.
indexOf
(
NoUiContextManager
.
openSourcePrefix
);
int
begpos
=
idx1
+
NoUiContextManager
.
openSourcePrefix
.
length
()
+
1
;
int
idx2
=
url
.
indexOf
(
"/"
,
begpos
);
if
(
idx2
>
0
)
trnnam
=
url
.
substring
(
begpos
,
idx2
);
if
(
trnnam
==
null
)
{
Result
rt
=
new
Result
(
ErrorCodes
.
UNKNOEW_TRANS
,
"未知的交易"
,
null
,
noUiVersion
.
getVersion
());
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
//交易必须是配置允许开放的交易
log
.
debug
(
"开放访问交易名:"
+
trnnam
);
if
(!
NoUiContextManager
.
openTransactions
.
contains
(
trnnam
))
{
Result
rt
=
new
Result
(
ErrorCodes
.
FORBIDDEN_TRANS
,
"非法访问"
,
null
,
noUiVersion
.
getVersion
());
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
return
true
;
}
// 请求不通过,返回错误信息给客户端
private
void
responseMessage
(
HttpServletResponse
response
,
PrintWriter
out
,
Result
result
)
{
response
.
setContentType
(
"application/json; charset="
+
Constants
.
ENCODING
);
String
json
=
new
Gson
().
toJson
(
result
);
out
.
print
(
json
);
out
.
flush
();
out
.
close
();
}
}
\ No newline at end of file
src/main/java/org/sss/presentation/noui/jwt/TokenInterceptor.java
View file @
a5f78102
...
...
@@ -47,10 +47,6 @@ public class TokenInterceptor implements HandlerInterceptor {
return
false
;
}
//如果为后台直接调用交易,则直接跳过token验证,无需redis缓存
if
(
token
.
startsWith
(
Constants
.
BACKGROUND_FLAG
))
{
return
true
;
}
//服务调用
if
(
token
.
startsWith
(
Constants
.
APP_FLAG
))
{
return
true
;
...
...
@@ -64,39 +60,39 @@ public class TokenInterceptor implements HandlerInterceptor {
return
false
;
}
RedisLoginInfo
redisLoginInfo
=
(
Redis
LoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
if
(
redisL
oginInfo
==
null
)
{
LoginInfo
loginInfo
=
(
LoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
if
(
l
oginInfo
==
null
)
{
Result
rt
=
new
Result
(
ErrorCodes
.
LOGIN_ERROR
,
"登陆异常"
,
null
,
noUiVersion
.
getVersion
());
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
//验证token是否一致
if
(!
token
.
equals
(
redisL
oginInfo
.
getToken
()))
{
if
(!
token
.
equals
(
l
oginInfo
.
getToken
()))
{
Result
rt
=
new
Result
(
ErrorCodes
.
LOGIN_TOKEN_CHECKERROR
,
"token失效,该用户被强迫下线"
,
null
,
noUiVersion
.
getVersion
());
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
// 验证登录时间
if
(
System
.
currentTimeMillis
()
>
redisL
oginInfo
.
getExpiredTime
())
{
if
(
System
.
currentTimeMillis
()
>
l
oginInfo
.
getExpiredTime
())
{
Result
rt
=
new
Result
(
ErrorCodes
.
LOGIN_TIMEOUT
,
"会话超时,请重新登录。超时时间戳:"
+
redisL
oginInfo
.
getExpiredTime
()
+
Result
rt
=
new
Result
(
ErrorCodes
.
LOGIN_TIMEOUT
,
"会话超时,请重新登录。超时时间戳:"
+
l
oginInfo
.
getExpiredTime
()
+
",当前时间戳:"
+
System
.
currentTimeMillis
(),
null
,
noUiVersion
.
getVersion
());
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
// 重新刷入登陆时间
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisL
oginInfo
.
getSysmod
(),
noUiRequest
.
getTerminalType
());
EhcacheUtils
.
set
(
Constants
.
SESSION
+
"."
+
userId
+
"."
+
terminalType
,
nweRedis
LoginInfo
);
EhcacheUtils
.
set
(
StringUtil
.
getCacheSessionId
(
userId
),
request
.
getSession
().
getId
());
LoginInfo
nweLoginInfo
=
new
LoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
l
oginInfo
.
getSysmod
(),
noUiRequest
.
getTerminalType
());
EhcacheUtils
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
nwe
LoginInfo
);
EhcacheUtils
.
set
(
StringUtil
.
getCacheSessionId
(
userId
),
request
.
getSession
().
getId
());
NoUiUtils
.
setLoginInfo
(
nwe
Redis
LoginInfo
);
NoUiUtils
.
setLoginInfo
(
nweLoginInfo
);
return
true
;
}
// 请求不通过,返回错误信息给客户端
private
void
responseMessage
(
HttpServletResponse
response
,
PrintWriter
out
,
Result
result
)
{
response
.
setContentType
(
"application/json; charset="
+
Constants
.
ENCODING
);
response
.
setContentType
(
"application/json; charset="
+
Constants
.
ENCODING
);
String
json
=
new
Gson
().
toJson
(
result
);
out
.
print
(
json
);
out
.
flush
();
...
...
src/main/java/org/sss/presentation/noui/util/NoUiPresentationUtil.java
View file @
a5f78102
...
...
@@ -61,7 +61,7 @@ public class NoUiPresentationUtil {
for
(
Map
<
String
,
Object
>
m
:
valueList
)
{
IModule
module
=
moduleList
.
add
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
m
.
entrySet
())
handleDatafield
(
context
,
(
IDatafield
<
Object
>)
module
.
get
(
changeForELCS
(
entry
.
getKey
())),
entry
.
getValue
());
handleDatafield
(
context
,
(
IDatafield
<
Object
>)
module
.
get
(
obfuscationPath
(
entry
.
getKey
())),
entry
.
getValue
());
}
}
}
...
...
@@ -286,7 +286,7 @@ public class NoUiPresentationUtil {
IModule
module
=
(
IModule
)
moduleList
.
get
(
index
);
Collection
<
IDatafield
>
datafields
=
module
.
getDatafields
();
for
(
IDatafield
datafield
:
datafields
)
{
map
.
put
(
changeForELCS
(
datafield
.
getName
()),
handle
(
datafield
.
getValue
(),
datafield
));
map
.
put
(
obfuscationPath
(
datafield
.
getName
()),
handle
(
datafield
.
getValue
(),
datafield
));
}
list
.
add
(
map
);
}
...
...
@@ -376,8 +376,8 @@ public class NoUiPresentationUtil {
return
sysmodBytes
;
}
//偏移 头4 尾7
public
static
String
changeForELCS
(
String
str
){
//
混淆路径,算法:
偏移 头4 尾7
public
static
String
obfuscationPath
(
String
str
){
if
(
NoUiUtils
.
fieldencode
){
String
btw_str
=
str
.
substring
(
1
,
str
.
length
()-
1
);
String
head
=
change
(
str
.
charAt
(
0
),
4
);
...
...
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
View file @
a5f78102
...
...
@@ -10,7 +10,7 @@ import org.sss.presentation.noui.api.request.NoUiRequest;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.context.NoUiContext
;
import
org.sss.presentation.noui.context.NoUiPresentation
;
import
org.sss.presentation.noui.jwt.
Redis
LoginInfo
;
import
org.sss.presentation.noui.jwt.LoginInfo
;
import
org.sss.util.ContainerUtils
;
import
java.util.ArrayList
;
...
...
@@ -124,10 +124,10 @@ public class NoUiUtils {
}
}
public
static
ThreadLocal
<
RedisLoginInfo
>
tl
=
new
ThreadLocal
<
Redis
LoginInfo
>();
public
static
ThreadLocal
<
LoginInfo
>
tl
=
new
ThreadLocal
<
LoginInfo
>();
public
static
void
setLoginInfo
(
RedisLoginInfo
redisL
oginInfo
){
tl
.
set
(
redisL
oginInfo
);
public
static
void
setLoginInfo
(
LoginInfo
l
oginInfo
){
tl
.
set
(
l
oginInfo
);
}
...
...
@@ -151,27 +151,6 @@ public class NoUiUtils {
}
public
final
static
String
salt
=
"706798214808651@;RHxC"
;
/**
*
* @param keyParams 要素
* @return
*/
public
static
String
genSafeCode
(
String
[]
keyParams
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
=
sb
.
append
(
tl
.
get
().
getUserInr
()).
reverse
();
for
(
String
item
:
keyParams
)
{
sb
.
append
(
item
);
}
sb
.
append
(
getToken
());
sb
.
append
(
salt
);
return
DigestUtils
.
md5Hex
(
sb
.
toString
());
}
public
static
boolean
verfyParams
(
String
[]
keyParams
,
String
safeCode
)
{
return
safeCode
.
equals
(
genSafeCode
(
keyParams
));
}
public
static
String
getDatapath
()
{
return
datapath
;
...
...
src/main/java/org/sss/presentation/noui/util/ResourceAcccessEncryptUtil.java
View file @
a5f78102
...
...
@@ -2,7 +2,7 @@ package org.sss.presentation.noui.util;
import
cfca.sadk.algorithm.sm2.SM3Digest
;
import
org.sss.presentation.noui.common.Constants
;
import
org.sss.presentation.noui.jwt.
Redis
LoginInfo
;
import
org.sss.presentation.noui.jwt.LoginInfo
;
public
class
ResourceAcccessEncryptUtil
{
private
static
final
String
KEY
=
"session.##.WEB"
;
...
...
@@ -23,9 +23,9 @@ public class ResourceAcccessEncryptUtil {
if
(
obj
==
null
)
{
return
false
;
}
RedisLoginInfo
redisLoginInfo
=
(
Redis
LoginInfo
)
obj
;
LoginInfo
loginInfo
=
(
LoginInfo
)
obj
;
StringBuilder
raw
=
new
StringBuilder
();
raw
.
append
(
redisL
oginInfo
.
getToken
());
raw
.
append
(
l
oginInfo
.
getToken
());
raw
.
append
(
SALT
);
raw
.
append
(
rawuid
);
raw
.
append
(
SALT
);
...
...
src/main/java/org/sss/presentation/noui/util/StringUtil.java
View file @
a5f78102
...
...
@@ -8,14 +8,16 @@ import java.security.MessageDigest;
public
class
StringUtil
{
public
static
boolean
isEmpty
(
String
str
)
{
if
(
str
==
null
||
str
.
trim
().
equals
(
""
))
{
if
(
str
==
null
||
str
.
trim
().
equals
(
""
))
{
return
true
;
}
return
false
;
}
public
static
String
userUniqueId
(
NoUiRequest
request
)
{
return
Constants
.
SESSION
+
"."
+
request
.
getUserId
()
+
"."
+
request
.
getTerminalType
();
String
setKey
=
new
StringBuilder
(
Constants
.
SESSION
).
append
(
"."
).
append
(
request
.
getUserId
()).
append
(
"."
).
append
(
request
.
getTerminalType
()).
toString
();
return
setKey
;
}
/**
...
...
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