diff --git a/.envexample b/.envexample index 5d0e2b63..ee22a0aa 100644 --- a/.envexample +++ b/.envexample @@ -4,8 +4,12 @@ POSTGRES_USER: dev POSTGRES_PASSWORD: local-dev POSTGRES_DB: cpf +BASE_URL: /cpf/api +USE_MOCK_USER: False FUSIONAUTH_POSTGRES_DB: fusionauth FUSIONAUTH_POSTGRES_USER: fusionauth FUSIONAUTH_POSTGRES_PASSWORD: password - +FUSIONAUTH_API_KEY: 00c24029-e66a-43f2-9000-544e90e8d46e +FUSIONAUTH_URL: http://fusionauth:9011 +FUSIONAUTH_APPLICATION_ID: 23e4b229-1219-42e5-aed6-f9b6f1eedef8 \ No newline at end of file diff --git a/backend/src/cpf/adapters/inbound/data_loader/loader.py b/backend/src/cpf/adapters/inbound/data_loader/loader.py index ed75294b..1988bae2 100644 --- a/backend/src/cpf/adapters/inbound/data_loader/loader.py +++ b/backend/src/cpf/adapters/inbound/data_loader/loader.py @@ -1,12 +1,13 @@ import json import os -from cpf.core.ports.provided.services import ManageService +from cpf.core.ports.provided.services import ManageService, UserManagementService manage_service: ManageService | None = None +user_management_service: UserManagementService | None = None -def set_manage_service(service: ManageService): +def set_manage_service(service: ManageService) -> None: global manage_service manage_service = service @@ -17,6 +18,17 @@ def get_manage_service() -> ManageService: return manage_service +def set_user_management_service(service: UserManagementService) -> None: + global user_management_service + user_management_service = service + + +def get_user_management_service() -> UserManagementService: + if not user_management_service: + raise RuntimeError("User management service not set") + return user_management_service + + def start_data_upload() -> None: service = get_manage_service() if service.check_if_data_is_exists(): @@ -38,3 +50,7 @@ def start_data_upload() -> None: ladder_data = json.loads(file.read()) service.create_ladder(ladder_data=ladder_data) print(f"Ladder created from file {ladder_data_path}") + # Create admin account + user_service = get_user_management_service() + # TODO Create new service method for admin account creation when role management system will be ready + user_service.create_new_user(email="cpf@kellton.com", first_name="Cpf", last_name="Admin") diff --git a/backend/src/cpf/adapters/inbound/rest_api/library/api.py b/backend/src/cpf/adapters/inbound/rest_api/library/api.py index 38079df8..d3e31ba4 100644 --- a/backend/src/cpf/adapters/inbound/rest_api/library/api.py +++ b/backend/src/cpf/adapters/inbound/rest_api/library/api.py @@ -1,4 +1,5 @@ import os +from typing import Annotated from fastapi import APIRouter, Depends @@ -13,16 +14,19 @@ LadderDetailResponse, LadderResponse, ) -from cpf.adapters.inbound.rest_api.rest_api import get_library_query_service +from cpf.adapters.inbound.rest_api.permissions import check_permissions +from cpf.adapters.inbound.rest_api.rest_api import auth, get_library_query_service from cpf.core.ports.provided.services import QueryService -from cpf.core.ports.required.dtos import LadderDetailDTO +from cpf.core.ports.required.dtos import LadderDetailDTO, UserDTO from cpf.core.ports.required.readmodels import BucketReadModel, LadderReadModel router = APIRouter(prefix=f"{os.getenv('BASE_URL')}/library") @router.get(path="/ladders", response_model_exclude_none=True) +@check_permissions(permission_classes=[]) def get_ladders( + user: Annotated[UserDTO | None, Depends(auth)], service: QueryService = Depends(get_library_query_service), ) -> list[LadderResponse]: ladder_read_models: list[LadderReadModel] = service.get_all_ladders() @@ -37,8 +41,11 @@ def get_ladders( @router.get(path="/ladders/{ladder_slug}", response_model_exclude_none=True) +@check_permissions(permission_classes=[]) def get_ladder_details( - ladder_slug: str, service: QueryService = Depends(get_library_query_service) + ladder_slug: str, + user: Annotated[UserDTO | None, Depends(auth)], + service: QueryService = Depends(get_library_query_service), ) -> LadderDetailResponse: ladder_detail: LadderDetailDTO = service.get_ladder(ladder_slug=ladder_slug) @@ -64,8 +71,11 @@ def get_ladder_details( @router.get(path="/buckets/{bucket_slug}", response_model_exclude_none=True) +@check_permissions(permission_classes=[]) def get_bucket_details( - bucket_slug: str, service: QueryService = Depends(get_library_query_service) + bucket_slug: str, + user: Annotated[UserDTO | None, Depends(auth)], + service: QueryService = Depends(get_library_query_service), ) -> BucketDetailResponse: bucket_details: BucketReadModel = service.get_bucket(bucket_slug=bucket_slug) advancement_levels: list[AdvancementLevelResponse] = [] diff --git a/backend/src/cpf/adapters/inbound/rest_api/models/responses/core.py b/backend/src/cpf/adapters/inbound/rest_api/models/responses/core.py index 44dab843..51b89ae5 100644 --- a/backend/src/cpf/adapters/inbound/rest_api/models/responses/core.py +++ b/backend/src/cpf/adapters/inbound/rest_api/models/responses/core.py @@ -1,5 +1,20 @@ from cpf.adapters.inbound.rest_api.ion import IonBaseModel, IonLink -class RootResponse(IonBaseModel): +class UserResponse(IonBaseModel): + first_name: str + last_name: str + + +class UnauthenticatedRootResponse(IonBaseModel): + login: IonLink + + +class AuthenticatedRootResponse(IonBaseModel): + user: UserResponse get_ladders: IonLink + + +class LadderResponse(IonBaseModel): + ladder_name: str + ladder_slug: str diff --git a/backend/src/cpf/adapters/inbound/rest_api/permissions.py b/backend/src/cpf/adapters/inbound/rest_api/permissions.py new file mode 100644 index 00000000..45f0b664 --- /dev/null +++ b/backend/src/cpf/adapters/inbound/rest_api/permissions.py @@ -0,0 +1,31 @@ +from abc import ABC, abstractmethod +from functools import wraps + +from fastapi import HTTPException +from starlette import status + +from cpf.core.ports.required.dtos import UserDTO + + +class Permission(ABC): + + @classmethod + @abstractmethod + def validate_permission(cls, user: UserDTO) -> bool: + pass + + +def check_permissions(permission_classes: list[type[Permission]]): + def inner(func): + @wraps(func) + def wrapper(*args, **kwargs): + user: UserDTO = kwargs.get("user") + if not user: + raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="User not authenticated") + if not all(permission.validate_permission(user=user) for permission in permission_classes): + raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="User has no permission") + return func(*args, **kwargs) + + return wrapper + + return inner diff --git a/backend/src/cpf/adapters/inbound/rest_api/rest_api.py b/backend/src/cpf/adapters/inbound/rest_api/rest_api.py index a5ff42f0..0d319380 100644 --- a/backend/src/cpf/adapters/inbound/rest_api/rest_api.py +++ b/backend/src/cpf/adapters/inbound/rest_api/rest_api.py @@ -1,14 +1,29 @@ -from fastapi import APIRouter, FastAPI +import os +from typing import Annotated + +from fastapi import APIRouter, Depends, FastAPI +from starlette.requests import Request from cpf.adapters.inbound.rest_api.ion import IonLink -from cpf.adapters.inbound.rest_api.models.responses.core import RootResponse -from cpf.core.ports.provided.services import ManageService, QueryService +from cpf.adapters.inbound.rest_api.models.responses.core import ( + AuthenticatedRootResponse, + UnauthenticatedRootResponse, + UserResponse, +) +from cpf.adapters.inbound.rest_api.utils import env_to_bool, fake_user_factory +from cpf.core.ports.provided.services import ( + ManageService, + QueryService, + UserManagementService, +) +from cpf.core.ports.required.dtos import UserDTO router = APIRouter(prefix="/cpf/api") app = FastAPI() library_manage_service: ManageService | None = None library_query_service: QueryService | None = None +user_management_service: UserManagementService | None = None def set_library_manage_service(service: ManageService): @@ -33,9 +48,47 @@ def get_library_query_service() -> QueryService: return library_query_service -@router.get(path="") -def get_api_root() -> RootResponse: - return RootResponse(get_ladders=IonLink(href="/cpf/api/library/ladders/")) +def set_user_management_service(service: UserManagementService) -> None: + global user_management_service + user_management_service = service + + +def get_user_management_service() -> UserManagementService: + if not user_management_service: + raise RuntimeError("User management service not set") + return user_management_service + + +class FastAPIAuth: + + def __call__(self, request: Request) -> UserDTO: + # TODO Remove after auth will be implemented on frontend + if env_to_bool(os.getenv("USE_MOCK_USER")): + return fake_user_factory() + service_instance: UserManagementService = get_user_management_service() + return service_instance.get_user(access_token=request.cookies.get("access_token")) + + +auth = FastAPIAuth() + + +@router.get(path="", response_model_exclude_none=True) +def get_api_root( + user: Annotated[UserDTO | None, Depends(auth)] +) -> AuthenticatedRootResponse | UnauthenticatedRootResponse: + if not user: + return UnauthenticatedRootResponse( + # TODO Create social auth login redirect + login=IonLink(href="/api/login") + ) + + return AuthenticatedRootResponse( + user=UserResponse( + first_name=user.first_name, + last_name=user.last_name, + ), + get_ladders=IonLink(href="/cpf/api/library/ladders"), + ) @router.get(path="/health") @@ -44,6 +97,8 @@ def health_check(): from cpf.adapters.inbound.rest_api.library.api import router as library_router # noqa +from cpf.adapters.inbound.rest_api.users.api import router as users_router # noqa app.include_router(router=router) app.include_router(router=library_router) +app.include_router(router=users_router) diff --git a/backend/src/cpf/adapters/inbound/rest_api/users/__init__.py b/backend/src/cpf/adapters/inbound/rest_api/users/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/cpf/adapters/inbound/rest_api/users/api.py b/backend/src/cpf/adapters/inbound/rest_api/users/api.py new file mode 100644 index 00000000..13d8c5a8 --- /dev/null +++ b/backend/src/cpf/adapters/inbound/rest_api/users/api.py @@ -0,0 +1,32 @@ +import os +from typing import Annotated + +from fastapi import APIRouter, Depends + +from cpf.adapters.inbound.rest_api.permissions import check_permissions +from cpf.core.ports.provided.services import UserManagementService +from cpf.core.ports.required.dtos import UserDTO + +from ..rest_api import auth, get_user_management_service +from .models.requests import PutUser +from .models.responses import UserResponse + +router = APIRouter(prefix=f"{os.getenv('BASE_URL')}/users") + + +@router.post(path="", response_model_exclude_none=True) +@check_permissions(permission_classes=[]) +def create_new_user( + request: PutUser, + user: Annotated[UserDTO, Depends(auth)], + service: UserManagementService = Depends(get_user_management_service), +) -> UserResponse: + new_user: UserDTO = service.create_new_user( + first_name=request.first_name, last_name=request.last_name, email=request.email + ) + return UserResponse( + username=new_user.username, + email=new_user.email, + first_name=new_user.first_name, + last_name=new_user.last_name, + ) diff --git a/backend/src/cpf/adapters/inbound/rest_api/users/models/__init__.py b/backend/src/cpf/adapters/inbound/rest_api/users/models/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/cpf/adapters/inbound/rest_api/users/models/requests.py b/backend/src/cpf/adapters/inbound/rest_api/users/models/requests.py new file mode 100644 index 00000000..ada7be8e --- /dev/null +++ b/backend/src/cpf/adapters/inbound/rest_api/users/models/requests.py @@ -0,0 +1,7 @@ +from pydantic import BaseModel, EmailStr, Field + + +class PutUser(BaseModel): + first_name: str = Field(..., description="New user first name") + last_name: str = Field(..., description="New user last name") + email: EmailStr = Field(..., description="New user email") diff --git a/backend/src/cpf/adapters/inbound/rest_api/users/models/responses.py b/backend/src/cpf/adapters/inbound/rest_api/users/models/responses.py new file mode 100644 index 00000000..1c58747d --- /dev/null +++ b/backend/src/cpf/adapters/inbound/rest_api/users/models/responses.py @@ -0,0 +1,8 @@ +from cpf.adapters.inbound.rest_api.ion import IonBaseModel + + +class UserResponse(IonBaseModel): + username: str + email: str + first_name: str + last_name: str diff --git a/backend/src/cpf/adapters/inbound/rest_api/utils.py b/backend/src/cpf/adapters/inbound/rest_api/utils.py index 171e6ab8..1346d531 100644 --- a/backend/src/cpf/adapters/inbound/rest_api/utils.py +++ b/backend/src/cpf/adapters/inbound/rest_api/utils.py @@ -3,6 +3,16 @@ from fastapi import FastAPI from starlette.routing import Route +from cpf.core.ports.required.dtos import UserDTO + + +def env_to_bool(value: str) -> bool: + return value.lower() in ("true", "1") + + +def fake_user_factory() -> UserDTO: + return UserDTO(identifier="fake_user@mock.com", first_name="Mock", last_name="John") + class EndpointInfo(TypedDict): method: str | None diff --git a/backend/src/cpf/adapters/outbound/fusionauth/__init__.py b/backend/src/cpf/adapters/outbound/fusionauth/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/cpf/adapters/outbound/fusionauth/client.py b/backend/src/cpf/adapters/outbound/fusionauth/client.py new file mode 100644 index 00000000..2ce73dd3 --- /dev/null +++ b/backend/src/cpf/adapters/outbound/fusionauth/client.py @@ -0,0 +1,56 @@ +import os + +from fastapi import HTTPException +from fusionauth.fusionauth_client import FusionAuthClient +from starlette import status + +from cpf.core.ports.required.clients import AuthenticationClient +from cpf.core.ports.required.readmodels import UserReadModel + + +class FusionAuthAuthenticationClient(AuthenticationClient): + + def __init__(self, client: FusionAuthClient): + self._client = client + + @staticmethod + def _get_user_read_model_from_response(response_data: dict) -> UserReadModel: + user_data = response_data.get("user") + return UserReadModel( + username=user_data.get("username"), + email=user_data.get("email"), + first_name=user_data.get("data").get("first_name"), + last_name=user_data.get("data").get("last_name"), + ) + + def get_user_data(self, access_token: str) -> UserReadModel | None: + fusion_auth_response = self._client.retrieve_user_using_jwt(encoded_jwt=access_token) + if fusion_auth_response.status != status.HTTP_200_OK: + return None + + return self._get_user_read_model_from_response(fusion_auth_response.success_response) + + def create_user(self, email: str, username: str, first_name: str, last_name: str) -> UserReadModel: + user_request = { + "user": { + "email": email, + "username": username, + "password": "dev-use-only", + "data": { + "first_name": first_name, + "last_name": last_name, + }, + } + } + client_response = self._client.create_user(request=user_request, user_id=None) + if not client_response.was_successful(): + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST) + + return self._get_user_read_model_from_response(client_response.success_response) + + +fusion_auth_client = FusionAuthClient(api_key=os.getenv("FUSIONAUTH_API_KEY"), base_url=os.getenv("FUSIONAUTH_URL")) + + +def authentication_client_factory() -> AuthenticationClient: + return FusionAuthAuthenticationClient(client=fusion_auth_client) diff --git a/backend/src/cpf/adapters/outbound/postgres/daos.py b/backend/src/cpf/adapters/outbound/postgres/daos.py index 9cc0cb51..eb59170e 100644 --- a/backend/src/cpf/adapters/outbound/postgres/daos.py +++ b/backend/src/cpf/adapters/outbound/postgres/daos.py @@ -50,7 +50,7 @@ def save(self, uuid: str, serialize_data: dict): serialize_data=serialize_data, ) else: - cursor = self._execute_update(cursor=cursor, ladder_slug=uuid, serialize_data=serialize_data) + cursor = self._execute_update(cursor=cursor, bucket_slug=uuid, serialize_data=serialize_data) conn.commit() def check_if_bucket_exists(self, bucket_slug: str) -> bool: diff --git a/backend/src/cpf/adapters/outbound/postgres/repositories.py b/backend/src/cpf/adapters/outbound/postgres/repositories.py index 8889d590..450429a0 100644 --- a/backend/src/cpf/adapters/outbound/postgres/repositories.py +++ b/backend/src/cpf/adapters/outbound/postgres/repositories.py @@ -16,6 +16,7 @@ PrimitiveDict, ) from cpf.core.domain.aggregates.ladders.aggregate import Ladder +from cpf.core.domain.aggregates.users.aggregate import User from cpf.core.ports.required.writemodels import AR, Repository @@ -164,3 +165,7 @@ def ladder_repository_factory() -> Repository[Ladder]: def bucket_repository_factory() -> Repository[Bucket]: return EventStoreRepository(Bucket, connection_pool) + + +def user_repository_factory() -> Repository[User]: + return EventStoreRepository(User, connection_pool) diff --git a/backend/src/cpf/core/domain/aggregates/users/__init__.py b/backend/src/cpf/core/domain/aggregates/users/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/cpf/core/domain/aggregates/users/aggregate.py b/backend/src/cpf/core/domain/aggregates/users/aggregate.py new file mode 100644 index 00000000..11a984d1 --- /dev/null +++ b/backend/src/cpf/core/domain/aggregates/users/aggregate.py @@ -0,0 +1,44 @@ +from cpf.core.domain.aggregates.aggregate_root import AggregateRoot +from cpf.core.domain.aggregates.domain_event import DomainEvent +from cpf.core.domain.aggregates.users.events import ( + UserCreated, + UserPersonalInformationSet, +) + + +class User(AggregateRoot): + + def __init__(self, id: str): + super().__init__(id) + self.email: str | None = None + self.first_name: str | None = None + self.last_name: str | None = None + + @classmethod + def create_user(cls, user_id: str) -> "User": + instance = cls(id=user_id) + instance.produce_event(UserCreated()) + return instance + + @AggregateRoot.produces_events + def set_personal_information(self, email: str, first_name: str, last_name: str) -> UserPersonalInformationSet: + return UserPersonalInformationSet( + email=email, + first_name=first_name, + last_name=last_name, + ) + + # Handlers + + @AggregateRoot.handles_events(UserCreated) + def _handle_user_created(self, event: UserCreated) -> None: + print(f"User created {self.aggregate_id}") + + @AggregateRoot.handles_events(UserPersonalInformationSet) + def _handle_personal_information_set(self, event: UserPersonalInformationSet): + self.email = event.email + self.first_name = event.first_name + self.last_name = event.last_name + + def handle_event(self, event: DomainEvent) -> None: + raise NotImplementedError("Event not handled") diff --git a/backend/src/cpf/core/domain/aggregates/users/events.py b/backend/src/cpf/core/domain/aggregates/users/events.py new file mode 100644 index 00000000..c5913f17 --- /dev/null +++ b/backend/src/cpf/core/domain/aggregates/users/events.py @@ -0,0 +1,14 @@ +from dataclasses import dataclass + +from cpf.core.domain.aggregates.domain_event import DomainEvent + + +class UserCreated(DomainEvent): + pass + + +@dataclass(frozen=True) +class UserPersonalInformationSet(DomainEvent): + email: str + first_name: str + last_name: str diff --git a/backend/src/cpf/core/domain/services.py b/backend/src/cpf/core/domain/services.py index f8a6ee6c..90aed8da 100644 --- a/backend/src/cpf/core/domain/services.py +++ b/backend/src/cpf/core/domain/services.py @@ -2,10 +2,17 @@ from cpf.core.domain.aggregates.buckets.aggregate import Bucket from cpf.core.domain.aggregates.ladders.aggregate import Ladder +from cpf.core.domain.aggregates.users.aggregate import User from cpf.core.domain.enums import AdvancementLevel, BucketType -from cpf.core.ports.provided.services import ManageService, QueryService +from cpf.core.domain.utils import get_username_from_email +from cpf.core.ports.provided.services import ( + ManageService, + QueryService, + UserManagementService, +) +from cpf.core.ports.required.clients import AuthenticationClient from cpf.core.ports.required.daos import BucketReadModelDao, LadderReadModelDao -from cpf.core.ports.required.dtos import LadderDetailDTO +from cpf.core.ports.required.dtos import LadderDetailDTO, UserDTO from cpf.core.ports.required.readmodels import BucketReadModel, LadderReadModel from cpf.core.ports.required.writemodels import Repository @@ -143,3 +150,51 @@ def get_ladder(self, ladder_slug: str) -> LadderDetailDTO: def get_bucket(self, bucket_slug: str) -> BucketReadModel: return self._bucket_dao.get_bucket(slug=bucket_slug) + + +class FusionAuthUserManagementService(UserManagementService): + + def __init__( + self, + client: AuthenticationClient, + repository: Repository[User], + ) -> None: + self._repository = repository + self._client = client + + def get_user(self, access_token: str | None) -> UserDTO | None: + # Check if access token exists + if not access_token: + return None + # Check if user exists in authentication service + user_data = self._client.get_user_data(access_token=access_token) + if not user_data: + return None + + # Check if user exists in CPF database + # TODO Rebuild to check UserQueryService to see if read model exists + aggregate = self._repository.load(user_data.username) + if not aggregate: + return None + + user_dto = UserDTO( + username=user_data.username, + email=user_data.email, + first_name=user_data.first_name, + last_name=user_data.last_name, + ) + return user_dto + + def create_new_user(self, first_name: str, last_name: str, email: str) -> UserDTO: + username = get_username_from_email(email) + user_data = self._client.create_user( + first_name=first_name, + last_name=last_name, + email=email, + username=username, + ) + aggregate = User.create_user(user_data.username) + aggregate.set_personal_information(email=email, first_name=first_name, last_name=last_name) + self._repository.save(aggregate) + # TODO Save readmodel to dao + return UserDTO(username=username, email=email, first_name=first_name, last_name=last_name) diff --git a/backend/src/cpf/core/domain/utils.py b/backend/src/cpf/core/domain/utils.py index e69de29b..c200f143 100644 --- a/backend/src/cpf/core/domain/utils.py +++ b/backend/src/cpf/core/domain/utils.py @@ -0,0 +1,2 @@ +def get_username_from_email(email: str) -> str: + return email.split("@")[0] diff --git a/backend/src/cpf/core/ports/provided/services.py b/backend/src/cpf/core/ports/provided/services.py index 7be5587e..8a458689 100644 --- a/backend/src/cpf/core/ports/provided/services.py +++ b/backend/src/cpf/core/ports/provided/services.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod -from cpf.core.ports.required.dtos import LadderDetailDTO +from cpf.core.ports.required.dtos import LadderDetailDTO, UserDTO from cpf.core.ports.required.readmodels import BucketReadModel, LadderReadModel @@ -36,3 +36,14 @@ def get_ladder(self, ladder_slug: str) -> LadderDetailDTO: @abstractmethod def get_bucket(self, bucket_slug: str) -> BucketReadModel: pass + + +class UserManagementService(ABC): + + @abstractmethod + def get_user(self, access_token) -> UserDTO | None: + pass + + @abstractmethod + def create_new_user(self, first_name: str, last_name: str, email: str) -> UserDTO: + pass diff --git a/backend/src/cpf/core/ports/required/clients.py b/backend/src/cpf/core/ports/required/clients.py new file mode 100644 index 00000000..117785fc --- /dev/null +++ b/backend/src/cpf/core/ports/required/clients.py @@ -0,0 +1,14 @@ +from abc import ABC, abstractmethod + +from cpf.core.ports.required.readmodels import UserReadModel + + +class AuthenticationClient(ABC): + + @abstractmethod + def get_user_data(self, access_token: str) -> UserReadModel | None: + pass + + @abstractmethod + def create_user(self, email: str, username: str, first_name: str, last_name: str) -> UserReadModel: + pass diff --git a/backend/src/cpf/core/ports/required/dtos.py b/backend/src/cpf/core/ports/required/dtos.py index d45f74be..6a780775 100644 --- a/backend/src/cpf/core/ports/required/dtos.py +++ b/backend/src/cpf/core/ports/required/dtos.py @@ -1,6 +1,14 @@ from dataclasses import dataclass +@dataclass(frozen=True) +class UserDTO: + username: str + email: str + first_name: str + last_name: str + + @dataclass(frozen=True) class LadderDetailDTO: diff --git a/backend/src/cpf/core/ports/required/readmodels.py b/backend/src/cpf/core/ports/required/readmodels.py index 06867567..d29559cb 100644 --- a/backend/src/cpf/core/ports/required/readmodels.py +++ b/backend/src/cpf/core/ports/required/readmodels.py @@ -3,6 +3,14 @@ from cpf.core.domain.enums import BucketType +@dataclass(frozen=True) +class UserReadModel: + username: str + email: str + first_name: str + last_name: str + + @dataclass(frozen=True) class BucketReadModel: @dataclass(frozen=True) diff --git a/backend/src/cpf/main.py b/backend/src/cpf/main.py index b8ae8cea..ca43d21e 100644 --- a/backend/src/cpf/main.py +++ b/backend/src/cpf/main.py @@ -2,12 +2,18 @@ import cpf.adapters.inbound.data_loader.loader as loader import cpf.adapters.inbound.rest_api.rest_api as rest_api +from cpf.adapters.outbound.fusionauth.client import authentication_client_factory from cpf.adapters.outbound.postgres.daos import bucket_dao_factory, ladder_dao_factory from cpf.adapters.outbound.postgres.repositories import ( bucket_repository_factory, ladder_repository_factory, + user_repository_factory, +) +from cpf.core.domain.services import ( + FusionAuthUserManagementService, + LadderManageService, + LibraryQueryService, ) -from cpf.core.domain.services import LadderManageService, LibraryQueryService def rest_api_app(): @@ -22,8 +28,13 @@ def rest_api_app(): ) query_service = LibraryQueryService(ladder_dao=ladder_dao, bucket_dao=bucket_dao) + user_management_service = FusionAuthUserManagementService( + repository=user_repository_factory(), client=authentication_client_factory() + ) + rest_api.set_library_manage_service(library_manage_service) rest_api.set_library_query_service(query_service) + rest_api.set_user_management_service(user_management_service) return rest_api.app @@ -37,8 +48,12 @@ def data_loader(): ladder_dao=ladder_dao, bucket_dao=bucket_dao, ) + user_management_service = FusionAuthUserManagementService( + repository=user_repository_factory(), client=authentication_client_factory() + ) loader.set_manage_service(service=library_manage_service) + loader.set_user_management_service(service=user_management_service) loader.start_data_upload() diff --git a/backend/src/poetry.lock b/backend/src/poetry.lock index d2c656b0..6f87b71b 100644 --- a/backend/src/poetry.lock +++ b/backend/src/poetry.lock @@ -86,6 +86,105 @@ files = [ {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] +[[package]] +name = "charset-normalizer" +version = "3.3.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"}, + {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, + {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, + {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"}, + {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"}, + {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"}, + {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"}, + {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, +] + [[package]] name = "click" version = "8.1.7" @@ -111,6 +210,23 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "deprecated" +version = "1.2.14" +description = "Python @deprecated decorator to deprecate old python classes, functions or methods." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "Deprecated-1.2.14-py2.py3-none-any.whl", hash = "sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c"}, + {file = "Deprecated-1.2.14.tar.gz", hash = "sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3"}, +] + +[package.dependencies] +wrapt = ">=1.10,<2" + +[package.extras] +dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"] + [[package]] name = "dnspython" version = "2.6.1" @@ -197,6 +313,21 @@ Flake8 = ">=5" [package.extras] dev = ["pyTest", "pyTest-cov"] +[[package]] +name = "fusionauth-client" +version = "1.49.1" +description = "A client library for FusionAuth" +optional = false +python-versions = "*" +files = [ + {file = "fusionauth-client-1.49.1.tar.gz", hash = "sha256:05ed65f48374feb389d3c42893536a58e9d3034d3b9b3741fa210afc753984b3"}, + {file = "fusionauth_client-1.49.1-py3-none-any.whl", hash = "sha256:599037f0e099ce39fbd015a4241a426d50dc006ba64c56f2836996100e84953c"}, +] + +[package.dependencies] +deprecated = "*" +requests = "*" + [[package]] name = "gunicorn" version = "21.2.0" @@ -275,13 +406,13 @@ socks = ["socksio (==1.*)"] [[package]] name = "idna" -version = "3.6" +version = "3.7" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, - {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, + {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, + {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] [[package]] @@ -581,6 +712,27 @@ pluggy = ">=0.12,<2.0" [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "requests" +version = "2.31.0" +description = "Python HTTP for Humans." +optional = false +python-versions = ">=3.7" +files = [ + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<3" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + [[package]] name = "sniffio" version = "1.3.1" @@ -631,6 +783,23 @@ files = [ {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, ] +[[package]] +name = "urllib3" +version = "2.2.1" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.8" +files = [ + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +h2 = ["h2 (>=4,<5)"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + [[package]] name = "uvicorn" version = "0.25.0" @@ -649,7 +818,86 @@ h11 = ">=0.8" [package.extras] standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"] +[[package]] +name = "wrapt" +version = "1.16.0" +description = "Module for decorators, wrappers and monkey patching." +optional = false +python-versions = ">=3.6" +files = [ + {file = "wrapt-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ffa565331890b90056c01db69c0fe634a776f8019c143a5ae265f9c6bc4bd6d4"}, + {file = "wrapt-1.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e4fdb9275308292e880dcbeb12546df7f3e0f96c6b41197e0cf37d2826359020"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb2dee3874a500de01c93d5c71415fcaef1d858370d405824783e7a8ef5db440"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2a88e6010048489cda82b1326889ec075a8c856c2e6a256072b28eaee3ccf487"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac83a914ebaf589b69f7d0a1277602ff494e21f4c2f743313414378f8f50a4cf"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:73aa7d98215d39b8455f103de64391cb79dfcad601701a3aa0dddacf74911d72"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:807cc8543a477ab7422f1120a217054f958a66ef7314f76dd9e77d3f02cdccd0"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bf5703fdeb350e36885f2875d853ce13172ae281c56e509f4e6eca049bdfb136"}, + {file = "wrapt-1.16.0-cp310-cp310-win32.whl", hash = "sha256:f6b2d0c6703c988d334f297aa5df18c45e97b0af3679bb75059e0e0bd8b1069d"}, + {file = "wrapt-1.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:decbfa2f618fa8ed81c95ee18a387ff973143c656ef800c9f24fb7e9c16054e2"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1a5db485fe2de4403f13fafdc231b0dbae5eca4359232d2efc79025527375b09"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:75ea7d0ee2a15733684badb16de6794894ed9c55aa5e9903260922f0482e687d"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a452f9ca3e3267cd4d0fcf2edd0d035b1934ac2bd7e0e57ac91ad6b95c0c6389"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:43aa59eadec7890d9958748db829df269f0368521ba6dc68cc172d5d03ed8060"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72554a23c78a8e7aa02abbd699d129eead8b147a23c56e08d08dfc29cfdddca1"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d2efee35b4b0a347e0d99d28e884dfd82797852d62fcd7ebdeee26f3ceb72cf3"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6dcfcffe73710be01d90cae08c3e548d90932d37b39ef83969ae135d36ef3956"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:eb6e651000a19c96f452c85132811d25e9264d836951022d6e81df2fff38337d"}, + {file = "wrapt-1.16.0-cp311-cp311-win32.whl", hash = "sha256:66027d667efe95cc4fa945af59f92c5a02c6f5bb6012bff9e60542c74c75c362"}, + {file = "wrapt-1.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:aefbc4cb0a54f91af643660a0a150ce2c090d3652cf4052a5397fb2de549cd89"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:5eb404d89131ec9b4f748fa5cfb5346802e5ee8836f57d516576e61f304f3b7b"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9090c9e676d5236a6948330e83cb89969f433b1943a558968f659ead07cb3b36"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94265b00870aa407bd0cbcfd536f17ecde43b94fb8d228560a1e9d3041462d73"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f2058f813d4f2b5e3a9eb2eb3faf8f1d99b81c3e51aeda4b168406443e8ba809"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98b5e1f498a8ca1858a1cdbffb023bfd954da4e3fa2c0cb5853d40014557248b"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:49aac49dc4782cb04f58986e81ea0b4768e4ff197b57324dcbd7699c5dfb40b9"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:418abb18146475c310d7a6dc71143d6f7adec5b004ac9ce08dc7a34e2babdc5c"}, + {file = "wrapt-1.16.0-cp312-cp312-win32.whl", hash = "sha256:685f568fa5e627e93f3b52fda002c7ed2fa1800b50ce51f6ed1d572d8ab3e7fc"}, + {file = "wrapt-1.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:dcdba5c86e368442528f7060039eda390cc4091bfd1dca41e8046af7c910dda8"}, + {file = "wrapt-1.16.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d462f28826f4657968ae51d2181a074dfe03c200d6131690b7d65d55b0f360f8"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a33a747400b94b6d6b8a165e4480264a64a78c8a4c734b62136062e9a248dd39"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3646eefa23daeba62643a58aac816945cadc0afaf21800a1421eeba5f6cfb9c"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ebf019be5c09d400cf7b024aa52b1f3aeebeff51550d007e92c3c1c4afc2a40"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:1acd723ee2a8826f3d53910255643e33673e1d11db84ce5880675954183ec47e"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:bc57efac2da352a51cc4658878a68d2b1b67dbe9d33c36cb826ca449d80a8465"}, + {file = "wrapt-1.16.0-cp36-cp36m-win32.whl", hash = "sha256:da4813f751142436b075ed7aa012a8778aa43a99f7b36afe9b742d3ed8bdc95e"}, + {file = "wrapt-1.16.0-cp36-cp36m-win_amd64.whl", hash = "sha256:6f6eac2360f2d543cc875a0e5efd413b6cbd483cb3ad7ebf888884a6e0d2e966"}, + {file = "wrapt-1.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a0ea261ce52b5952bf669684a251a66df239ec6d441ccb59ec7afa882265d593"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bd2d7ff69a2cac767fbf7a2b206add2e9a210e57947dd7ce03e25d03d2de292"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9159485323798c8dc530a224bd3ffcf76659319ccc7bbd52e01e73bd0241a0c5"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a86373cf37cd7764f2201b76496aba58a52e76dedfaa698ef9e9688bfd9e41cf"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:73870c364c11f03ed072dda68ff7aea6d2a3a5c3fe250d917a429c7432e15228"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:b935ae30c6e7400022b50f8d359c03ed233d45b725cfdd299462f41ee5ffba6f"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:db98ad84a55eb09b3c32a96c576476777e87c520a34e2519d3e59c44710c002c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win32.whl", hash = "sha256:9153ed35fc5e4fa3b2fe97bddaa7cbec0ed22412b85bcdaf54aeba92ea37428c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win_amd64.whl", hash = "sha256:66dfbaa7cfa3eb707bbfcd46dab2bc6207b005cbc9caa2199bcbc81d95071a00"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1dd50a2696ff89f57bd8847647a1c363b687d3d796dc30d4dd4a9d1689a706f0"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:44a2754372e32ab315734c6c73b24351d06e77ffff6ae27d2ecf14cf3d229202"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e9723528b9f787dc59168369e42ae1c3b0d3fadb2f1a71de14531d321ee05b0"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbed418ba5c3dce92619656802cc5355cb679e58d0d89b50f116e4a9d5a9603e"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:941988b89b4fd6b41c3f0bfb20e92bd23746579736b7343283297c4c8cbae68f"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6a42cd0cfa8ffc1915aef79cb4284f6383d8a3e9dcca70c445dcfdd639d51267"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1ca9b6085e4f866bd584fb135a041bfc32cab916e69f714a7d1d397f8c4891ca"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5e49454f19ef621089e204f862388d29e6e8d8b162efce05208913dde5b9ad6"}, + {file = "wrapt-1.16.0-cp38-cp38-win32.whl", hash = "sha256:c31f72b1b6624c9d863fc095da460802f43a7c6868c5dda140f51da24fd47d7b"}, + {file = "wrapt-1.16.0-cp38-cp38-win_amd64.whl", hash = "sha256:490b0ee15c1a55be9c1bd8609b8cecd60e325f0575fc98f50058eae366e01f41"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9b201ae332c3637a42f02d1045e1d0cccfdc41f1f2f801dafbaa7e9b4797bfc2"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2076fad65c6736184e77d7d4729b63a6d1ae0b70da4868adeec40989858eb3fb"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5cd603b575ebceca7da5a3a251e69561bec509e0b46e4993e1cac402b7247b8"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b47cfad9e9bbbed2339081f4e346c93ecd7ab504299403320bf85f7f85c7d46c"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8212564d49c50eb4565e502814f694e240c55551a5f1bc841d4fcaabb0a9b8a"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5f15814a33e42b04e3de432e573aa557f9f0f56458745c2074952f564c50e664"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db2e408d983b0e61e238cf579c09ef7020560441906ca990fe8412153e3b291f"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:edfad1d29c73f9b863ebe7082ae9321374ccb10879eeabc84ba3b69f2579d537"}, + {file = "wrapt-1.16.0-cp39-cp39-win32.whl", hash = "sha256:ed867c42c268f876097248e05b6117a65bcd1e63b779e916fe2e33cd6fd0d3c3"}, + {file = "wrapt-1.16.0-cp39-cp39-win_amd64.whl", hash = "sha256:eb1b046be06b0fce7249f1d025cd359b4b80fc1c3e24ad9eca33e0dcdb2e4a35"}, + {file = "wrapt-1.16.0-py3-none-any.whl", hash = "sha256:6906c4100a8fcbf2fa735f6059214bb13b97f75b1a61777fcf6432121ef12ef1"}, + {file = "wrapt-1.16.0.tar.gz", hash = "sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d"}, +] + [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "ebca2b7ca2f5219421f700179fbf098e5f23b77380ac30bde1a41e9a78ff3d66" +content-hash = "1fc5d5db12d054a59a69ec61c101aa98a471a2ab0974108a3624b88e2a2706e0" diff --git a/backend/src/pyproject.toml b/backend/src/pyproject.toml index db2f89ba..5e5b603e 100644 --- a/backend/src/pyproject.toml +++ b/backend/src/pyproject.toml @@ -14,6 +14,7 @@ uvicorn = "^0.25.0" gunicorn = "^21.2.0" psycopg2 = "^2.9.9" psycopg = "^3.1.16" +fusionauth-client = "1.49.1" [tool.poetry.group.dev] optional = true diff --git a/docker-compose.yml b/docker-compose.yml index 4a02ce1b..e822df51 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - '3000:3000' api-server: + image: cpf/backend-image restart: unless-stopped build: context: ./backend @@ -46,6 +47,7 @@ services: tty: true data_loader: + image: cpf/backend-image restart: no build: context: ./backend @@ -55,6 +57,9 @@ services: - .env volumes: - ./backend/src:/src + depends_on: + fusionauth: + condition: service_healthy stdin_open: true tty: true @@ -95,6 +100,11 @@ services: depends_on: postgres: condition: service_healthy + healthcheck: + test: curl --silent --fail http://localhost:9011/api/status -o /dev/null -w "%{http_code}" + interval: 5s + timeout: 5s + retries: 5 volumes: - fusionauth_config:/usr/local/fusionauth/config - ./fusionauth/kickstart:/usr/local/fusionauth/kickstart diff --git a/fusionauth/kickstart/kickstart.json b/fusionauth/kickstart/kickstart.json index 05537f24..3e82fdd0 100644 --- a/fusionauth/kickstart/kickstart.json +++ b/fusionauth/kickstart/kickstart.json @@ -1,6 +1,7 @@ { "variables": { - "apiKey": "00c24029-e66a-43f2-9000-544e90e8d46e", + "apiKey": "#{ENV.FUSIONAUTH_API_KEY}", + "applicationId": "#{ENV.FUSIONAUTH_APPLICATION_ID}", "adminEmail": "admin@example.com", "adminPassword": "password" }, @@ -32,6 +33,31 @@ } } }, + { + "method": "POST", + "url": "/api/application/#{applicationId}", + "body": { + "application": { + "name": "CPF", + "roles": [ + { + "name": "admin" + }, + { + "name": "manager" + }, + { + "name": "user" + } + ], + "loginConfiguration": { + "requireAuthentication": false, + "generateRefreshTokens": true, + "allowTokenRefresh": true + } + } + } + }, { "method": "PATCH", "url": "/api/system-configuration",