fix: credential typing
This commit is contained in:
parent
35dcc6a2a1
commit
c39f27bcd4
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import logging
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
|
@ -212,6 +213,12 @@ class UserPasswordCredentials(_BaseCredentials):
|
|||
username: SecretStr
|
||||
password: SecretStr
|
||||
|
||||
def bearer(self) -> str:
|
||||
# Converting the string to bytes using encode()
|
||||
# Base64 encoding it with base64.b64encode()
|
||||
# Converting the resulting bytes back to a string with decode()
|
||||
return f"Basic {base64.b64encode(f'{self.username.get_secret_value()}:{self.password.get_secret_value()}'.encode()).decode()}"
|
||||
|
||||
|
||||
Credentials = Annotated[
|
||||
OAuth2Credentials | APIKeyCredentials | UserPasswordCredentials,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import logging
|
||||
|
||||
from backend.data import integrations
|
||||
from backend.data.model import APIKeyCredentials, Credentials, OAuth2Credentials
|
||||
from backend.data.model import Credentials
|
||||
|
||||
from ._base import WT, BaseWebhooksManager
|
||||
|
||||
|
@ -25,6 +25,6 @@ class ManualWebhookManagerBase(BaseWebhooksManager[WT]):
|
|||
async def _deregister_webhook(
|
||||
self,
|
||||
webhook: integrations.Webhook,
|
||||
credentials: OAuth2Credentials | APIKeyCredentials,
|
||||
credentials: Credentials,
|
||||
) -> None:
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue