From b5ab4117e0bed0477127adc8587560db9ae7518c Mon Sep 17 00:00:00 2001
From: haozq <1611483981@qq.com>
Date: Thu, 4 Dec 2025 10:01:26 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 170 +++++++-------
.../login/controller/AllUserController.java | 24 ++
.../login/controller/LoginController.java | 33 +++
.../hnrn/rnbmw/login/dao/AllUserDao.java | 7 +
.../bonus/hnrn/rnbmw/login/dao/LoginDao.java | 15 ++
.../rnbmw/login/service/AllUserService.java | 7 +
.../rnbmw/login/service/LoginService.java | 51 +++++
.../bonus/hnrn/rnbmw/login/vo/AjaxResult.java | 207 ++++++++++++++++++
.../hnrn/rnbmw/login/vo/LoginFormVo.java | 29 +++
.../manager/config/BnsSecurityConfig.java | 49 +----
.../rnbmw/manager/filter/TokenFilter.java | 8 +-
.../src/main/resources/bootstrap.yml | 7 +-
.../resources/mappers/login/AllUserMapper.xml | 9 +
.../resources/mappers/login/LoginMapper.xml | 19 ++
.../com/bonus/gateway/filter/AuthFilter.java | 16 --
.../gateway/filter/ValidateCodeFilter.java | 5 +-
.../gateway/handler/ValidateCodeHandler.java | 4 +-
17 files changed, 507 insertions(+), 153 deletions(-)
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/LoginDao.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/AjaxResult.java
create mode 100644 HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/LoginFormVo.java
create mode 100644 HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml
create mode 100644 HnRealNameBmw/src/main/resources/mappers/login/LoginMapper.xml
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 5baa445..61609f4 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,40 +4,24 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -47,6 +31,7 @@
@@ -54,67 +39,71 @@
-
+ {
+ "associatedIndex": 4
+}
- {
+ "keyToString": {
+ "Maven.HnRealNameBmw [clean].executor": "Run",
+ "Maven.HnRealNameBmw [install].executor": "Run",
+ "Maven.HnRealNameMmw [clean].executor": "Run",
+ "Maven.HnRealNameMmw [install].executor": "Run",
+ "Maven.bonus-common [clean].executor": "Run",
+ "Maven.hn-czl-service [clean].executor": "Run",
+ "Maven.hn-czl-service [install].executor": "Run",
+ "Maven.hn-gateway [clean].executor": "Run",
+ "Maven.hn-gateway [install].executor": "Run",
+ "Maven.hn-gateway [verify].executor": "Run",
+ "Maven.hn_czl_screen [clean].executor": "Run",
+ "Maven.hn_czl_screen [install].executor": "Run",
+ "Maven.ldlz [clean].executor": "Run",
+ "Maven.ldlz [install].executor": "Run",
+ "RequestMappingsPanelOrder0": "0",
+ "RequestMappingsPanelOrder1": "1",
+ "RequestMappingsPanelWidth0": "75",
+ "RequestMappingsPanelWidth1": "75",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.git.unshallow": "true",
+ "SONARLINT_PRECOMMIT_ANALYSIS": "true",
+ "Spring Boot.BonusGatewayApplication.executor": "Debug",
+ "Spring Boot.CzlScreenApplication.executor": "Run",
+ "Spring Boot.CzlServiceApplication.executor": "Run",
+ "Spring Boot.HnRealNameBmwApplication.executor": "Debug",
+ "Spring Boot.LdlzApplication.executor": "Run",
+ "Spring Boot.RnmwApplication.executor": "Debug",
+ "git-widget-placeholder": "main",
+ "kotlin-language-version-configured": "true",
+ "last_opened_file_path": "F:/workspace/idea/hn_cloud_service/HnRealNameBmw/src/main/resources/mappers/login",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.0",
+ "project.structure.side.proportion": "0.0",
+ "run.configurations.included.in.services": "true",
+ "settings.editor.selected.configurable": "preferences.lookFeel",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
+
+
+
+
@@ -132,7 +121,7 @@
-
+
@@ -207,7 +196,8 @@
1764725740407
-
+
+
@@ -233,7 +223,15 @@
1764742057175
-
+
+
+ 1764744907817
+
+
+
+ 1764744907817
+
+
@@ -304,7 +302,8 @@
-
+
+
@@ -314,6 +313,11 @@
35
+
+ file://$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/SecurityHandlerConfig.java
+ 96
+
+
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java
new file mode 100644
index 0000000..baa3263
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java
@@ -0,0 +1,24 @@
+package com.bonus.hnrn.rnbmw.login.controller;
+
+import com.bonus.hnrn.rnbmw.login.service.AllUserService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "系统用户管理")
+@RestController
+@RequestMapping("allUser")
+public class AllUserController {
+
+
+ @Autowired
+ private AllUserService allUserService;
+
+
+
+
+
+
+
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java
new file mode 100644
index 0000000..2446eaa
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java
@@ -0,0 +1,33 @@
+package com.bonus.hnrn.rnbmw.login.controller;
+
+import com.bonus.hnrn.rnbmw.login.service.LoginService;
+import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
+import com.bonus.hnrn.rnbmw.login.vo.LoginFormVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "用户登录")
+@RestController
+@RequestMapping("/allSystem/")
+public class LoginController {
+
+ @Autowired
+ private LoginService loginService;
+
+
+
+ @PostMapping("login")
+ @ApiOperation(value = "系统登录")
+ public AjaxResult login(@RequestBody LoginFormVo bean) {
+ return loginService.login(bean);
+ }
+
+
+
+
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java
new file mode 100644
index 0000000..171b736
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java
@@ -0,0 +1,7 @@
+package com.bonus.hnrn.rnbmw.login.dao;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface AllUserDao {
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/LoginDao.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/LoginDao.java
new file mode 100644
index 0000000..191f4b0
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/LoginDao.java
@@ -0,0 +1,15 @@
+package com.bonus.hnrn.rnbmw.login.dao;
+
+import com.bonus.hnrn.rnbmw.login.vo.LoginFormVo;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface LoginDao {
+
+ /**
+ * 查询用户账户号信息
+ * @param bean
+ * @return
+ */
+ LoginFormVo getUserLogin(LoginFormVo bean);
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java
new file mode 100644
index 0000000..6d51009
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java
@@ -0,0 +1,7 @@
+package com.bonus.hnrn.rnbmw.login.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class AllUserService {
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java
new file mode 100644
index 0000000..d7787a5
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java
@@ -0,0 +1,51 @@
+package com.bonus.hnrn.rnbmw.login.service;
+
+import com.bonus.hnrn.rnbmw.login.dao.LoginDao;
+import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
+import com.bonus.hnrn.rnbmw.login.vo.LoginFormVo;
+import com.bonus.hnrn.rnbmw.manager.utils.AESCBCUtils;
+import com.github.pagehelper.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+@Slf4j
+public class LoginService {
+
+ @Autowired
+ private LoginDao mapper;
+
+ /**
+ * 系统登录
+ * @param bean
+ * @return
+ */
+ public AjaxResult login(LoginFormVo bean) {
+ try{
+ String username = AESCBCUtils.decrypt(bean.getUsername());
+ String password = AESCBCUtils.decrypt(bean.getPassword());
+ bean.setUsername(username);
+ bean.setPassword(password);
+ if(StringUtil.isEmpty(bean.getUsername() ) || StringUtil.isEmpty(bean.getPassword())) {
+ return AjaxResult.error("请输入账号及密码");
+ }
+ LoginFormVo loginFormVo = mapper.getUserLogin(bean);
+ if(loginFormVo == null) {
+ return AjaxResult.error("用户不存在");
+ }
+ return AjaxResult.success(loginFormVo);
+ }catch (Exception e){
+ log.error(e.toString(),e);
+ }
+ return AjaxResult.error("请输入正确的参数");
+
+
+ }
+
+
+
+
+
+
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/AjaxResult.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/AjaxResult.java
new file mode 100644
index 0000000..5713a69
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/AjaxResult.java
@@ -0,0 +1,207 @@
+package com.bonus.hnrn.rnbmw.login.vo;
+
+
+import com.bonus.hnrn.rnbmw.util.excel.StringUtils;
+
+import java.util.HashMap;
+import java.util.Objects;
+
+/**
+ * 操作消息提醒
+ *
+ * @author czc
+ */
+public class AjaxResult extends HashMap
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 状态码 */
+ public static final String CODE_TAG = "code";
+
+ /** 返回内容 */
+ public static final String MSG_TAG = "msg";
+
+ /** 数据对象 */
+ public static final String DATA_TAG = "data";
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
+ */
+ public AjaxResult()
+ {
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ */
+ public AjaxResult(int code, String msg)
+ {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @param data 数据对象
+ */
+ public AjaxResult(int code, String msg, Object data)
+ {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ if (StringUtils.isNotNull(data))
+ {
+ super.put(DATA_TAG, data);
+ }
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success()
+ {
+ return AjaxResult.success("操作成功");
+ }
+
+ /**
+ * 返回成功数据
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success(Object data)
+ {
+ return AjaxResult.success("操作成功", data);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg)
+ {
+ return AjaxResult.success(msg, null);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg, Object data)
+ {
+ return new AjaxResult(200, msg, data);
+ }
+
+ /**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg)
+ {
+ return AjaxResult.warn(msg, null);
+ }
+
+ /**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg, Object data)
+ {
+ return new AjaxResult(601, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @return
+ */
+ public static AjaxResult error()
+ {
+ return AjaxResult.error("操作失败");
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg)
+ {
+ return AjaxResult.error(msg, null);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg, Object data)
+ {
+ return new AjaxResult(500, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(int code, String msg)
+ {
+ return new AjaxResult(code, msg, null);
+ }
+
+ /**
+ * 是否为成功消息
+ *
+ * @return 结果
+ */
+ public boolean isSuccess()
+ {
+ return Objects.equals(200, this.get(CODE_TAG));
+ }
+
+ /**
+ * 是否为错误消息
+ *
+ * @return 结果
+ */
+ public boolean isError()
+ {
+ return !isSuccess();
+ }
+
+ /**
+ * 方便链式调用
+ *
+ * @param key
+ * @param value
+ * @return
+ */
+ @Override
+ public AjaxResult put(String key, Object value)
+ {
+ super.put(key, value);
+ return this;
+ }
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/LoginFormVo.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/LoginFormVo.java
new file mode 100644
index 0000000..c542670
--- /dev/null
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/LoginFormVo.java
@@ -0,0 +1,29 @@
+package com.bonus.hnrn.rnbmw.login.vo;
+
+import lombok.Data;
+
+@Data
+public class LoginFormVo {
+ /**
+ * 主键
+ */
+ private String id;
+ /**
+ * 用户名
+ */
+ private String username;
+ /**
+ * 密码
+ */
+ private String password;
+ /**
+ * 数据权限
+ */
+ private String dataType;
+ /**
+ * 是否管理员
+ */
+ private String isAdmin;
+
+
+}
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java
index 4aed13b..5d00fad 100644
--- a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java
@@ -69,9 +69,10 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
http.authorizeRequests()
.antMatchers("/", "/gzRealName/**","/attendance/**","/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/layui-v2.9.2/**","/layui2.3.6/**", "/layer-v3.1.0/**","/img/**",
"/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**","/interface/**",
- "/statics/**","/download/**","/register/**","/companyManager/resetUserPwd","/getCode/**","/OwnContract/updateDownloadState")
- .permitAll().anyRequest().authenticated();
- http.formLogin().loginProcessingUrl("/login")
+ "/statics/**","/download/**","/allSystem/login","/realname/allSystem/login","/register/**","/companyManager/resetUserPwd","/getCode/**","/OwnContract/updateDownloadState")
+ .permitAll().
+ anyRequest().authenticated();
+ http.formLogin().loginProcessingUrl("/login")
.successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and()
.addFilterBefore(new VerifyFilter(redisTemplate,prefix,authenticationFailureHandler), UsernamePasswordAuthenticationFilter.class)
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
@@ -84,47 +85,7 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
}
-// @Override
-// protected void configure(HttpSecurity http) throws Exception {
-// // 添加安全过滤器,在认证前执行 -- 防御 sql 注入攻击 和 xss 攻击
-// http.addFilterBefore(new SecurityFilter(), BasicAuthenticationFilter.class);
-// http.csrf().disable();
-//
-// // 使用新的跨域配置
-// //http.cors(cors -> cors.configurationSource(corsConfigurationSource));
-//
-// // 基于token,所以不需要session
-// http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
-//
-// http.authorizeRequests()
-// .antMatchers("/", "/gzRealName/**","/attendance/**","/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/layui-v2.9.2/**","/layui2.3.6/**", "/layer-v3.1.0/**","/img/**",
-// "/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**","/interface/**",
-// "/statics/**","/download/**","/register/**","/companyManager/resetUserPwd","/getCode/**","/OwnContract/updateDownloadState")
-// .permitAll().anyRequest().authenticated();
-// http.formLogin().loginProcessingUrl("/login")
-// .successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and()
-// .addFilterBefore(new VerifyFilter(redisTemplate,prefix,authenticationFailureHandler), UsernamePasswordAuthenticationFilter.class)
-// .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
-// http.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
-//
-// // 添加CSP配置 - 在这里添加
-// http.headers()
-// .contentSecurityPolicy("default-src 'self'; " +
-// "script-src 'self' https://trusted.cdn.com 'unsafe-inline' 'unsafe-eval'; " +
-// "style-src 'self' 'unsafe-inline'; " +
-// "img-src 'self' data: https://trusted.image.com; " +
-// "font-src 'self'; " +
-// "object-src 'none'; " +
-// "base-uri 'self'; " +
-// "form-action 'self';") // 添加form-action限制
-// .and()
-// .frameOptions().sameOrigin() // 改用sameOrigin提高安全性
-// .cacheControl();
-//
-// // 注意:上面的 .frameOptions().disable() 可能会降低安全性,考虑使用 .sameOrigin() 替代
-//
-// http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
-// }
+
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
diff --git a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/filter/TokenFilter.java b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/filter/TokenFilter.java
index 9e036df..5036d7d 100644
--- a/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/filter/TokenFilter.java
+++ b/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/filter/TokenFilter.java
@@ -35,7 +35,13 @@ public class TokenFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String URL=request.getRequestURI();
- System.err.println(URL);
+
+ // 排除无需Token的接口
+ if (URL.contains("/allSystem/login")) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
String token = getToken(request);
if (StringUtils.isNotBlank(token)) {
LoginUser loginUser = tokenService.getLoginUser(token);
diff --git a/HnRealNameBmw/src/main/resources/bootstrap.yml b/HnRealNameBmw/src/main/resources/bootstrap.yml
index 1662f2c..82a8654 100644
--- a/HnRealNameBmw/src/main/resources/bootstrap.yml
+++ b/HnRealNameBmw/src/main/resources/bootstrap.yml
@@ -63,10 +63,5 @@ oss:
accessKeySecret: jXewIIKO0ZmuuQedpN728M7bMFTNBO
bucketName: lsun
-cors:
- allowed-origins: http://localhost:19118,http://127.0.0.1:19118,http://192.168.0.14:19118,http://116.63.172.211:1918
- allowed-methods: GET,POST,PUT,DELETE,OPTIONS
- allowed-headers: Content-Type,X-Requested-With,Token,Authorization,X-Custom-Header
- allow-credentials: true
- max-age: 3600
+
diff --git a/HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml b/HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml
new file mode 100644
index 0000000..9b75f5c
--- /dev/null
+++ b/HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HnRealNameBmw/src/main/resources/mappers/login/LoginMapper.xml b/HnRealNameBmw/src/main/resources/mappers/login/LoginMapper.xml
new file mode 100644
index 0000000..231fa3e
--- /dev/null
+++ b/HnRealNameBmw/src/main/resources/mappers/login/LoginMapper.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java b/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java
index fc6e9f3..ab8220c 100644
--- a/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java
+++ b/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java
@@ -73,23 +73,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
return unauthorizedResponse(exchange, "令牌验证失败");
}
- /* try {
- String userName = JwtUtils.getUserName(claims);
- String userId = JwtUtils.getUserId(claims);
- String name = redisService.getCacheObject(userName + ":" + token);
- String id = redisService.getCacheObject(userId + ":" + token);
- *//* if (StringUtils.isEmpty(name) || !name.equals(userName)) {
- return unauthorizedResponse(exchange, "令牌已过期或验证不正确!");
- }
- if (StringUtils.isEmpty(id) || !id.equals(userId)) {
- return unauthorizedResponse(exchange, "令牌已过期或验证不正确!");
- }*//*
- *//* redisService.setCacheObject(userName + ":" + token, userName, 120L, TimeUnit.MINUTES);
- redisService.setCacheObject(userId + ":" + token, userId + "", 120L, TimeUnit.MINUTES);*//*
- } catch (Exception e) {
- return unauthorizedResponse(exchange, "令牌已过期或验证不正确!");
- }*/
// 设置用户信息到请求
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
diff --git a/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java b/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java
index a572e0f..a982a90 100644
--- a/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java
+++ b/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/ValidateCodeFilter.java
@@ -7,6 +7,7 @@ import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.gateway.config.properties.CaptchaProperties;
import com.bonus.gateway.service.ValidateCodeService;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
@@ -26,8 +27,9 @@ import java.util.concurrent.atomic.AtomicReference;
* @author bonus
*/
@Component
+@Slf4j
public class ValidateCodeFilter extends AbstractGatewayFilterFactory