title: Swagger + spring boot + jwt + How to disable Authorize button for specific API
body: <p>I have configured JWT Bearer token authentication in my spring boot application. I have &quot;Authenticate&quot; and &quot;Hello&quot; controllers where in &quot;Hello&quot; controller takes in Bearer token as Authorization header. &quot;Authenticate&quot; api generates the bearer token. Everything works fine with postman. But from swagger side, I am not able to disable &quot;Authorize&quot; button for &quot;Authenticate&quot; api.
  <a href="https://i.stack.imgur.com/9kOGw.png" rel="nofollow noreferrer">swagger screen clip</a></p>
  <p>Here with my code looks like:
  SwaggerConfig file:</p>
  <pre><code>    @Bean
      public Docket swaggerSpringfoxDocket() {
          Contact contact = new Contact(
                  &quot;shivaraj&quot;,
                  &quot;https://shivaraj.co&quot;,
                  &quot;bmxxxxx@xxxx.com&quot;);
  
          List&lt;VendorExtension&gt; vext = new ArrayList&lt;&gt;();
          ApiInfo apiInfo = new ApiInfo(
                  &quot;Backend API&quot;,
                  &quot;description&quot;,
                  &quot;1.0.0&quot;,
                  &quot;https://shivaraj.co&quot;,
                  contact,
                  &quot;MIT&quot;,
                  &quot;https://shivaraj.co&quot;,
                  vext);
  
          Docket docket = new Docket(DocumentationType.SWAGGER_2)
                  .apiInfo(apiInfo)
                  .pathMapping(&quot;/&quot;)
                  .apiInfo(ApiInfo.DEFAULT)
                  .forCodeGeneration(true)
                  .genericModelSubstitutes(ResponseEntity.class)
                  .ignoredParameterTypes(SpringDataWebProperties.Pageable.class)
                  .ignoredParameterTypes(java.sql.Date.class)
                  .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
                  .directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
                  .directModelSubstitute(java.time.LocalDateTime.class, Date.class)
                  .securityContexts(Lists.newArrayList(securityContext()))
                  .securitySchemes(Lists.newArrayList(apiKey()))
                  .useDefaultResponseMessages(false);
  
          docket = docket.select()
                  .paths(regex(DEFAULT_INCLUDE_PATTERN))
                  .build();
  
          return docket;
      }
  
      private ApiKey apiKey() {
          return new ApiKey(&quot;JWT&quot;, AUTHORIZATION_HEADER, &quot;header&quot;);
      }
  
      private SecurityContext securityContext() {
          return SecurityContext.builder()
                  .securityReferences(defaultAuth())
                  .forPaths(PathSelectors.regex(DEFAULT_INCLUDE_PATTERN))
                  .build();
      }
  
      List&lt;SecurityReference&gt; defaultAuth() {
          AuthorizationScope authorizationScope
                  = new AuthorizationScope(&quot;global&quot;, &quot;accessEverything&quot;);
          AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
          authorizationScopes[0] = authorizationScope;
          return Lists.newArrayList(
                  new SecurityReference(&quot;JWT&quot;, authorizationScopes));
      }
  
  </code></pre>
  <p>As alternate approach, is there a way we can enable authorization button in swagger for each individual controller?</p>