title: How to hide Spring Security OAuth2 endpoints from Swagger UI?
body: <p>I have an API application built with Spring Boot. I used <strong>swagger-springmvc</strong> v0.9.5 plugin along with Swagger UI to generate a live documentation and interaction front-end to the API methods.</p>
  
  <p>I recently introduced Spring security and OAuth to the application. This introduced a few more sections appearing in the Swagger UI for:</p>
  
  <ul>
  <li><strong>authorization-endpoint</strong> which has a bunch of HTTP operations available under the <code>/oauth/authorize</code> path</li>
  <li><strong>check-token-endpoint</strong> which has a bunch of HTTP operations available under the <code>/oauth/check_token</code> path</li>
  <li><strong>whitelabel-approval-endpoint</strong> which has a bunch of HTTP operations available under the <code>/oauth/confirm_access</code> path</li>
  <li><strong>whitelabel-error-endpoint</strong> which has a bunch of HTTP operations available under the <code>/oauth/error</code> path</li>
  </ul>
  
  <p>I can understand what they are for, but I do not want them to appear in my Swagger UI front-end. How do I hide them?</p>
  
  <p>com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin's configuration does offer includePatterns() method but no way to exclude patterns. With includePatterns() every time some one adds a method to the API, will need to remember to add it there, which is not ideal. I don't have a common prefix for all API methods that I can use includePatterns() with either.</p>