You've already forked RekomenciBackend
feat(): yandex sign up interactor
This commit is contained in:
@@ -36,11 +36,18 @@ class ServerConfiguration:
|
||||
return f"http://{self.host}:{self.port}"
|
||||
|
||||
|
||||
@to_configuration
|
||||
class YandexOAuthConfiguration:
|
||||
client_id: str
|
||||
client_secret: SecretString
|
||||
|
||||
|
||||
@to_configuration
|
||||
class Configuration:
|
||||
server: ServerConfiguration
|
||||
database: DatabaseConfiguration
|
||||
access_token: AccessTokenConfiguration
|
||||
yandex_oauth: YandexOAuthConfiguration
|
||||
|
||||
|
||||
retort = Retort(
|
||||
|
||||
@@ -6,6 +6,7 @@ from template_project.web_api.configuration import (
|
||||
Configuration,
|
||||
DatabaseConfiguration,
|
||||
ServerConfiguration,
|
||||
YandexOAuthConfiguration,
|
||||
)
|
||||
from template_project.web_api.ioc.connection import ConnectionProvider
|
||||
from template_project.web_api.ioc.cryptographer import CryptographerProvider
|
||||
@@ -13,6 +14,7 @@ from template_project.web_api.ioc.data_gateway import DataGatewayProvider
|
||||
from template_project.web_api.ioc.factory import FactoryProvider
|
||||
from template_project.web_api.ioc.idp import IdPProvider
|
||||
from template_project.web_api.ioc.interactor import InteractorProvider
|
||||
from template_project.web_api.ioc.oauth import OAuthClientProvider
|
||||
|
||||
|
||||
def make_ioc(configuration: Configuration) -> AsyncContainer:
|
||||
@@ -24,10 +26,12 @@ def make_ioc(configuration: Configuration) -> AsyncContainer:
|
||||
InteractorProvider(),
|
||||
DataGatewayProvider(),
|
||||
CryptographerProvider(),
|
||||
OAuthClientProvider(),
|
||||
validation_settings=STRICT_VALIDATION,
|
||||
context={
|
||||
ServerConfiguration: configuration.server,
|
||||
DatabaseConfiguration: configuration.database,
|
||||
AccessTokenConfiguration: configuration.access_token,
|
||||
YandexOAuthConfiguration: configuration.yandex_oauth,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from dishka import BaseScope, Provider, Scope, provide
|
||||
|
||||
from template_project.adapters.oauth.yandex import YandexOAuthClient as YandexOAuthClientImpl
|
||||
from template_project.application.common.oauth.yandex import OAuthClient as YandexOAuthClient
|
||||
from template_project.web_api.configuration import YandexOAuthConfiguration
|
||||
|
||||
|
||||
class OAuthClientProvider(Provider):
|
||||
scope: BaseScope | None = Scope.REQUEST
|
||||
|
||||
@provide(scope=Scope.REQUEST)
|
||||
async def yandex_oauth_client(self, configuration: YandexOAuthConfiguration) -> YandexOAuthClient:
|
||||
return YandexOAuthClientImpl(
|
||||
client_id=configuration.client_id,
|
||||
client_secret=configuration.client_secret,
|
||||
)
|
||||
Reference in New Issue
Block a user