chore: 修改 pointcut 通过 securitycontextholder 取出用户
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt b/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
index 0f9f314..092fde8 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/advices.kt
@@ -16,6 +16,7 @@
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.ResponseEntity
import org.springframework.security.core.Authentication
+import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Component
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RestControllerAdvice
@@ -63,13 +64,16 @@
fun postmapping() {
}
- @Around("restcontroller() && postmapping() && args(@RequestBody body, auth, ..)")
+ @Around("restcontroller() && postmapping() && args(@RequestBody body, ..)")
@Throws(Throwable::class)
- fun logPostMethods(joinPoint: ProceedingJoinPoint, body: Any, auth: Authentication): Any {
+ fun logPostMethods(joinPoint: ProceedingJoinPoint, body: Any): Any {
return try {
if (body is APIRequestParam) {
body.checkParam()
- if (requestSignCheck && !body.checkSign(commonService.getSecretByAppid(auth.name))) {
+
+ if (requestSignCheck &&
+ !body.checkSign(commonService.getSecretByAppid(
+ SecurityContextHolder.getContext().authentication.name))) {
throw RequestParamCheckException(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误")
}
} else {