增加检查 sign 开关
authorTang Cheng <cheng.tang@supwisdom.com>
Wed, 19 Jun 2019 07:00:42 +0000 (15:00 +0800)
committerTang Cheng <cheng.tang@supwisdom.com>
Wed, 19 Jun 2019 07:00:42 +0000 (15:00 +0800)
config/application-devel-pg-local.properties
config/application-devel-pg.properties
src/main/kotlin/com/supwisdom/dlpay/api/advices.kt

index e976303..ef591a9 100644 (file)
@@ -21,6 +21,7 @@ jwt.expiration=3600
 # user password
 auth.password.bcrypt.seed=
 
+security.request.sign=false
 ##################################################
 ## quartz task scheduler
 shopbalance.updater.cron = -
\ No newline at end of file
index ada087d..5ea16f5 100644 (file)
@@ -21,8 +21,7 @@ jwt.expiration=3600
 auth.password.bcrypt.seed=
 spring.jackson.serialization.fail-on-empty-beans=false
 logging.level.org.springframework.web=DEBUG
-
-
+security.request.sign=false
 ##################################################
 ## quartz task scheduler
-shopbalance.updater.cron = -
\ No newline at end of file
+shopbalance.updater.cron=-
\ No newline at end of file
index d19f656..0f9f314 100644 (file)
@@ -13,6 +13,7 @@ import org.aspectj.lang.annotation.Around
 import org.aspectj.lang.annotation.Aspect
 import org.aspectj.lang.annotation.Pointcut
 import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
 import org.springframework.http.ResponseEntity
 import org.springframework.security.core.Authentication
 import org.springframework.stereotype.Component
@@ -49,6 +50,9 @@ class RestControllerAspect {
     @Autowired
     lateinit var commonService: CommonService
 
+    @Value("\${security.request.sign: true}")
+    private var requestSignCheck: Boolean = true
+
     private val logger = KotlinLogging.logger { }
 
     @Pointcut("@within(org.springframework.web.bind.annotation.RestController)")
@@ -65,7 +69,7 @@ class RestControllerAspect {
         return try {
             if (body is APIRequestParam) {
                 body.checkParam()
-                if (!body.checkSign(commonService.getSecretByAppid(auth.name))) {
+                if (requestSignCheck && !body.checkSign(commonService.getSecretByAppid(auth.name))) {
                     throw RequestParamCheckException(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误")
                 }
             } else {