I use Spring Security and Thymeleaf. Spring Security hides pictures from the resources/static/images
folder if the user is not authorized, while the block itself is visible. How to make the pictures available to everyone?
<div sec:authorize="isAnonymous()" class="container"> <div class="row"> <div class="span12"> <h2>Our customers</h2> <div class="col-xs-3" > <div class="well"> <img th:src="@{/images/pic1.jpg}" width="75" height="75" class="img-circle"/> </div> </div> <div class="col-xs-3"> <div class="well"> <img th:src="@{/images/pic2.jpg}" width="75" height="75" class="img-circle"/> </div> </div> </div> </div> </div>
Spring security config
@Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/", "/home", "/images").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .permitAll(); } ... }