From ee68a49577bef7309ae7812273b813fb44efcd89 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 14 Oct 2020 11:50:11 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java b/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
index e18d3e7..f033e03 100644
--- a/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
+++ b/src/main/java/com/xcong/excoin/common/aop/SubmitRepeatAspect.java
@@ -1,7 +1,12 @@
package com.xcong.excoin.common.aop;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.asymmetric.KeyType;
+import cn.hutool.crypto.asymmetric.RSA;
import com.xcong.excoin.common.annotations.SubmitRepeat;
+import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.configurations.properties.SecurityProperties;
import com.xcong.excoin.utils.MessageSourceUtils;
import com.xcong.excoin.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
@@ -27,6 +32,8 @@
@Resource
private RedisUtils redisUtil;
+ @Resource
+ private SecurityProperties securityProperties;
private String key;
@@ -44,7 +51,12 @@
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
- String token = request.getHeader("token");
+// String token = request.getHeader("token");
+ String bearerToken = request.getHeader(AppContants.TOKEN_HEADER);
+ String rsaToken = bearerToken.replace(AppContants.TOKEN_START_WITH, "");
+ RSA rsa = new RSA(securityProperties.getPrivateKey(), null);
+ String[] tokens = StrUtil.split(rsa.decryptStr(rsaToken, KeyType.PrivateKey), "_");
+ String token = tokens[0];
String uri = request.getRequestURI();
String mId = (String) redisUtil.get(token);
log.debug("#token : {}, uri : {}, mId : {}#", token, uri, mId);
--
Gitblit v1.9.1