当前位置:网站首页>Jeecg request URL signature
Jeecg request URL signature
2022-07-03 07:17:00 【tonysh_ zds】
1、 Turn on url Signature configuration
public class SignAuthConfiguration implements WebMvcConfigurer {
public static String[] urlList = new String[] {"/sys/dict/getDictItems/*", "/sys/dict/loadDict/*",
"/sys/dict/loadDictOrderByValue/*", "/sys/dict/loadDictItem/*", "/sys/dict/loadTreeData",
"/sys/api/queryTableDictItemsByCode", "/sys/api/queryFilterTableDictInfo", "/sys/api/queryTableDictByKeys",
"/sys/api/translateDictFromTable", "/sys/api/translateDictFromTableByKeys","/das.**"};/
2、 Signature interception
public class SignAuthInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("request URI = " + request.getRequestURI());
HttpServletRequest requestWrapper = new BodyReaderHttpServletRequestWrapper(request);
// Get all parameters ( Include URL and body Upper )
SortedMap<String, String> allParams = HttpUtils.getAllParams(requestWrapper);
// Verify the signature of the parameter
String headerSign = request.getHeader(CommonConstant.X_SIGN);
String timesTamp = request.getHeader(CommonConstant.X_TIMESTAMP);
if (oConvertUtils.isEmpty(headerSign)) {
headerSign = request.getParameter(CommonConstant.X_SIGN);
}
if (oConvertUtils.isEmpty(timesTamp)) {
timesTamp = request.getParameter(CommonConstant.X_TIMESTAMP);
}
```
3、 Add signature to the front end
getUrl(){
let timestamp = signMd5Utils.getDateTimeToString()
let url0 = ${this.url.downloadUrl}
let sign = signMd5Utils.getSign(url0, ‘’);
// Put the signature and timestamp , Add to the request interface URL
let _url = url0 +/${this.id}&token=
+Vue.ls.get(ACCESS_TOKEN)+&X-Sign=
+sign+&X-TIMESTAMP=
+timestamp
let picType =[".jpg",".tif",".png"]
const hasPic = picType.filter(item => item == "."+this.filetype)
if(hasPic != ""){
return `${window._CONFIG['domianURL']}`+_url
}
let url = `${window._CONFIG['domianURL']}/generic/web/viewer.html?file=${window._CONFIG['domianURL']}`+_url
return url
},
```
边栏推荐
猜你喜欢
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
dataworks自定義函數開發環境搭建
Inno Setup 制作安装包
Flask Foundation
4279. 笛卡尔树
Docker builds MySQL: the specified path of version 5.7 cannot be mounted.
Basic components and intermediate components
Wireshark software usage
随机推荐
Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
带你全流程,全方位的了解属于测试的软件事故
My 2020 summary "don't love the past, indulge in moving forward"
High concurrency memory pool
Advanced API (multithreading 02)
II. D3.js draw a simple figure -- circle
【无标题】
Resttemplate configuration use
php安装composer
php artisan
La différence entre le let Typescript et le Var
Pits encountered in the use of El checkbox group
Dora (discover offer request recognition) process of obtaining IP address
4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
"Baidu Cup" CTF game 2017 February, Web: blast-1
When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
Strategy mode
Hash table, generic
gstreamer ffmpeg avdec解码数据流向分析
Pat grade a real problem 1166