Merge branch 'main' of D:\CF_work\ideaWorkSpace\business-card with conflicts.
This commit is contained in:
parent
d7e624fd95
commit
c7212662b1
@ -3,24 +3,18 @@ package cn.com.tenlion.config;
|
||||
|
||||
import cn.com.tenlion.accesstokenmanager.AccessTokenManager;
|
||||
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
|
||||
import cn.com.tenlion.pojo.vos.carduser.CardUserVO;
|
||||
import cn.com.tenlion.service.carduser.ICardUserService;
|
||||
import cn.com.tenlion.util.AesUtil;
|
||||
import cn.com.tenlion.util.annotation.AccessRightsCheck;
|
||||
import cn.com.tenlion.util.enumeration.Auth;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedType;
|
||||
import java.lang.reflect.Method;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
@ -44,33 +38,8 @@ public class CheckAuth implements HandlerInterceptor {
|
||||
if(path.contains("release")){
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 2021年1月28日10:28:38
|
||||
* CBC Start
|
||||
* 通过Controller中方法上的注解进行权限控制与放行
|
||||
*/
|
||||
// 获得类的请求
|
||||
HandlerMethod handlerMethod = null;
|
||||
if(handler instanceof HandlerMethod) {
|
||||
handlerMethod = (HandlerMethod) handler;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
// 权限校验的注解
|
||||
Method m = handlerMethod.getMethod();
|
||||
AccessRightsCheck accessRightsCheck = m.getAnnotation(AccessRightsCheck.class);
|
||||
if(accessRightsCheck != null) {
|
||||
if(accessRightsCheck != null) {
|
||||
// 不校验
|
||||
if(Auth.NOCHECK.equals(accessRightsCheck.auth())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 2021年1月28日10:34:47
|
||||
* CBC End
|
||||
*/
|
||||
|
||||
|
||||
String token = request.getHeader("token");
|
||||
if(token == null || StringUtil.isEmpty(token)){
|
||||
// response.setStatus(response.SC_METHOD_NOT_ALLOWED);
|
@ -1,6 +1,5 @@
|
||||
package cn.com.tenlion.config;
|
||||
|
||||
import org.apache.catalina.startup.UserConfig;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
@ -14,7 +13,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
* @date 2021/1/27 12:34
|
||||
*/
|
||||
@Configuration
|
||||
public class LoginConfig implements WebMvcConfigurer {
|
||||
public class LoginConfigInterceptors implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
@ -24,8 +23,8 @@ public class LoginConfig implements WebMvcConfigurer {
|
||||
}
|
||||
|
||||
@Bean
|
||||
private static CheckAuth checkAuth() {
|
||||
return new CheckAuth();
|
||||
private static CheckAuthInterceptor checkAuth() {
|
||||
return new CheckAuthInterceptor();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user