title: Basic Authentication using Swagger UI
body: <p>I am trying to develop a spring-boot based rest API service with API documentation through Swagger UI. I want to enable basic authentication via the swagger UI so that the user can only run the API's once he/she authenticates using the Authorize button on swagger UI (by which a <code>"authorization: Basic XYZ</code> header is added to the API Call</p>
  
  <p>At the front end (in the .json file for the Swagger UI I have added basic authentication for all the APIs using the following code (as per the documentation):</p>
  
  <pre><code>"securityDefinitions": {
          "basic_auth": {
              "type": "basic"
          }
      },
      "security": [
          {
              "basic_auth": []
          }
      ]
  </code></pre>
  
  <p>How should I implement the backend logic for the use case mentioned above (user can only run the API's once he/she authenticates using the Authorize button on swagger UI and it otherwise shows a 401 Error on running the API)</p>
  
  <p>Some documentation or sample code for the same would be helpful</p>