Commit c1c647ca by xiaoer.li@freemud.com

change:订单和购物车channel=3 跳过鉴权

parent 98a38a33
...@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor; ...@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
...@@ -70,6 +71,8 @@ public class WebAspect { ...@@ -70,6 +71,8 @@ public class WebAspect {
private static final String SESSION_ID_STR = "sessionId"; private static final String SESSION_ID_STR = "sessionId";
private static final String APP_CHANNEL = "3";
@Pointcut("execution(* cn.freemud.controller..*.*(..))") @Pointcut("execution(* cn.freemud.controller..*.*(..))")
public void webAspect() { public void webAspect() {
} }
...@@ -86,12 +89,20 @@ public class WebAspect { ...@@ -86,12 +89,20 @@ public class WebAspect {
// 是否授权验证 // 是否授权验证
AssortmentCustomerInfoVo userInfo = assortmentCustomerInfoManager.getCustomerInfoByObject(sessionId); AssortmentCustomerInfoVo userInfo = assortmentCustomerInfoManager.getCustomerInfoByObject(sessionId);
if (!notFilterUrls.contains(requestUrl)) { if (!notFilterUrls.contains(requestUrl)) {
if(userInfo == null || StringUtils.isEmpty(userInfo.getMemberId())) { if(userInfo == null) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED); throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
} }
List<String> unauthorizedUrls = Arrays.asList(getNotFilterUrl(CommonRedisKeyConstant.SAAS_NOT_AUTHORIZED_URL, NOT_AUTHORIZED_KEY).split(",")); // app 没有unionId得概念, 并且app上是thirdMemberId概念。 不需要做校验
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId())) { if(!Objects.equals(userInfo.getChannel(), APP_CHANNEL)) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED); if(StringUtils.isEmpty(userInfo.getMemberId())) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
List<String> unauthorizedUrls = Arrays.asList(getNotFilterUrl(CommonRedisKeyConstant.SAAS_NOT_AUTHORIZED_URL, NOT_AUTHORIZED_KEY).split(","));
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId())) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
} else {
// app上是thirdMemberId概念
} }
} }
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
......
...@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor; ...@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
...@@ -70,6 +71,8 @@ public class WebAspect { ...@@ -70,6 +71,8 @@ public class WebAspect {
private static final String SESSION_ID_STR = "sessionId"; private static final String SESSION_ID_STR = "sessionId";
private static final String APP_CHANNEL = "3";
@Pointcut("execution(* cn.freemud.controller..*.*(..))") @Pointcut("execution(* cn.freemud.controller..*.*(..))")
public void webAspect() { public void webAspect() {
} }
...@@ -86,12 +89,20 @@ public class WebAspect { ...@@ -86,12 +89,20 @@ public class WebAspect {
// 是否授权验证 // 是否授权验证
AssortmentCustomerInfoVo userInfo = assortmentCustomerInfoManager.getCustomerInfoByObject(sessionId); AssortmentCustomerInfoVo userInfo = assortmentCustomerInfoManager.getCustomerInfoByObject(sessionId);
if (!notFilterUrls.contains(requestUrl)) { if (!notFilterUrls.contains(requestUrl)) {
if(userInfo == null || StringUtils.isEmpty(userInfo.getMemberId())) { if(userInfo == null) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED); throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
} }
List<String> unauthorizedUrls = Arrays.asList(getNotFilterUrl(CommonRedisKeyConstant.SAAS_NOT_AUTHORIZED_URL, NOT_AUTHORIZED_KEY).split(",")); // app 没有unionId得概念, 并且app上是thirdMemberId概念。 不需要做校验
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId())) { if(!Objects.equals(userInfo.getChannel(), APP_CHANNEL)) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED); if(StringUtils.isEmpty(userInfo.getMemberId())) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
List<String> unauthorizedUrls = Arrays.asList(getNotFilterUrl(CommonRedisKeyConstant.SAAS_NOT_AUTHORIZED_URL, NOT_AUTHORIZED_KEY).split(","));
if (!unauthorizedUrls.contains(requestUrl) && StringUtils.isEmpty(userInfo.getUnionId())) {
throw new CommonServiceException(CommonResponseResult.USER_UNAUTHORIZED);
}
} else {
// app上是thirdMemberId概念
} }
} }
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment