Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenAPI] Add securitySchemes and security in overlays #3198

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/overlays/elasticsearch-openapi-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ info:
title: Overlays for the Elasticsearch OpenAPI document
version: 0.0.1
actions:
# Add document info details
- target: '$.info'
description: Add a document description and feedback link
update:
Expand All @@ -23,6 +24,43 @@ actions:
x-feedbackLink:
label: Feedback
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
# Add security details
- target: '$.components'
description: Add securitySchemes
update:
securitySchemes:
apiKeyAuth:
in: header
name: Authorization
type: apiKey
description: |
Elasticsearch APIs support key-based authentication.
You must create an API key and use the encoded value in the request header.
For example:


```
curl -X GET "${ES_URL}/_cat/indices?v=true" \
-H "Authorization: ApiKey ${API_KEY}"
```

To get API keys, use the `/_security/api_key` APIs.
basicAuth:
scheme: basic
type: http
bearerAuth:
scheme: bearer
type: http
description: |
Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)
- target: '$'
description: Add document security
update:
security:
- apiKeyAuth: []
- basicAuth: []
- bearerAuth: []
# Examples that apply only to the Elasticsearch OpenAPI document
- target: "$.paths['/_features']['get']"
description: "Add examples for get features operation"
Expand Down
28 changes: 27 additions & 1 deletion docs/overlays/elasticsearch-serverless-openapi-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,30 @@ actions:
url: 'https://creativecommons.org/licenses/by-nc-nd/4.0/'
x-feedbackLink:
label: Feedback
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
# Add security details
- target: '$.components'
description: Add securitySchemes
update:
securitySchemes:
apiKeyAuth:
description: |
Elasticsearch APIs use key-based authentication.
You must create an API key and use the encoded value in the request header.
For example:


```
curl -X GET "${ES_URL}/_cat/indices?v=true" \
-H "Authorization: ApiKey ${API_KEY}"
```

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).
in: header
name: Authorization
type: apiKey
- target: '$'
description: Add document security
update:
security:
- apiKeyAuth: []
Loading