暂时注释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()
// 对于登录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();

View File

@@ -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");
// }
}