mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
feat: 加密公共链接中的用户ID
This commit is contained in:
parent
2213a565f8
commit
879890fe54
@ -65,9 +65,14 @@ public class LinkServer implements LinkApi {
|
|||||||
link = URLDecoder.decode(link, "UTF-8");
|
link = URLDecoder.decode(link, "UTF-8");
|
||||||
String json = panelLinkService.decryptParam(link);
|
String json = panelLinkService.decryptParam(link);
|
||||||
|
|
||||||
|
String user = request.getUser();
|
||||||
|
user = URLDecoder.decode(user, "UTF-8");
|
||||||
|
user = panelLinkService.decryptParam(user);
|
||||||
|
|
||||||
ValidateDto dto = new ValidateDto();
|
ValidateDto dto = new ValidateDto();
|
||||||
|
dto.setUserId(user);
|
||||||
String resourceId = json;
|
String resourceId = json;
|
||||||
PanelLink one = panelLinkService.findOne(resourceId, request.getUser());
|
PanelLink one = panelLinkService.findOne(resourceId, Long.valueOf(user));
|
||||||
dto.setResourceId(resourceId);
|
dto.setResourceId(resourceId);
|
||||||
if (ObjectUtils.isEmpty(one)) {
|
if (ObjectUtils.isEmpty(one)) {
|
||||||
dto.setValid(false);
|
dto.setValid(false);
|
||||||
|
@ -8,5 +8,5 @@ import java.io.Serializable;
|
|||||||
public class LinkValidateRequest implements Serializable {
|
public class LinkValidateRequest implements Serializable {
|
||||||
|
|
||||||
private String link;
|
private String link;
|
||||||
private Long user;
|
private String user;
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,6 @@ public class ValidateDto {
|
|||||||
private boolean passPwd;
|
private boolean passPwd;
|
||||||
@ApiModelProperty("资源ID")
|
@ApiModelProperty("资源ID")
|
||||||
private String resourceId;
|
private String resourceId;
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private String userId;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class PanelLinkService {
|
|||||||
private String buildLinkParam(PanelLink link) {
|
private String buildLinkParam(PanelLink link) {
|
||||||
String linkParam = encrypt(link.getResourceId());
|
String linkParam = encrypt(link.getResourceId());
|
||||||
if (link.getUserId() != null) {
|
if (link.getUserId() != null) {
|
||||||
linkParam = linkParam + USERPARAM + link.getUserId().toString();
|
linkParam = linkParam + USERPARAM + encrypt(link.getUserId().toString());
|
||||||
}
|
}
|
||||||
return linkParam;
|
return linkParam;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
url += '&terminal=' + terminal
|
url += '&terminal=' + terminal
|
||||||
}
|
}
|
||||||
if (user) {
|
if (user) {
|
||||||
url += '&user=' + user
|
url += '&user=' + encodeURIComponent(user)
|
||||||
}
|
}
|
||||||
if (attachParams) {
|
if (attachParams) {
|
||||||
url += '&attachParams=' + attachParams
|
url += '&attachParams=' + attachParams
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="height: 100%;">
|
<div style="height: 100%;">
|
||||||
<link-error v-if="showIndex===0" :resource-id="resourceId" />
|
<link-error v-if="showIndex===0" :resource-id="resourceId" />
|
||||||
<link-pwd v-if="showIndex===1" :resource-id="resourceId" :user="user" @fresh-token="refreshToken" />
|
<link-pwd v-if="showIndex===1" :resource-id="resourceId" :user="userId" @fresh-token="refreshToken" />
|
||||||
<link-view v-if="showIndex===2" :resource-id="resourceId" :user="user"/>
|
<link-view v-if="showIndex===2" :resource-id="resourceId" :user="userId"/>
|
||||||
<link-expire v-if="showIndex===3" :resource-id="resourceId" :user="user"/>
|
<link-expire v-if="showIndex===3" :resource-id="resourceId" :user="userId"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -21,6 +21,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
resourceId: null,
|
resourceId: null,
|
||||||
|
userId: null,
|
||||||
PARAMKEY: 'link',
|
PARAMKEY: 'link',
|
||||||
link: null,
|
link: null,
|
||||||
user: null,
|
user: null,
|
||||||
@ -46,10 +47,11 @@ export default {
|
|||||||
this.showError()
|
this.showError()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let params = this.user ? { link: encodeURIComponent(this.link), user: this.user} : { link: encodeURIComponent(this.link)};
|
let params = this.user ? { link: encodeURIComponent(this.link), user: encodeURIComponent(this.user)} : { link: encodeURIComponent(this.link)};
|
||||||
validate(params).then(res => {
|
validate(params).then(res => {
|
||||||
const { resourceId, valid, enablePwd, passPwd, expire } = res.data
|
const { resourceId, valid, enablePwd, passPwd, expire, userId} = res.data
|
||||||
this.resourceId = resourceId
|
this.resourceId = resourceId
|
||||||
|
this.userId = userId
|
||||||
// 如果链接无效 直接显示无效页面
|
// 如果链接无效 直接显示无效页面
|
||||||
if (!valid || !resourceId) {
|
if (!valid || !resourceId) {
|
||||||
this.showError()
|
this.showError()
|
||||||
|
Loading…
Reference in New Issue
Block a user