Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
c4204e28
提交
c4204e28
authored
11月 01, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 优化公共链接参数长度
上级
23957417
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
43 行增加
和
40 行删除
+43
-40
F2CLinkFilter.java
.../src/main/java/io/dataease/auth/filter/F2CLinkFilter.java
+2
-1
ShiroServiceImpl.java
.../java/io/dataease/auth/service/impl/ShiroServiceImpl.java
+1
-0
LinkServer.java
.../java/io/dataease/controller/panel/server/LinkServer.java
+4
-5
PanelLinkService.java
...main/java/io/dataease/service/panel/PanelLinkService.java
+11
-7
rsaEncrypt.js
frontend/src/utils/rsaEncrypt.js
+5
-14
index.vue
frontend/src/views/link/generate/index.vue
+4
-3
index.vue
frontend/src/views/link/pwd/index.vue
+2
-2
index.vue
frontend/src/views/link/view/index.vue
+1
-1
index.vue
frontend/src/views/login/index.vue
+13
-7
没有找到文件。
backend/src/main/java/io/dataease/auth/filter/F2CLinkFilter.java
浏览文件 @
c4204e28
...
...
@@ -39,7 +39,8 @@ public class F2CLinkFilter extends AnonymousFilter {
panelLink
.
setPwd
(
"dataease"
);
pwd
=
panelLink
.
getPwd
();
}
else
{
pwd
=
RsaUtil
.
decryptByPrivateKey
(
RsaProperties
.
privateKey
,
panelLink
.
getPwd
());
/* pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, panelLink.getPwd()); */
pwd
=
panelLink
.
getPwd
();
}
return
JWTUtils
.
verifyLink
(
link_token
,
id
,
pwd
);
}
catch
(
Exception
e
)
{
...
...
backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
浏览文件 @
c4204e28
...
...
@@ -63,6 +63,7 @@ public class ShiroServiceImpl implements ShiroService {
// filterChainDefinitionMap.put("/axios.map", ANON);
filterChainDefinitionMap
.
put
(
"/api/auth/login"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/auth/isPluginLoaded"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/system/requestTimeOut"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/auth/validateName"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/auth/isOpenLdap"
,
ANON
);
...
...
backend/src/main/java/io/dataease/controller/panel/server/LinkServer.java
浏览文件 @
c4204e28
package
io
.
dataease
.
controller
.
panel
.
server
;
import
com.google.gson.Gson
;
import
io.dataease.base.domain.PanelLink
;
import
io.dataease.controller.ResultHolder
;
import
io.dataease.controller.panel.api.LinkApi
;
...
...
@@ -10,7 +9,6 @@ import io.dataease.controller.request.panel.link.EnablePwdRequest;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.controller.request.panel.link.ValidateRequest
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
io.dataease.dto.panel.link.ValidateDto
;
import
io.dataease.service.chart.ChartViewService
;
...
...
@@ -69,11 +67,12 @@ public class LinkServer implements LinkApi {
public
ValidateDto
validate
(
@RequestBody
Map
<
String
,
String
>
param
)
throws
Exception
{
String
link
=
param
.
get
(
"link"
);
String
json
=
panelLinkService
.
decryptParam
(
link
);
Gson
gson
=
new
Gson
();
/*
Gson gson = new Gson();
ValidateRequest
request
=
gson
.
fromJson
(
json
,
ValidateRequest
.
class
);
ValidateRequest request = gson.fromJson(json, ValidateRequest.class);
*/
ValidateDto
dto
=
new
ValidateDto
();
String
resourceId
=
request
.
getResourceId
();
String
resourceId
=
json
;
/* String resourceId = request.getResourceId(); */
PanelLink
one
=
panelLinkService
.
findOne
(
resourceId
);
dto
.
setResourceId
(
resourceId
);
if
(
ObjectUtils
.
isEmpty
(
one
)){
...
...
backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
浏览文件 @
c4204e28
...
...
@@ -116,18 +116,19 @@ public class PanelLinkService {
}
private
String
buildLinkParam
(
String
resourceId
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
/*
Map<String,Object> map = new HashMap<>();
map.put("resourceId", resourceId);
map.put("time", System.currentTimeMillis());
map.put("salt", salt);
Gson gson = new Gson();
String
encrypt
=
encrypt
(
gson
.
toJson
(
map
));
String
s
=
null
;
String encrypt = encrypt(gson.toJson(map)); */
String
encrypt
=
encrypt
(
resourceId
);
/* String s = null;
try {
s = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, encrypt);
} catch (Exception e) {
e.printStackTrace();
}
}
*/
return
encrypt
;
}
private
GenerateDto
convertDto
(
PanelLink
linl
){
...
...
@@ -154,7 +155,8 @@ public class PanelLinkService {
return
false
;
}
if
(
StringUtils
.
isEmpty
(
panelLink
.
getPwd
()))
return
false
;
boolean
verify
=
JWTUtils
.
verifyLink
(
token
,
panelLink
.
getResourceId
(),
decryptParam
(
panelLink
.
getPwd
()));
boolean
verify
=
JWTUtils
.
verifyLink
(
token
,
panelLink
.
getResourceId
(),
panelLink
.
getPwd
());
/* boolean verify = JWTUtils.verifyLink(token, panelLink.getResourceId(), decryptParam(panelLink.getPwd())); */
return
verify
;
}
...
...
@@ -167,10 +169,12 @@ public class PanelLinkService {
}
public
boolean
validatePwd
(
PasswordRequest
request
)
throws
Exception
{
String
password
=
decryptParam
(
request
.
getPassword
());
String
password
=
request
.
getPassword
();
/* String password = decryptParam(request.getPassword()); */
String
resourceId
=
request
.
getResourceId
();
PanelLink
one
=
findOne
(
resourceId
);
String
pwd
=
decryptParam
(
one
.
getPwd
());
String
pwd
=
one
.
getPwd
();
/* String pwd = decryptParam(one.getPwd()); */
boolean
pass
=
StringUtils
.
equals
(
pwd
,
password
);
if
(
pass
){
String
token
=
JWTUtils
.
signLink
(
resourceId
,
password
);
...
...
frontend/src/utils/rsaEncrypt.js
浏览文件 @
c4204e28
...
...
@@ -2,31 +2,22 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt'
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const
publicKey
=
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD
\
n'
+
/*
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
const
privateKey
=
'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8
\
n'
+
'mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p
\
n'
+
'B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue
\
n'
+
'/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ
\
n'
+
'UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6
\
n'
+
'vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha
\
n'
+
'4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3
\
n'
+
'tTbklZkD2A=='
*/
// 加密
export
function
encrypt
(
txt
)
{
let
publicKey
=
localStorage
.
getItem
(
"publicKey"
);
const
publicKey
=
localStorage
.
getItem
(
'publicKey'
)
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
// 设置公钥
return
encryptor
.
encrypt
(
txt
)
// 对需要加密的数据进行加密
}
// 解密
export
function
decrypt
(
txt
)
{
/*
export function decrypt(txt) {
const encryptor = new JSEncrypt()
encryptor.setPrivateKey(privateKey)
return encryptor.decrypt(txt)
}
} */
frontend/src/views/link/generate/index.vue
浏览文件 @
c4204e28
...
...
@@ -60,7 +60,6 @@
<
script
>
import
{
loadGenerate
,
setPwd
,
switchValid
,
switchEnablePwd
,
shortUrl
,
setOverTime
}
from
'@/api/link'
import
{
encrypt
,
decrypt
}
from
'@/utils/rsaEncrypt'
export
default
{
name
:
'LinkGenerate'
,
...
...
@@ -120,7 +119,8 @@ export default {
this
.
form
.
enablePwd
=
enablePwd
this
.
form
.
uri
=
uri
?
(
this
.
origin
+
uri
)
:
uri
// 返回的密码是共钥加密后的 所以展示需要私钥解密一波
pwd
&&
(
this
.
form
.
pwd
=
decrypt
(
pwd
))
pwd
&&
(
this
.
form
.
pwd
=
pwd
)
/* pwd && (this.form.pwd = decrypt(pwd)) */
/* overTime && (this.form.overTime = overTime) */
overTime
&&
(
this
.
$set
(
this
.
form
,
'overTime'
,
overTime
))
this
.
requestShort
()
...
...
@@ -143,7 +143,8 @@ export default {
const
newPwd
=
this
.
createPwd
()
const
param
=
{
resourceId
:
this
.
resourceId
,
password
:
encrypt
(
newPwd
)
password
:
newPwd
/* password: encrypt(newPwd) */
}
setPwd
(
param
).
then
(
res
=>
{
this
.
form
.
pwd
=
newPwd
...
...
frontend/src/views/link/pwd/index.vue
浏览文件 @
c4204e28
...
...
@@ -38,7 +38,6 @@
<
script
>
import
{
validatePwd
}
from
'@/api/link'
import
{
encrypt
}
from
'@/utils/rsaEncrypt'
export
default
{
name
:
'LinkPwd'
,
...
...
@@ -89,7 +88,8 @@ export default {
this
.
$refs
.
pwdForm
.
validate
(
valid
=>
{
if
(
!
valid
)
return
false
const
param
=
{
password
:
encrypt
(
this
.
form
.
password
),
/* password: encrypt(this.form.password), */
password
:
this
.
form
.
password
,
resourceId
:
this
.
resourceId
}
validatePwd
(
param
).
then
(
res
=>
{
...
...
frontend/src/views/link/view/index.vue
浏览文件 @
c4204e28
...
...
@@ -9,7 +9,7 @@ import { loadResource } from '@/api/link'
import
{
uuid
}
from
'vue-uuid'
import
Preview
from
'@/components/canvas/components/Editor/Preview'
import
{
getPanelAllLinkageInfo
}
from
'@/api/panel/linkage'
import
{
queryPanelJumpInfo
}
from
"@/api/panel/linkJump"
;
import
{
queryPanelJumpInfo
}
from
'@/api/panel/linkJump'
export
default
{
name
:
'LinkView'
,
...
...
frontend/src/views/login/index.vue
浏览文件 @
c4204e28
<
template
>
<div
class=
"login-background"
:v-show=
"themeLoade
d"
>
<div
v-show=
"contentShow"
class=
"login-backgroun
d"
>
<div
class=
"login-container"
>
<el-row
v-loading=
"loading"
type=
"flex"
>
<el-col
:span=
"12"
>
...
...
@@ -64,12 +64,11 @@
<
script
>
import
{
encrypt
}
from
'@/utils/rsaEncrypt'
import
{
ldapStatus
,
oidcStatus
,
getPublicKey
}
from
'@/api/user'
import
{
ldapStatus
,
oidcStatus
,
getPublicKey
,
pluginLoaded
}
from
'@/api/user'
import
{
getSysUI
}
from
'@/utils/auth'
import
{
initTheme
}
from
'@/utils/ThemeUtil'
import
PluginCom
from
'@/views/system/plugin/PluginCom'
import
Cookies
from
'js-cookie'
import
store
from
"@/store"
;
export
default
{
name
:
'Login'
,
components
:
{
PluginCom
},
...
...
@@ -92,7 +91,8 @@ export default {
loginLogoUrl
:
null
,
axiosFinished
:
false
,
loginTypes
:
[
0
],
themeLoaded
:
false
isPluginLoaded
:
false
,
contentShow
:
false
}
},
computed
:
{
...
...
@@ -109,8 +109,14 @@ export default {
}
},
beforeCreate
()
{
initTheme
()
this
.
themeLoaded
=
true
pluginLoaded
().
then
(
res
=>
{
this
.
isPluginLoaded
=
res
.
success
&&
res
.
data
this
.
isPluginLoaded
&&
initTheme
()
this
.
contentShow
=
true
}).
catch
(()
=>
{
this
.
contentShow
=
true
})
ldapStatus
().
then
(
res
=>
{
if
(
res
.
success
&&
res
.
data
)
{
this
.
loginTypes
.
push
(
1
)
...
...
@@ -183,7 +189,7 @@ export default {
password
:
encrypt
(
this
.
loginForm
.
password
),
loginType
:
this
.
loginForm
.
loginType
}
let
publicKey
=
localStorage
.
getItem
(
"publicKey"
);
const
publicKey
=
localStorage
.
getItem
(
'publicKey'
)
console
.
log
(
publicKey
)
this
.
$store
.
dispatch
(
'user/login'
,
user
).
then
(()
=>
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论