暂时注释oauth配置

This commit is contained in:
kerwincui
2022-04-08 11:24:09 +08:00
parent f646a360ad
commit 0521511dfd
2 changed files with 17 additions and 17 deletions

View File

@@ -99,7 +99,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录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() "/iot/tool/mqtt/auth","/iot/tool/mqtt/webhook").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
@@ -116,18 +116,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/*/api-docs").anonymous() .antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous() .antMatchers("/druid/**").anonymous()
/************ oauth ************************/ /************ oauth ************************/
// 静态资源文件 // // 静态资源文件
.antMatchers("/oauth/logout/**","/oauth/css/**","/oauth/fonts/**").permitAll() // .antMatchers("/oauth/logout/**","/oauth/css/**","/oauth/fonts/**").permitAll()
// 智能音箱控制器由资源服务器管理 // // 智能音箱控制器由资源服务器管理
.antMatchers("/oauth/speaker/**").permitAll() // .antMatchers("/oauth/speaker/**").permitAll()
.anyRequest().authenticated() // .anyRequest().authenticated()
.and() // .and()
.formLogin() // .formLogin()
.loginPage("/oauth/login") // .loginPage("/oauth/login")
.permitAll() // .permitAll()
.and() // .and()
.logout().logoutUrl("/oauth/logout") // .logout().logoutUrl("/oauth/logout")
.permitAll() // .permitAll()
/************* oauth **************************/ /************* oauth **************************/
.and() .and()
.headers().frameOptions().disable(); .headers().frameOptions().disable();

View File

@@ -27,13 +27,13 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
throws IOException throws IOException
{ {
if (isAjaxRequest(request)){ // if (isAjaxRequest(request)){
int code = HttpStatus.UNAUTHORIZED; int code = HttpStatus.UNAUTHORIZED;
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
}else { // }else {
response.sendRedirect("/oauth/login"); // response.sendRedirect("/oauth/login");
} // }
} }