|
|
@ -40,7 +40,7 @@ import java.util.List; |
|
|
|
* @since 1.0 |
|
|
|
*/ |
|
|
|
@Configuration |
|
|
|
//@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true, jsr250Enabled = true)
|
|
|
|
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true, jsr250Enabled = true) |
|
|
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
@Autowired |
|
|
|
private IUserService userService; |
|
|
@ -50,8 +50,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void configure(WebSecurity web) throws Exception { |
|
|
|
// super.configure(web);
|
|
|
|
web.ignoring().antMatchers("login", "/v2/api-docs/**", "/swagger-resources/**", "/swagger-ui.html"); |
|
|
|
web.ignoring().antMatchers("/v3/api-docs/**", "/swagger-resources/**", "/swagger-ui/**","/swagger-ui/index.html"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -60,7 +59,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
|
|
|
|
// 授权配置
|
|
|
|
http.authorizeRequests().anyRequest().authenticated(); |
|
|
|
|
|
|
|
// 配置登录
|
|
|
|
http.formLogin().usernameParameter("username").passwordParameter("password").loginProcessingUrl("/login"); |
|
|
|
|
|
|
@ -76,9 +74,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
|
|
|
|
// 登出授权
|
|
|
|
// http.logout().permitAll();
|
|
|
|
|
|
|
|
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); |
|
|
|
|
|
|
|
/* 配置token验证过滤器 */ |
|
|
|
http.addFilterBefore(new JWTAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); |
|
|
|
} |
|
|
|