lyhzzz 1 tháng trước cách đây
mục cha
commit
7bd70d0b12

+ 5 - 7
src/main/java/com/fdkankan/ucenter/httpClient/SignInterceptor.java

@@ -23,21 +23,19 @@ import java.time.Instant;
 @Slf4j
 public class SignInterceptor implements Interceptor<JSONObject> {
 
-    @Autowired
-    IAppSecretService appSecretService;
     @Value("${ucenter.sign.appid}")
     public String appId;
-
+    @Value("${ucenter.sign.publickey}")
+    public String publicKey;
     @Override
     public void onInvokeMethod(ForestRequest request, ForestMethod method, Object[] args) {
-        AppSecret byAppId = appSecretService.getByAppId(appId);
         JSONObject playload = new JSONObject();
         Instant now = Instant.now();
         long epochSecond = now.getEpochSecond();
-        playload.put("appId", byAppId.getAppId());
+        playload.put("appId", appId);
         playload.put("timestamp", epochSecond);
-        request.addHeader("appId", byAppId.getAppId());
-        request.addHeader("sign", RsaUtils.encipher(playload.toJSONString(), byAppId.getPublicKey()));
+        request.addHeader("appId",appId);
+        request.addHeader("sign", RsaUtils.encipher(playload.toJSONString(), publicKey));
 
     }
 }