当前位置:网站首页>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
},
```
边栏推荐
猜你喜欢

Inno Setup 制作安装包

Selenium key knowledge explanation

Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record

In depth analysis of reentrantlock fair lock and unfair lock source code implementation

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

4279. Cartesian tree

7.2刷题两个

4279. 笛卡尔树
![[solved] sqlexception: invalid value for getint() - 'Tian Peng‘](/img/bf/f6310304d58d964b3d09a9d011ddb5.png)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
![Gridome + strapi + vercel + PM2 deployment case of [static site (3)]](/img/65/8d79998e96a2c74ba6e237bee652c6.jpg)
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
随机推荐
My 2020 summary "don't love the past, indulge in moving forward"
Split small interface
3311. 最长算术
Win 2008 R2 crashed at the final installation stage
【CMake】CMake链接SQLite库
SecureCRT password to cancel session recording
带你全流程,全方位的了解属于测试的软件事故
萬卷書 - 價值投資者指南 [The Education of a Value Investor]
SecureCRT取消Session记录的密码
高并发内存池
4279. Cartesian tree
Notes on the core knowledge of Domain Driven Design DDD
php安装composer
Recursion, Fibonacci sequence
PHP install the spool extension
Basic knowledge about SQL database
多个全局异常处理类,怎么规定执行顺序
Advanced API (serialization & deserialization)
Pat grade a real problem 1166
Flask Foundation