提交修改
This commit is contained in:
parent
b664c0c1a2
commit
92798b99a0
@ -75,7 +75,7 @@ public class LogAop {
|
||||
String uri = "";
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
String traceId = attributes.getRequest().getHeader("traceId");
|
||||
if(StringUtils.isBlank(traceId)){
|
||||
if (StringUtils.isBlank(traceId)) {
|
||||
traceId = OrderUtil.getUserPoolOrder("on");
|
||||
}
|
||||
LogAspect.threadLocalNo.set(traceId);
|
||||
@ -83,15 +83,11 @@ public class LogAop {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
uri = attributes.getRequest().getRequestURI();
|
||||
|
||||
if(uri.startsWith("/mm/") || uri.startsWith("/app/")){
|
||||
if (uri.startsWith("/mm/") || uri.startsWith("/app/")) {
|
||||
return point.proceed();
|
||||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
args = recordRequestLog(point.getArgs(), uri);
|
||||
Signature sig = point.getSignature();
|
||||
Method method = ((MethodSignature) sig).getMethod();
|
||||
@ -110,7 +106,6 @@ public class LogAop {
|
||||
.append("uri:").append(uri);
|
||||
|
||||
|
||||
|
||||
// 默认对有的接口进行拦截
|
||||
Boolean intercept = faceAuthMap.get(className);
|
||||
Boolean classMethodConfigNotIntercept = faceAuthMap.get(classNameAndMethodName);
|
||||
@ -125,12 +120,17 @@ public class LogAop {
|
||||
|
||||
faceAuthMap.put(className, intercept);
|
||||
faceAuthMap.put(classNameAndMethodName, classMethodConfigNotIntercept);
|
||||
faceAuthTentMap.put(classNameAndMethodNametencent , tencent);
|
||||
faceAuthTentMap.put(classNameAndMethodNametencent, tencent);
|
||||
log.info("LogAop one cache className:{},classNameAndMethodName:{},classNameAndMethodNametencent:{}", intercept, classMethodConfigNotIntercept, tencent);
|
||||
}
|
||||
if (classMethodConfigNotIntercept) {
|
||||
return point.proceed();
|
||||
}
|
||||
try {
|
||||
|
||||
|
||||
// 如果方法和类上都没有配置NotIntercept注解 ,则需要拦截 ,是linux才进行拦截
|
||||
if (intercept && classMethodConfigNotIntercept && OsUtil.isLinux()) {
|
||||
if (intercept && OsUtil.isLinux()) {
|
||||
String authConfig = request.getHeader("X-TCloudMarket-Custom-AuthConfig");
|
||||
if (StringUtils.isBlank(authConfig) || !authConfig.startsWith("{")) {
|
||||
log.info("LogAop authConfig value:{} auth error ", authConfig);
|
||||
@ -142,7 +142,7 @@ public class LogAop {
|
||||
String auth = faceAuthTentMap.get(classNameAndMethodNametencent);
|
||||
Object tAuth = authConfigMap.get(ApiConstants.t_auth);
|
||||
|
||||
if (StringUtils.isBlank(auth) || !auth.equals(tAuth+"")) {
|
||||
if (StringUtils.isBlank(auth) || !auth.equals(tAuth + "")) {
|
||||
log.info("LogAop authConfig:{},auth:{},tAuth:{} auth error ", authConfig, auth, tAuth);
|
||||
result = R.error("auth error");
|
||||
return result;
|
||||
@ -172,9 +172,6 @@ public class LogAop {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private String recordRequestLog(Object[] argArrs, String uri) {
|
||||
String mediaType = "";
|
||||
String args = null;
|
||||
@ -184,9 +181,9 @@ public class LogAop {
|
||||
for (Object arg1 : argArrs) {
|
||||
if (arg1 instanceof MultipartFile) {
|
||||
continue;
|
||||
}else if (arg1 instanceof HttpServletRequest) {
|
||||
} else if (arg1 instanceof HttpServletRequest) {
|
||||
continue;
|
||||
}else if (arg1 instanceof HttpServletResponse) {
|
||||
} else if (arg1 instanceof HttpServletResponse) {
|
||||
continue;
|
||||
} else if (arg1 instanceof MultipartFile[]) {
|
||||
continue;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -10,11 +11,13 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@NotIntercept
|
||||
public class AppOssAuthController {
|
||||
|
||||
|
||||
// http://localhost:8888/auth
|
||||
@RequestMapping("/auth")
|
||||
public HttpServletResponse auth(HttpServletRequest request, HttpServletResponse response) {
|
||||
public int auth(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
String uri = request.getRequestURI();
|
||||
|
||||
@ -22,7 +25,7 @@ public class AppOssAuthController {
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
||||
return response;
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user