This commit is contained in:
周源 2021-08-06 13:15:25 +08:00
parent 7a52d87558
commit 1ecfd00433
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,8 @@
package com.ydool.boot.api.filter;
import cn.hutool.core.util.StrUtil;
import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.exception.ResultException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
@ -32,9 +35,9 @@ public class ReferInterceptor implements HandlerInterceptor {
String requestRefer = request.getHeader("Referer");
System.out.println("------------------------------>refer" + requestRefer);
// if (requestRefer == null || (StrUtil.isNotBlank(refer) && !requestRefer.contains(refer))) {
// throw new ResultException(Ret.fail("非法访问!"));
// }
if (requestRefer == null || (StrUtil.isNotBlank(refer) && !requestRefer.contains(refer))) {
throw new ResultException(Ret.fail("非法访问!"));
}
return true;
}