title: How to define a custom security with multiple api keys in fastapi?
body: <p>This is my plan,  but it can't be generated to the OpenAPI doc's Authentication section.</p>
  <pre><code>class HMACModel(BaseModel):
      api_key: APIKey = APIKey(**{&quot;in&quot;: APIKeyIn.header}, name='Api-Key')
      signature: APIKey = APIKey(**{&quot;in&quot;: APIKeyIn.header}, name='Signature')
  
  
  class HMACAuth(APIKeyBase):
      model = HMACModel()
      scheme_name = 'HMACAuth'
  
      async def __call__(self, request: Request):
          api_key = request.headers.get('Api-Key')
          signature = request.headers.get('Signature')
          print(f's:{signature}, k:{api_key}')
          do_some_check()
          return api_key
  
  @app.get('/')
  async def test_api(req: ReqModel, api_key=Depends(HMACAuth())):
          pass
  </code></pre>
  <p>It seems that custom model will be ignore when the OpenAPI object init with analysis output <code>OpenAPI(**output)</code>.(There are security shema in output, but missd in OpenAPI object).</p>
  <p>(Refer code :https://github.com/tiangolo/fastapi/blob/d60dd1b60e0acd0afcd5688e5759f450b6e7340c/fastapi/openapi/utils.py#L372)</p>