diff --git a/springboot/wumei-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/springboot/wumei-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index b1fef096..94673e97 100644 --- a/springboot/wumei-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/springboot/wumei-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -99,7 +99,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage","/iot/tool/register","/iot/tool/ntp", + .antMatchers("/login", "/register", "/captchaImage","/iot/tool/register","/iot/tool/ntp","/iot/tool/download", "/iot/tool/mqtt/auth","/iot/tool/mqtt/webhook").anonymous() .antMatchers( HttpMethod.GET, @@ -116,18 +116,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .antMatchers("/*/api-docs").anonymous() .antMatchers("/druid/**").anonymous() /************ oauth ************************/ - // 静态资源文件 - .antMatchers("/oauth/logout/**","/oauth/css/**","/oauth/fonts/**").permitAll() - // 智能音箱控制器由资源服务器管理 - .antMatchers("/oauth/speaker/**").permitAll() - .anyRequest().authenticated() - .and() - .formLogin() - .loginPage("/oauth/login") - .permitAll() - .and() - .logout().logoutUrl("/oauth/logout") - .permitAll() +// // 静态资源文件 +// .antMatchers("/oauth/logout/**","/oauth/css/**","/oauth/fonts/**").permitAll() +// // 智能音箱控制器由资源服务器管理 +// .antMatchers("/oauth/speaker/**").permitAll() +// .anyRequest().authenticated() +// .and() +// .formLogin() +// .loginPage("/oauth/login") +// .permitAll() +// .and() +// .logout().logoutUrl("/oauth/logout") +// .permitAll() /************* oauth **************************/ .and() .headers().frameOptions().disable(); diff --git a/springboot/wumei-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java b/springboot/wumei-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java index 6a934c77..c8145ac0 100644 --- a/springboot/wumei-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java +++ b/springboot/wumei-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java @@ -27,13 +27,13 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException { - if (isAjaxRequest(request)){ +// if (isAjaxRequest(request)){ int code = HttpStatus.UNAUTHORIZED; String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); - }else { - response.sendRedirect("/oauth/login"); - } +// }else { +// response.sendRedirect("/oauth/login"); +// } }