spring boot 整合security 4 怎么设置忽略的静态资源
public void configure(WebSecurity web) throws Exception {;
web.ignoring().antMatchers("/assets/**","/images/**","/**/*.jsp");
protected void configure(HttpSecurity http) throws Exception {;
http.portMapper().http(80).mapsTo(443);
http.addFilterBefore(mySecurityInterceptor,FilterSecurityInterceptor.class);
authorizeRequests();
//.antMatchers("/webapp/**").permitAll();
//.antMatchers("/images/*.jpg").permitAll();
//.antMatchers("/images/*.png").permitAll();
//.antMatchers("/**/*.js").permitAll();
//.antMatchers("/**/*.css").permitAll();
//.antMatchers("/**/*.woff").permitAll();
//.antMatchers("/**/*.woff2").permitAll();
//.antMatchers("/**/*.jsp").permitAll();
//.antMatchers("/**/*.html").permitAll();
//.antMatchers("/favicon.ico").permitAll();
//.antMatchers("/admin/*").permitAll();
//.antMatchers("/sys/**").permitAll();
anyRequest().authenticated().and();
ormLogin();
loginPage("/admin/login").permitAll();
loginProcessingUrl("/sys/welcome");
permitAll();
passwordParameter("loginPwd");
usernameParameter("loginId");
failureUrl("/admin/sessiontimeout");
logoutUrl("/admin/logout");
permitAll();
invalidateHttpSession(true);
and().exceptionHandling();
accessDeniedHandler(myAccessDeniedHandler);
accessDeniedPage("/admin/accessDefine");
and()。
2023-08-29 广告
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/assets/**","/images/**","/**/*.jsp");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.portMapper().http(80).mapsTo(443);
http.addFilterBefore(mySecurityInterceptor,FilterSecurityInterceptor.class)
.authorizeRequests()
// .antMatchers("/webapp/**").permitAll()
// .antMatchers("/images/*.jpg").permitAll()
// .antMatchers("/images/*.png").permitAll()
// .antMatchers("/**/*.js").permitAll()
// .antMatchers("/**/*.css").permitAll()
// .antMatchers("/**/*.woff").permitAll()
// .antMatchers("/**/*.woff2").permitAll()
// .antMatchers("/**/*.jsp").permitAll()
// .antMatchers("/**/*.html").permitAll()
// .antMatchers("/favicon.ico").permitAll()
// .antMatchers("/admin/*").permitAll()
// .antMatchers("/sys/**").permitAll()
.anyRequest().authenticated().and()
.formLogin()
.loginPage("/admin/login").permitAll()
.loginProcessingUrl("/sys/welcome")
.permitAll()
.passwordParameter("loginPwd")
.usernameParameter("loginId")
.failureUrl("/admin/sessiontimeout")
.permitAll()
.defaultSuccessUrl("/sys/welcome")
.permitAll()
.and()
.logout()
.logoutUrl("/admin/logout")
.permitAll()
.invalidateHttpSession(true)
.and()
.exceptionHandling()
.accessDeniedHandler(myAccessDeniedHandler)
.accessDeniedPage("/admin/accessDefine")
.and();