.antMatchers( "/api/","/xhh/user/","/user/**")说明
如果写成" /user/ ",只能识别/user一层
如果写成" /user/* ",只能识别两层
如果写成” /user/** ",可以识别很多层
@Override
protected void configure(HttpSecurity http) throws Exception {
//TODO: 方便开发使用POSTMAN调试
http.httpBasic();
//必须放在super前面
http.authorizeRequests()
//.antMatchers("/userinfo")
//.permitAll()
.antMatchers( "/api/**","/xhh/user/**","/user/**")
.permitAll();
super.configure(http);
http.authorizeRequests().anyRequest().authenticated()
.and()
.rememberMe()
.and()
.sessionManagement().invalidSessionStrategy(new AjaxInvalidSessionStrategy())
.and()
.logout().logoutUrl(properties.getLogoutUrl())
.logoutSuccessHandler(logoutSuccessHandler).permitAll();
http.exceptionHandling()
.authenticationEntryPoint(new AjaxEntryPoint())
.accessDeniedHandler(accessDeniedHandler);
}
网友评论