From a6d07feda6c9a53dac329a89bef77514247a0f0b Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sun, 10 Mar 2019 19:13:18 +0800 Subject: [PATCH] =?UTF-8?q?User=20=E6=A8=A1=E5=9D=97=EF=BC=8C=E5=BC=95?= =?UTF-8?q?=E5=85=A5=20Admin=20=E8=AE=A4=E8=AF=81=E6=8E=88=E6=9D=83~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +-- .../java/cn/iocoder/common/framework/vo/CommonResult.java | 4 +++- user/user-application/pom.xml | 6 ++++++ .../mall/user/application/config/MVCConfiguration.java | 8 ++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ed55f8b35..0b455d563 100644 --- a/.gitignore +++ b/.gitignore @@ -18,9 +18,8 @@ *.iws *.iml *.ipr -target/* -target/* *.class +target/* ### NetBeans ### /nbproject/private/ diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java index a71bf9cf4..71d082cf6 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/vo/CommonResult.java @@ -3,7 +3,9 @@ package cn.iocoder.common.framework.vo; import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.util.Assert; -public class CommonResult { +import java.io.Serializable; + +public class CommonResult implements Serializable { public static Integer CODE_SUCCESS = 0; diff --git a/user/user-application/pom.xml b/user/user-application/pom.xml index 4de3bd291..625d36667 100644 --- a/user/user-application/pom.xml +++ b/user/user-application/pom.xml @@ -92,6 +92,12 @@ compile + + cn.iocoder.mall + admin-sdk + 1.0-SNAPSHOT + + org.mapstruct mapstruct diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/application/config/MVCConfiguration.java b/user/user-application/src/main/java/cn/iocoder/mall/user/application/config/MVCConfiguration.java index aceada20e..3fd525fa5 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/application/config/MVCConfiguration.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/application/config/MVCConfiguration.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.user.application.config; import cn.iocoder.common.framework.config.GlobalExceptionHandler; +import cn.iocoder.mall.admin.sdk.interceptor.AdminSecurityInterceptor; import cn.iocoder.mall.user.sdk.interceptor.UserSecurityInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -13,15 +14,18 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableWebMvc @Configuration @Import(value = {GlobalExceptionHandler.class, // 统一全局返回 - UserSecurityInterceptor.class}) // 安全拦截器,实现认证和授权功能。 + UserSecurityInterceptor.class, AdminSecurityInterceptor.class}) // 安全拦截器,实现认证和授权功能。 public class MVCConfiguration implements WebMvcConfigurer { @Autowired private UserSecurityInterceptor securityInterceptor; + @Autowired + private AdminSecurityInterceptor adminSecurityInterceptor; @Override public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口 + registry.addInterceptor(securityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口 + registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**"); // 只拦截我们定义的接口 } @Override