提交代码

dev_xds
姜玉琦 2023-08-22 23:53:56 +08:00
parent 27db4819ba
commit 75223b9f64
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package com.ruoyi.framework.aspectj;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
@ -100,6 +101,13 @@ public class LogAspect
if (loginUser != null)
{
operLog.setOperName(loginUser.getUsername());
/*********************getAuthentication未获取用户信息时从cookies中获取操作人信息***************************/
}else if(ServletUtils.getRequest().getCookies()!=null && ServletUtils.getRequest().getCookies().length>0){
for(Cookie cookie:ServletUtils.getRequest().getCookies()){
if(cookie.getName().equals("username")){
operLog.setOperName(cookie.getValue());
}
}
}
if (e != null)

View File

@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login","/wechatLogin/**", "/register", "/captchaImage", "/weixin/**","/bgscreen/**","/publics/**","/system/dict/data/**").permitAll()
.antMatchers("/login","/wechatLogin/**", "/common/**", "/register", "/captchaImage", "/weixin/**","/bgscreen/**","/publics/**","/system/dict/data/**").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/img/**", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()