| | |
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.util.SystemInfoUtil;
|
| | | import org.aspectj.lang.ProceedingJoinPoint;
|
| | | import org.aspectj.lang.Signature;
|
| | | import org.aspectj.lang.annotation.Around;
|
| | |
| | | import com.yeshi.fanli.util.annotation.RequestNoSignValidate;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.SystemUtil;
|
| | |
|
| | | //客户端接口签名验证
|
| | | @Component
|
| | |
| | |
|
| | | @Around(EDP)
|
| | | public Object appH5Around(ProceedingJoinPoint joinPoint) throws IOException {
|
| | |
|
| | | Object[] args = joinPoint.getArgs();
|
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
|
| | | .getRequestAttributes();
|
| | | HttpServletRequest request = servletContainer.getRequest();
|
| | |
|
| | | AcceptData acceptData = null;
|
| | | for (Object obj : args) {
|
| | | if (obj instanceof AcceptData) {
|
| | | acceptData = (AcceptData) obj;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | Signature signature = joinPoint.getSignature();
|
| | | MethodSignature methodSignature = (MethodSignature) signature;
|
| | |
| | | e2.printStackTrace();
|
| | | }
|
| | |
|
| | | Object[] args = joinPoint.getArgs();
|
| | | // 判断是否有忽略验证的注解
|
| | | if (realMethod != null && realMethod.isAnnotationPresent(RequestNoSignValidate.class)) {
|
| | | if(acceptData!=null){
|
| | | acceptData.setSystem(SystemInfoUtil.getSystem(acceptData));
|
| | | }
|
| | |
|
| | | try {
|
| | | return joinPoint.proceed(args);
|
| | | } catch (Throwable e) {
|
| | | e.printStackTrace();
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, getHttpServletParams(request), request.getRequestURI().toString());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | LogHelper.errorDetailInfo(e, getHttpServletParams(request), request.getRequestURI().toString());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | // 签名是否正确
|
| | | if (isRight) {
|
| | | if(acceptData!=null){
|
| | | acceptData.setSystem(SystemInfoUtil.getSystem(acceptData));
|
| | | }
|
| | | Object obj = null;
|
| | | try {
|
| | | obj = joinPoint.proceed(args);
|