0

I want to map local folder to localhost:8080 How can I achieve this. I am using spring boot. have given permitall to public/pic folder.

how to open in browser like below.

http://localhost:8080/public/pic/default.jpg

above link gives 401 and asks for username and password.

using below code for security in spring

@Override
    protected void configure (HttpSecurity http) throws Exception {

        http.csrf().disable();
        http.cors().disable();
        http.authorizeRequests()
                .antMatchers("/public/pic/**").permitAll()
                .anyRequest().authenticated()
            .and()
                .httpBasic()
            .and()
                .logout();
        // @formatter:on
    }

where should be the folder /public/pic in local system?

Anjali
  • 1,623
  • 5
  • 30
  • 50
  • found the solution here https://stackoverflow.com/questions/24916894/serving-static-web-resources-in-spring-boot-spring-security-application?rq=1 – Anjali Oct 24 '18 at 11:28

1 Answers1

0

Try to add to your config

@Override
public void configure(WebSecurity webSecurity) {
    webSecurity.ignoring().antMatchers("/public/pic/**");
}
StanislavL
  • 56,971
  • 9
  • 68
  • 98