How to configure Spring Security to allow Swagger URL to be accessed without authentication

Adding this to your WebSecurityConfiguration class should do the trick. @Configuration public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers(“/v2/api-docs”, “/configuration/ui”, “/swagger-resources/**”, “/configuration/security”, “/swagger-ui.html”, “/webjars/**”); } }

How can I represent ‘Authorization: Bearer ‘ in a Swagger Spec (swagger.json)

Maybe this can help: swagger: ‘2.0’ info: version: 1.0.0 title: Based on “Basic Auth Example” description: > An example for how to use Auth with Swagger. host: basic-auth-server.herokuapp.com schemes: – http – https securityDefinitions: Bearer: type: apiKey name: Authorization in: header paths: /: get: security: – Bearer: [] responses: ‘200’: description: ‘Will send `Authenticated`’ ‘403’: … Read more