Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
api_key_auth_factory.py26 linesDownload Raw Back to auth
1from services.auth.api_key_auth_base import ApiKeyAuthBase2from services.auth.auth_type import AuthType3 4 5class ApiKeyAuthFactory:6    def __init__(self, provider: str, credentials: dict):7        auth_factory = self.get_apikey_auth_factory(provider)8        self.auth = auth_factory(credentials)9 10    def validate_credentials(self):11        return self.auth.validate_credentials()12 13    @staticmethod14    def get_apikey_auth_factory(provider: str) -> type[ApiKeyAuthBase]:15        match provider:16            case AuthType.FIRECRAWL:17                from services.auth.firecrawl.firecrawl import FirecrawlAuth18 19                return FirecrawlAuth20            case AuthType.JINA:21                from services.auth.jina.jina import JinaAuth22 23                return JinaAuth24            case _:25                raise ValueError("Invalid provider")26