From edf90dbc7e82d870e291d1e2f5d996626248f4a9 Mon Sep 17 00:00:00 2001 From: Eugene Kulak Date: Fri, 15 Dec 2023 18:51:24 +0200 Subject: [PATCH] replace custom authenticator with SelectiveAuthenticator --- .../source_retently/components.py | 23 ------------------- .../source_retently/manifest.yaml | 10 +++++--- 2 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 airbyte-integrations/connectors/source-retently/source_retently/components.py diff --git a/airbyte-integrations/connectors/source-retently/source_retently/components.py b/airbyte-integrations/connectors/source-retently/source_retently/components.py deleted file mode 100644 index 064ca721a62d..000000000000 --- a/airbyte-integrations/connectors/source-retently/source_retently/components.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2023 Airbyte, Inc., all rights reserved. -# - -from dataclasses import dataclass -from typing import Any, Mapping - -from airbyte_cdk.sources.declarative.auth import DeclarativeOauth2Authenticator -from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator -from airbyte_cdk.sources.declarative.auth.token import ApiKeyAuthenticator - - -@dataclass -class AuthenticatorRetently(DeclarativeAuthenticator): - config: Mapping[str, Any] - api_auth: ApiKeyAuthenticator - oauth: DeclarativeOauth2Authenticator - - def __new__(cls, api_auth, oauth, config, *args, **kwargs): - if config["credentials"]["api_key"]: - return api_auth - else: - return oauth diff --git a/airbyte-integrations/connectors/source-retently/source_retently/manifest.yaml b/airbyte-integrations/connectors/source-retently/source_retently/manifest.yaml index 8a8a910691da..642f1c8e2ad2 100644 --- a/airbyte-integrations/connectors/source-retently/source_retently/manifest.yaml +++ b/airbyte-integrations/connectors/source-retently/source_retently/manifest.yaml @@ -28,9 +28,13 @@ definitions: url_base: "https://app.retently.com/api/v2/" http_method: "GET" authenticator: - class_name: source_retently.components.AuthenticatorRetently - api_auth: "#/definitions/api_authenticator" - oauth: "#/definitions/oauth_authenticator" + type: SelectiveAuthenticator + authenticator_selection_path: + - auth + - type + authenticators: + token: "#/definitions/api_authenticator" + oauth: "#/definitions/oauth_authenticator" retriever: type: SimpleRetriever