title: OpenAPI3 show methods based on Basic Authentication via Spring Boot
body: <p>I added this dependency to my Spring Boot application</p>
  <pre><code> &lt;dependency&gt;
        &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
        &lt;artifactId&gt;springdoc-openapi-ui&lt;/artifactId&gt;
        &lt;version&gt;1.4.3&lt;/version&gt;
        &lt;type&gt;pom.sha512&lt;/type&gt;
       &lt;/dependency&gt;
  </code></pre>
  <p>I then was able to open :
  https://localhost:8443/v3/api-docs</p>
  <p>The browser does ask me for my credentials, and as long as I enter the user/password right it works, but it shows me ALL the methods that are available globally. I would like only the methods the user has rights to, to show up in the api docs.</p>
  <p>For a specific method is use this tag to authorize my call:
  <code>@PreAuthorize(&quot;hasRole('USER') OR hasRole('ADMIN')&quot;) </code></p>
  <p>This is my web security config class:</p>
  <pre><code>@Configuration
  @EnableWebSecurity
  @EnableGlobalMethodSecurity(prePostEnabled = true)
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter
  {
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception
      {
          auth.inMemoryAuthentication()
                  .passwordEncoder(new BCryptPasswordEncoder())
                  .withUser(&quot;user&quot;).password(new BCryptPasswordEncoder().encode(&quot;blabl&quot;)).roles(&quot;USER&quot;)
                  .and()
                  .withUser(&quot;admin&quot;).password(new BCryptPasswordEncoder().encode(&quot;blabla&quot;)).roles(&quot;ADMIN&quot;);
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception
      {
          http.authorizeRequests()
                  .antMatchers(&quot;/&quot;).permitAll()
                  .anyRequest().authenticated()
                  .and()
                  .httpBasic();
      }
  }
  </code></pre>