Commit c0be2026 authored by 董建华's avatar 董建华

拒绝策略调整

parent 54f1c197
...@@ -36,8 +36,9 @@ import java.util.Set; ...@@ -36,8 +36,9 @@ import java.util.Set;
@Aspect @Aspect
@Component @Component
@Slf4j @Slf4j
@Order(10)//比较靠后执行 @Order(10)//同心圆最外层
public class LoginInterceptorAspect { public class LoginInterceptorAspect {
@Resource @Resource
private LoginInfoRepository loginInfoRepository; private LoginInfoRepository loginInfoRepository;
...@@ -49,11 +50,16 @@ public class LoginInterceptorAspect { ...@@ -49,11 +50,16 @@ public class LoginInterceptorAspect {
* 设备拒绝阈值 * 设备拒绝阈值
*/ */
private static final Long DEVICE_REFUSE_COUNT = 3L; private static final Long DEVICE_REFUSE_COUNT = 3L;
/**
* 风控拒绝策略1设备维度 2 账号维度
*/
private static final int [] RISK_STRATEGY = {1,2};
/** /**
* 警示语 * 警示语
*/ */
private final String ALERT_WORDS = "检测到您的设备上账号登录异常,已被强制退出并暂时冻结您的账号。联系客服400-002-0061"; private final String ALERT_WORDS = "检测到您的设备上账号登录异常,已被强制退出并暂时冻结您的账号。联系客服400-002-0061";
/** /**
* 拒绝策略e * 拒绝策略e
*/ */
...@@ -61,7 +67,7 @@ public class LoginInterceptorAspect { ...@@ -61,7 +67,7 @@ public class LoginInterceptorAspect {
static { static {
DEVICE_REFUSE_STRATEGY.put(Device.ANDROID, 3L); DEVICE_REFUSE_STRATEGY.put(Device.ANDROID, 3L);
DEVICE_REFUSE_STRATEGY.put(Device.IOS, 7L); DEVICE_REFUSE_STRATEGY.put(Device.IOS, 3L);
} }
...@@ -151,7 +157,7 @@ public class LoginInterceptorAspect { ...@@ -151,7 +157,7 @@ public class LoginInterceptorAspect {
log.warn("此设备登录命中拒绝策略deviceId:{}超过{}个拒绝登录", deviceId, deviceNum); log.warn("此设备登录命中拒绝策略deviceId:{}超过{}个拒绝登录", deviceId, deviceNum);
return LoginRefuseResult.builder() return LoginRefuseResult.builder()
.isPass(Boolean.FALSE) .isPass(Boolean.FALSE)
.rule(1) .rule(RISK_STRATEGY[0])
.threshold(DEVICE_REFUSE_COUNT.intValue()) .threshold(DEVICE_REFUSE_COUNT.intValue())
.value(deviceNum.intValue()) .value(deviceNum.intValue())
.build(); .build();
...@@ -180,7 +186,7 @@ public class LoginInterceptorAspect { ...@@ -180,7 +186,7 @@ public class LoginInterceptorAspect {
log.warn("此账户登录命中拒绝策略并且没有白名单phone:{},device", phone); log.warn("此账户登录命中拒绝策略并且没有白名单phone:{},device", phone);
return LoginRefuseResult.builder() return LoginRefuseResult.builder()
.isPass(Boolean.FALSE) .isPass(Boolean.FALSE)
.rule(2) .rule(RISK_STRATEGY[1])
.threshold(threshold.intValue()) .threshold(threshold.intValue())
.value(Long.valueOf(sum).intValue()) .value(Long.valueOf(sum).intValue())
.build(); .build();
......
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