forked from github/dataease
refactor: 优化公共链接参数长度
This commit is contained in:
parent
2395741707
commit
c4204e2866
@ -39,7 +39,8 @@ public class F2CLinkFilter extends AnonymousFilter {
|
|||||||
panelLink.setPwd("dataease");
|
panelLink.setPwd("dataease");
|
||||||
pwd = panelLink.getPwd();
|
pwd = panelLink.getPwd();
|
||||||
}else {
|
}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);
|
return JWTUtils.verifyLink(link_token, id, pwd);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -63,6 +63,7 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
// filterChainDefinitionMap.put("/axios.map", ANON);
|
// filterChainDefinitionMap.put("/axios.map", ANON);
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||||
|
filterChainDefinitionMap.put("/api/auth/isPluginLoaded", ANON);
|
||||||
filterChainDefinitionMap.put("/system/requestTimeOut", ANON);
|
filterChainDefinitionMap.put("/system/requestTimeOut", ANON);
|
||||||
filterChainDefinitionMap.put("/api/auth/validateName", ANON);
|
filterChainDefinitionMap.put("/api/auth/validateName", ANON);
|
||||||
filterChainDefinitionMap.put("/api/auth/isOpenLdap", ANON);
|
filterChainDefinitionMap.put("/api/auth/isOpenLdap", ANON);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.dataease.controller.panel.server;
|
package io.dataease.controller.panel.server;
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import io.dataease.base.domain.PanelLink;
|
import io.dataease.base.domain.PanelLink;
|
||||||
import io.dataease.controller.ResultHolder;
|
import io.dataease.controller.ResultHolder;
|
||||||
import io.dataease.controller.panel.api.LinkApi;
|
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.LinkRequest;
|
||||||
import io.dataease.controller.request.panel.link.OverTimeRequest;
|
import io.dataease.controller.request.panel.link.OverTimeRequest;
|
||||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
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.GenerateDto;
|
||||||
import io.dataease.dto.panel.link.ValidateDto;
|
import io.dataease.dto.panel.link.ValidateDto;
|
||||||
import io.dataease.service.chart.ChartViewService;
|
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{
|
public ValidateDto validate(@RequestBody Map<String, String> param) throws Exception{
|
||||||
String link = param.get("link");
|
String link = param.get("link");
|
||||||
String json = panelLinkService.decryptParam(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();
|
ValidateDto dto = new ValidateDto();
|
||||||
String resourceId = request.getResourceId();
|
String resourceId = json;
|
||||||
|
/* String resourceId = request.getResourceId(); */
|
||||||
PanelLink one = panelLinkService.findOne(resourceId);
|
PanelLink one = panelLinkService.findOne(resourceId);
|
||||||
dto.setResourceId(resourceId);
|
dto.setResourceId(resourceId);
|
||||||
if (ObjectUtils.isEmpty(one)){
|
if (ObjectUtils.isEmpty(one)){
|
||||||
|
@ -116,18 +116,19 @@ public class PanelLinkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String buildLinkParam(String resourceId){
|
private String buildLinkParam(String resourceId){
|
||||||
Map<String,Object> map = new HashMap<>();
|
/* Map<String,Object> map = new HashMap<>();
|
||||||
map.put("resourceId", resourceId);
|
map.put("resourceId", resourceId);
|
||||||
map.put("time", System.currentTimeMillis());
|
map.put("time", System.currentTimeMillis());
|
||||||
map.put("salt", salt);
|
map.put("salt", salt);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String encrypt = encrypt(gson.toJson(map));
|
String encrypt = encrypt(gson.toJson(map)); */
|
||||||
String s = null;
|
String encrypt = encrypt(resourceId);
|
||||||
|
/* String s = null;
|
||||||
try {
|
try {
|
||||||
s = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, encrypt);
|
s = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, encrypt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} */
|
||||||
return encrypt;
|
return encrypt;
|
||||||
}
|
}
|
||||||
private GenerateDto convertDto(PanelLink linl){
|
private GenerateDto convertDto(PanelLink linl){
|
||||||
@ -154,7 +155,8 @@ public class PanelLinkService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(panelLink.getPwd())) 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;
|
return verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,10 +169,12 @@ public class PanelLinkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean validatePwd(PasswordRequest request) throws Exception {
|
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();
|
String resourceId = request.getResourceId();
|
||||||
PanelLink one = findOne(resourceId);
|
PanelLink one = findOne(resourceId);
|
||||||
String pwd = decryptParam(one.getPwd());
|
String pwd = one.getPwd();
|
||||||
|
/* String pwd = decryptParam(one.getPwd()); */
|
||||||
boolean pass = StringUtils.equals(pwd, password);
|
boolean pass = StringUtils.equals(pwd, password);
|
||||||
if (pass){
|
if (pass){
|
||||||
String token = JWTUtils.signLink(resourceId, password);
|
String token = JWTUtils.signLink(resourceId, password);
|
||||||
|
@ -2,31 +2,22 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt'
|
|||||||
|
|
||||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||||
|
|
||||||
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
|
/* const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
|
||||||
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
|
'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) {
|
export function encrypt(txt) {
|
||||||
let publicKey = localStorage.getItem("publicKey");
|
const publicKey = localStorage.getItem('publicKey')
|
||||||
const encryptor = new JSEncrypt()
|
const encryptor = new JSEncrypt()
|
||||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||||
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
export function decrypt(txt) {
|
/* export function decrypt(txt) {
|
||||||
const encryptor = new JSEncrypt()
|
const encryptor = new JSEncrypt()
|
||||||
encryptor.setPrivateKey(privateKey)
|
encryptor.setPrivateKey(privateKey)
|
||||||
return encryptor.decrypt(txt)
|
return encryptor.decrypt(txt)
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { loadGenerate, setPwd, switchValid, switchEnablePwd, shortUrl, setOverTime } from '@/api/link'
|
import { loadGenerate, setPwd, switchValid, switchEnablePwd, shortUrl, setOverTime } from '@/api/link'
|
||||||
import { encrypt, decrypt } from '@/utils/rsaEncrypt'
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: 'LinkGenerate',
|
name: 'LinkGenerate',
|
||||||
@ -120,7 +119,8 @@ export default {
|
|||||||
this.form.enablePwd = enablePwd
|
this.form.enablePwd = enablePwd
|
||||||
this.form.uri = uri ? (this.origin + uri) : uri
|
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.form.overTime = overTime) */
|
||||||
overTime && (this.$set(this.form, 'overTime', overTime))
|
overTime && (this.$set(this.form, 'overTime', overTime))
|
||||||
this.requestShort()
|
this.requestShort()
|
||||||
@ -143,7 +143,8 @@ export default {
|
|||||||
const newPwd = this.createPwd()
|
const newPwd = this.createPwd()
|
||||||
const param = {
|
const param = {
|
||||||
resourceId: this.resourceId,
|
resourceId: this.resourceId,
|
||||||
password: encrypt(newPwd)
|
password: newPwd
|
||||||
|
/* password: encrypt(newPwd) */
|
||||||
}
|
}
|
||||||
setPwd(param).then(res => {
|
setPwd(param).then(res => {
|
||||||
this.form.pwd = newPwd
|
this.form.pwd = newPwd
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { validatePwd } from '@/api/link'
|
import { validatePwd } from '@/api/link'
|
||||||
import { encrypt } from '@/utils/rsaEncrypt'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LinkPwd',
|
name: 'LinkPwd',
|
||||||
@ -89,7 +88,8 @@ export default {
|
|||||||
this.$refs.pwdForm.validate(valid => {
|
this.$refs.pwdForm.validate(valid => {
|
||||||
if (!valid) return false
|
if (!valid) return false
|
||||||
const param = {
|
const param = {
|
||||||
password: encrypt(this.form.password),
|
/* password: encrypt(this.form.password), */
|
||||||
|
password: this.form.password,
|
||||||
resourceId: this.resourceId
|
resourceId: this.resourceId
|
||||||
}
|
}
|
||||||
validatePwd(param).then(res => {
|
validatePwd(param).then(res => {
|
||||||
|
@ -9,7 +9,7 @@ import { loadResource } from '@/api/link'
|
|||||||
import { uuid } from 'vue-uuid'
|
import { uuid } from 'vue-uuid'
|
||||||
import Preview from '@/components/canvas/components/Editor/Preview'
|
import Preview from '@/components/canvas/components/Editor/Preview'
|
||||||
import { getPanelAllLinkageInfo } from '@/api/panel/linkage'
|
import { getPanelAllLinkageInfo } from '@/api/panel/linkage'
|
||||||
import {queryPanelJumpInfo} from "@/api/panel/linkJump";
|
import { queryPanelJumpInfo } from '@/api/panel/linkJump'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LinkView',
|
name: 'LinkView',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-background" :v-show="themeLoaded">
|
<div v-show="contentShow" class="login-background">
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<el-row v-loading="loading" type="flex">
|
<el-row v-loading="loading" type="flex">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -64,12 +64,11 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { encrypt } from '@/utils/rsaEncrypt'
|
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 { getSysUI } from '@/utils/auth'
|
||||||
import { initTheme } from '@/utils/ThemeUtil'
|
import { initTheme } from '@/utils/ThemeUtil'
|
||||||
import PluginCom from '@/views/system/plugin/PluginCom'
|
import PluginCom from '@/views/system/plugin/PluginCom'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import store from "@/store";
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
components: { PluginCom },
|
components: { PluginCom },
|
||||||
@ -92,7 +91,8 @@ export default {
|
|||||||
loginLogoUrl: null,
|
loginLogoUrl: null,
|
||||||
axiosFinished: false,
|
axiosFinished: false,
|
||||||
loginTypes: [0],
|
loginTypes: [0],
|
||||||
themeLoaded: false
|
isPluginLoaded: false,
|
||||||
|
contentShow: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -109,8 +109,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
initTheme()
|
pluginLoaded().then(res => {
|
||||||
this.themeLoaded = true
|
this.isPluginLoaded = res.success && res.data
|
||||||
|
this.isPluginLoaded && initTheme()
|
||||||
|
this.contentShow = true
|
||||||
|
}).catch(() => {
|
||||||
|
this.contentShow = true
|
||||||
|
})
|
||||||
|
|
||||||
ldapStatus().then(res => {
|
ldapStatus().then(res => {
|
||||||
if (res.success && res.data) {
|
if (res.success && res.data) {
|
||||||
this.loginTypes.push(1)
|
this.loginTypes.push(1)
|
||||||
@ -183,7 +189,7 @@ export default {
|
|||||||
password: encrypt(this.loginForm.password),
|
password: encrypt(this.loginForm.password),
|
||||||
loginType: this.loginForm.loginType
|
loginType: this.loginForm.loginType
|
||||||
}
|
}
|
||||||
let publicKey = localStorage.getItem("publicKey");
|
const publicKey = localStorage.getItem('publicKey')
|
||||||
console.log(publicKey)
|
console.log(publicKey)
|
||||||
this.$store.dispatch('user/login', user).then(() => {
|
this.$store.dispatch('user/login', user).then(() => {
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
this.$router.push({ path: this.redirect || '/' })
|
||||||
|
Loading…
Reference in New Issue
Block a user