API: Document x-api-key header auth

This commit is contained in:
Igor Scheller 2023-12-23 21:59:48 +01:00 committed by Michael Weimann
parent 6e4c9b2405
commit 3432829c91
2 changed files with 10 additions and 5 deletions

View File

@ -36,12 +36,20 @@ tags:
- name: user - name: user
description: User information description: User information
security:
- bearer-auth: [ ]
- api-key-header: [ ]
components: components:
securitySchemes: securitySchemes:
bearerAuth: bearer-auth:
type: http type: http
scheme: bearer scheme: bearer
bearerFormat: API key from settings bearerFormat: API key from settings
api-key-header:
type: apiKey
name: x-api-key
in: header
responses: responses:
UnauthorizedError: # 401 UnauthorizedError: # 401
@ -421,9 +429,6 @@ components:
- event - event
- teardown - teardown
security:
- bearerAuth: [ ]
paths: paths:
/angeltypes: /angeltypes:
get: get:

View File

@ -87,7 +87,7 @@ class IndexController extends ApiController
return $this->response return $this->response
->setStatusCode(200) ->setStatusCode(200)
->withHeader('allow', 'OPTIONS, HEAD, GET') ->withHeader('allow', 'OPTIONS, HEAD, GET')
->withHeader('access-control-allow-headers', 'Authorization'); ->withHeader('access-control-allow-headers', 'Authorization, x-api-key');
} }
public function notFound(): Response public function notFound(): Response