title: Configure swagger with JWT
body: <p>I want install SWAGER for my SpringBoot application. Seems that JWT doesn't give access for swagger URL. </p>
  
  <p>I'm trying to reach this by url <code>localhost:8088/swagger-ui.html</code></p>
  
  <p>Here is SwaggerConfig class</p>
  
  <pre><code>@EnableSwagger2
  @Configuration
  public class SwaggerConfig {
  
  
  @Bean
  public Docket productApi() {
      return new Docket(DocumentationType.SWAGGER_2)
              .select()
              .apis(RequestHandlerSelectors.basePackage("Path.to.my.controller"))
  
              .build();
  
  }
  
  
  }
  </code></pre>
  
  <p>Also i was trying to add WebAppConfig from <a href="http://qaru.site/questions/73659/a-simple-way-to-implement-swagger-in-a-spring-mvc-application" rel="nofollow noreferrer">link</a> with the next content</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  public class WebAppConfig extends WebMvcConfigurerAdapter {
  
  @Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
      registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
      registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
  }
  
  }
  </code></pre>
  
  <p>And tried to set ignore url:</p>
  
  <pre><code>@Configuration
  public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
  @Override
  public void configure(WebSecurity web) throws Exception {
      web.ignoring().antMatchers("/resources/**");
  }
  
  }
  </code></pre>
  
  <p>This version of code gives autoredirection to "localhost:8088/login" from swagger url. But the next returns just empty page</p>
  
  <p><strong>UPDATED</strong></p>
  
  <pre><code>  web.ignoring().antMatchers("/", "/configuration/ui", "/swagger-resources", "/configuration/security", "/swagger-ui.html", "/webjars/**");
  </code></pre>
  
  <p>The urls in gaps are urls i was seen when was debuging issuse. This urls are called by swagger.</p>
  
  <p><strong>UPDATED part End</strong></p>
  
  <p>Main class</p>
  
  <pre><code> @SpringBootApplication
  public class Application extends SpringBootServletInitializer {
  
      public static void main(String[] args) {
      TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC"));
      SpringApplication app = new SpringApplication(Application.class);
      app.run();
  }
  
  @Bean
  @Autowired
  public FilterRegistrationBean jwtFilterRegistration(JwtUtil jwtUtil, UserService userService) {
      FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
      filterRegistrationBean.setFilter(new JwtFilter(jwtUtil, userService));
  
      filterRegistrationBean.addUrlPatterns("/*");
  
      // ordering in the filter chain
      filterRegistrationBean.setOrder(1);
      return filterRegistrationBean;
  }
  
  // Request Interceptor for checking permission with custom annotation.
  @Bean
  public MappedInterceptor PermissionHandlerInterceptor() {
      return new MappedInterceptor(null, new PermissionHandlerInterceptor());
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Pom xml contains all needed depencies. When i comment in Main class jwt method i can access swagger. So i made a conclusion that problem in JWT.
  If some extra info is needed i will add.</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>At first swagger-url gives White Label Page with an error "Unathorized"
  After some manipulations with code it gives empty page.</p>