当前位置:网站首页>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
},
```
边栏推荐
- Split small interface
- Laravel Web框架
- [Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
- Pits encountered in the use of El checkbox group
- Advanced API (use of file class)
- 【最詳細】最新最全Redis面試大全(50道)
- JS date comparison
- Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
- 《指环王:力量之戒》新剧照 力量之戒铸造者亮相
- Unit test notes
猜你喜欢

Store WordPress media content on 4everland to complete decentralized storage
![[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)](/img/7f/3d6b6ea5319f7165e07baf0a78d318.jpg)
[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)

“百度杯”CTF比赛 2017 二月场,Web:爆破-1

How to specify the execution order for multiple global exception handling classes

Flask Foundation

Mise en place d'un environnement de développement de fonctions personnalisées

带你全流程,全方位的了解属于测试的软件事故
![[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet](/img/9d/42dfef67246740f0dba0c6d8f1b625.jpg)
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet

Basic components and intermediate components

Distributed transactions
随机推荐
3311. Longest arithmetic
File operation serialization recursive copy
POI excel percentage
Inno setup production and installation package
Strategy mode
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
Laravel frame step pit (I)
JUC forkjoinpool branch merge framework - work theft
1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
Architecture notes
Visit Google homepage to display this page, which cannot be displayed
C代码生产YUV420 planar格式文件
MySQL syntax (basic)
萬卷書 - 價值投資者指南 [The Education of a Value Investor]
High concurrency memory pool
SecureCRT取消Session记录的密码
Laravel框架 踩坑(一)
File links cannot be opened or downloaded in Google browser
Advanced API (multithreading)
691. Cube IV