Backstage
    Preparing search index...

    A provider that supplies authentication headers for Elasticsearch/OpenSearch requests.

    This interface allows for dynamic authentication mechanisms such as bearer tokens that need to be refreshed or rotated. The getAuthHeaders method is called before each request to the Elasticsearch/OpenSearch cluster, allowing for just-in-time token retrieval and automatic rotation.

    const authProvider: ElasticSearchAuthProvider = {
    async getAuthHeaders() {
    const token = await myTokenService.getToken();
    return { Authorization: `Bearer ${token}` };
    },
    };
    interface ElasticSearchAuthProvider {
        getAuthHeaders(): Promise<Record<string, string>>;
    }
    Index

    Methods

    • Returns authentication headers to be included in requests to Elasticsearch/OpenSearch.

      Returns Promise<Record<string, string>>

      A promise that resolves to a record of header names and values

      This method is called before each request, allowing for dynamic token refresh and rotation. Implementations should handle caching internally if needed to avoid excessive token generation.