【发布时间】:2020-08-26 05:09:43
【问题描述】:
我有一个扩展 WebSecurityConfigurerAdapter 的 webSecConfig 类。我将它的方法粘贴到我尝试使用 .antMatchers 允许访问的地方。 我的文件夹结构: ... -资源 --static(这里我有 html/css 的图片) --模板 ---登录.html ---设计.css 我曾尝试添加基于某些 cmets 的“公共”文件夹,但到目前为止似乎没有任何效果。谁能帮我解决这个问题?
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.loginPage("/login").permitAll()
.loginProcessingUrl("/login")
.defaultSuccessUrl("/messages", true)
.and()
.logout()
.logoutSuccessUrl("/login")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET"))
.and()
.authorizeRequests()
.antMatchers("/login", "resources/**").permitAll()
.anyRequest().authenticated();
}
【问题讨论】:
标签: css spring spring-boot staticresource websecurity