I want to open the swagger ui on my browser. This is my code
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/swagger-ui.html").permitAll() .anyRequest().authenticated().and().httpBasic().and().csrf().disable();
}
But it doesn't work. I still need to enter basic auth provided by httpBasic()
So I add the following code found by others
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/v2/api-docs",
"/configuration/ui",
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**");
}
Now, I can access localhost:8080/swagger-ui.html but the httpBasic window still pops up. I can click cancel to close the window and continue to use the swagger ui. But I don't know what causes the issue