Skip to content

Commit 0b00127

Browse files
authored
[OpenAPI] Add securitySchemes and security in overlays (#3198)
1 parent 1552e85 commit 0b00127

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

docs/overlays/elasticsearch-openapi-overlays.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ info:
44
title: Overlays for the Elasticsearch OpenAPI document
55
version: 0.0.1
66
actions:
7+
# Add document info details
78
- target: '$.info'
89
description: Add a document description and feedback link
910
update:
@@ -23,6 +24,43 @@ actions:
2324
x-feedbackLink:
2425
label: Feedback
2526
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
27+
# Add security details
28+
- target: '$.components'
29+
description: Add securitySchemes
30+
update:
31+
securitySchemes:
32+
apiKeyAuth:
33+
in: header
34+
name: Authorization
35+
type: apiKey
36+
description: |
37+
Elasticsearch APIs support key-based authentication.
38+
You must create an API key and use the encoded value in the request header.
39+
For example:
40+
41+
42+
```
43+
curl -X GET "${ES_URL}/_cat/indices?v=true" \
44+
-H "Authorization: ApiKey ${API_KEY}"
45+
```
46+
47+
To get API keys, use the `/_security/api_key` APIs.
48+
basicAuth:
49+
scheme: basic
50+
type: http
51+
bearerAuth:
52+
scheme: bearer
53+
type: http
54+
description: |
55+
Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
56+
For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)
57+
- target: '$'
58+
description: Add document security
59+
update:
60+
security:
61+
- apiKeyAuth: []
62+
- basicAuth: []
63+
- bearerAuth: []
2664
# Examples that apply only to the Elasticsearch OpenAPI document
2765
- target: "$.paths['/_features']['get']"
2866
description: "Add examples for get features operation"

docs/overlays/elasticsearch-serverless-openapi-overlays.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,30 @@ actions:
1818
url: 'https://creativecommons.org/licenses/by-nc-nd/4.0/'
1919
x-feedbackLink:
2020
label: Feedback
21-
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
21+
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
22+
# Add security details
23+
- target: '$.components'
24+
description: Add securitySchemes
25+
update:
26+
securitySchemes:
27+
apiKeyAuth:
28+
description: |
29+
Elasticsearch APIs use key-based authentication.
30+
You must create an API key and use the encoded value in the request header.
31+
For example:
32+
33+
34+
```
35+
curl -X GET "${ES_URL}/_cat/indices?v=true" \
36+
-H "Authorization: ApiKey ${API_KEY}"
37+
```
38+
39+
To get API keys for the Elasticsearch endpoint (${ES_URL}) for a project, refer to [Connect to your Elasticsearch Serverless endpoint](https://www.elastic.co/guide/en/serverless/current/elasticsearch-connecting-to-es-serverless-endpoint.html).
40+
in: header
41+
name: Authorization
42+
type: apiKey
43+
- target: '$'
44+
description: Add document security
45+
update:
46+
security:
47+
- apiKeyAuth: []

0 commit comments

Comments
 (0)