From 7a53d2839414545022fa34f4c89a382cadb6b23f Mon Sep 17 00:00:00 2001 From: devinleighsmith <41091511+devinleighsmith@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:24:16 -0800 Subject: [PATCH 1/2] =?UTF-8?q?split=20off=20geoserver=20functionality=20i?= =?UTF-8?q?nto=20a=20microservice=20-=20update=20docker=E2=80=A6=20(#4427)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * split off geoserver functionality into a microservice - update docker and ci/cd to support. * updates to proxy appsettings and dockerfile. * dockerfile proxy corrections. * code review corrections. * revert change to dev ci-cd pipeline. * revert changes to api-dotnetcore * correction * update tokens.jwt library. * remove unused service. --------- Co-authored-by: Smith --- .github/workflows/api-dotnetcore.yml | 52 ++- .github/workflows/ci-cd-pims-dev.yml | 5 +- .github/workflows/ci-cd-pims-master.yml | 142 -------- .github/workflows/uat_hotfix.yml | 2 + .github/workflows/uat_pre_release_hotfix.yml | 3 + docker-compose.yml | 25 ++ source/backend/.s2i/environment | 1 - source/backend/Dockerfile | 7 +- source/backend/Dockerfile.proxy | 32 ++ .../Controllers/AcquisitionFileController.cs | 4 +- .../Controllers/AgreementController.cs | 6 +- .../Controllers/ChecklistController.cs | 6 +- .../Controllers/InterestHolderController.cs | 4 +- .../Controllers/SearchController.cs | 6 +- .../Controllers/AccessRequestController.cs | 4 +- .../Admin/Controllers/ClaimController.cs | 4 +- .../Controllers/FinancialCodeController.cs | 4 +- .../Areas/Admin/Controllers/RoleController.cs | 4 +- .../Areas/Admin/Controllers/UserController.cs | 4 +- .../Controllers/AutocompleteController.cs | 6 +- .../CompensationRequisitionController.cs | 6 +- .../Contacts/Controllers/SearchController.cs | 7 +- .../Controllers/ChecklistController.cs | 6 +- .../Controllers/DispositionFileController.cs | 6 +- .../Controllers/SearchController.cs | 6 +- .../api/Areas/Documents/DocumentController.cs | 7 +- .../DocumentRelationshipController.cs | 6 +- .../ExpropriationPaymentController.cs | 6 +- .../FinancialCodes/FinancialCodeController.cs | 4 +- .../FormDocument/FormDocumentController.cs | 6 +- .../HistoricalNumberController.cs | 4 +- .../Controllers/AccessRequestController.cs | 4 +- .../Keycloak/Controllers/UserController.cs | 4 +- .../Controllers/ConsultationController.cs | 6 +- .../Leases/Controllers/InsuranceController.cs | 4 +- .../Leases/Controllers/LeaseController.cs | 6 +- .../Controllers/LeasePaymentController.cs | 4 +- .../Controllers/LeasePeriodController.cs | 4 +- .../Controllers/LeaseRenewalController.cs | 4 +- .../Controllers/LeaseStakeholderController.cs | 4 +- .../PropertyImprovementController.cs | 4 +- .../Controllers/PropertyLeaseController.cs | 4 +- .../Leases/Controllers/SearchController.cs | 6 +- .../Controllers/SecurityDepositController.cs | 6 +- .../SecurityDepositReturnController.cs | 6 +- .../Areas/Notes/Controllers/NoteController.cs | 4 +- .../Controllers/OrganizationController.cs | 4 +- .../Persons/Controllers/PersonController.cs | 4 +- .../Products/Controllers/ProductController.cs | 4 +- .../Projects/Controllers/ProjectController.cs | 6 +- .../Projects/Controllers/SearchController.cs | 4 +- .../Controllers/PropertyActivityController.cs | 6 +- .../Controllers/PropertyContactController.cs | 6 +- .../Controllers/PropertyController.cs | 4 +- .../PropertyManagementController.cs | 4 +- .../PropertyOperationController.cs | 4 +- .../Property/Controllers/SearchController.cs | 6 +- .../PropertyOperationController.cs | 4 +- .../Controllers/AcquisitionController.cs | 6 +- .../Controllers/DispositionController.cs | 6 +- .../Reports/Controllers/LeaseController.cs | 6 +- .../Reports/Controllers/PropertyController.cs | 7 +- .../Reports/Controllers/UserController.cs | 6 +- .../Controllers/ResearchFileController.cs | 7 +- .../Research/Controllers/SearchController.cs | 6 +- .../Areas/Takes/Controllers/TakeController.cs | 6 +- .../Tools/Controllers/GeocoderController.cs | 4 +- .../Areas/Tools/Controllers/LtsaController.cs | 4 +- .../Controllers/AccessRequestController.cs | 2 +- .../api/Controllers/SyncMayanController.cs | 4 +- .../api/Helpers/ConfigurationExtensions.cs | 18 -- .../Helpers/Extensions/ExceptionExtensions.cs | 2 +- .../Helpers/Extensions/PrincipalExtensions.cs | 2 +- .../Middleware/ErrorHandlingMiddleware.cs | 2 +- source/backend/api/Pims.Api.csproj | 21 +- source/backend/{ => api}/Pims.sln | 75 +++-- .../api/Properties/launchSettings.json | 2 +- .../Repositories/Cdogs/CdogsAuthRepository.cs | 2 +- .../Repositories/Mayan/MayanAuthRepository.cs | 2 +- .../api/Services/AcquisitionFileService.cs | 5 +- .../api/Services/CompReqFinancialService.cs | 2 +- .../CompensationRequisitionService.cs | 4 +- source/backend/api/Services/ContactService.cs | 4 +- .../api/Services/DispositionFileService.cs | 4 +- .../api/Services/DocumentFileService.cs | 6 +- .../api/Services/DocumentGenerationService.cs | 4 +- .../backend/api/Services/DocumentService.cs | 6 +- .../api/Services/DocumentSyncService.cs | 4 +- .../Services/ExpropriationPaymentService.cs | 2 +- .../api/Services/FinancialCodeService.cs | 4 +- .../api/Services/FormDocumentService.cs | 4 +- .../api/Services/H120CategoryService.cs | 4 +- .../api/Services/LeasePeriodService.cs | 4 +- .../api/Services/LeaseReportsService.cs | 2 +- source/backend/api/Services/LeaseService.cs | 4 +- source/backend/api/Services/NoteService.cs | 4 +- .../api/Services/OrganizationService.cs | 2 +- source/backend/api/Services/PersonService.cs | 2 +- source/backend/api/Services/ProjectService.cs | 2 +- .../api/Services/PropertyOperationService.cs | 7 +- .../backend/api/Services/PropertyService.cs | 4 +- .../api/Services/ResearchFileService.cs | 2 +- .../Services/SecurityDepositReturnService.cs | 4 +- .../api/Services/SecurityDepositService.cs | 4 +- source/backend/api/Services/TakeService.cs | 4 +- source/backend/api/Startup.cs | 10 +- source/backend/api/appsettings.Docker.json | 83 +++++ source/backend/api/appsettings.Local.json | 5 - source/backend/api/appsettings.json | 5 - .../Exceptions/ApiHttpRequestException.cs | 2 +- .../Exceptions/AuthenticationException.cs | 2 +- .../Exceptions/BadRequestException.cs | 2 +- .../core.api/Handlers/LoggingHandler.cs | 38 +++ .../Helpers/ConfigurationExtensions.cs | 30 ++ .../Helpers}/ConfigureSwaggerForOpenApi.cs | 2 +- .../Helpers}/LoggerExtensions.cs | 2 +- .../Helpers}/SwaggerDefaultValues.cs | 2 +- .../Helpers}/SwaggerDocumentFilter.cs | 0 .../Middleware/LogRequestMiddleware.cs | 2 +- .../Middleware/LogResponseMiddleware.cs | 2 +- .../Middleware/ResponseTimeMiddleware.cs | 2 +- source/backend/core.api/Pims.Core.Api.csproj | 28 ++ .../Policies/HasPermissionAttribute.cs | 4 +- .../Policies/PermissionFilter.cs | 6 +- .../core.api/Properties/launchSettings.json | 12 + .../Exceptions/NotAuthorizedException.cs | 2 +- .../backend/core/Extensions/EnumExtensions.cs | 20 +- .../core/Extensions/IdentityExtensions.cs | 201 +++++++++++- source/backend/core/Pims.Core.csproj | 2 +- .../{dal => core}/Security/Permissions.cs | 2 +- .../dal.keycloak/PimsKeycloakService.cs | 2 +- .../Helpers/Extensions/EntityExtensions.cs | 2 +- .../dal/Helpers/Extensions/EnumExtensions.cs | 2 +- .../Helpers/Extensions/IdentityExtensions.cs | 245 -------------- .../Extensions/OrganizationExtensions.cs | 40 +++ .../Extensions/PropertyViewExtensions.cs | 2 +- .../dal/Helpers/Extensions/UserExtensions.cs | 2 +- .../Repositories/AccessRequestRepository.cs | 5 +- .../dal/Repositories/ClaimRepository.cs | 3 +- .../CompReqFinancialRepository.cs | 6 +- .../dal/Repositories/ContactRepository.cs | 2 +- .../dal/Repositories/DocumentRepository.cs | 2 +- .../Repositories/H120CategoryRepository.cs | 4 +- .../dal/Repositories/LeaseRepository.cs | 2 +- .../Repositories/OrganizationRepository.cs | 2 +- .../dal/Repositories/PersonRepository.cs | 2 +- .../dal/Repositories/ProjectRepository.cs | 2 +- .../Repositories/PropertyContactRepository.cs | 2 +- .../Repositories/PropertyLeaseRepository.cs | 3 +- .../dal/Repositories/PropertyRepository.cs | 2 +- .../dal/Repositories/RoleRepository.cs | 4 +- .../dal/Repositories/UserRepository.cs | 2 +- source/backend/entrypoint.proxy.sh | 4 + source/backend/proxy/.dockerignore | 18 ++ source/backend/proxy/.editorconfig | 257 +++++++++++++++ source/backend/proxy/.gitignore | 55 ++++ .../Configuration/GeoserverProxyOptions.cs | 0 .../proxy/Configuration/ProgramOptions.cs | 51 +++ .../Controllers/PimsGeoserverController.cs | 12 +- source/backend/proxy/Directory.Build.props | 40 +++ source/backend/proxy/Pims.Proxy.csproj | 54 ++++ source/backend/proxy/Program.cs | 84 +++++ .../proxy/Properties/launchSettings.json | 27 ++ source/backend/proxy/Proxy.sln | 102 ++++++ source/backend/proxy/README.md | 54 ++++ source/backend/proxy/Startup.cs | 306 ++++++++++++++++++ .../proxy/appsettings.Development.json | 35 ++ source/backend/proxy/appsettings.Docker.json | 53 +++ source/backend/proxy/appsettings.Local.json | 53 +++ source/backend/proxy/appsettings.Test.json | 26 ++ source/backend/proxy/appsettings.Uat.json | 26 ++ source/backend/proxy/appsettings.json | 78 +++++ source/backend/proxy/omnisharp.json | 5 + source/backend/proxy/tests/.editorconfig | 72 +++++ source/backend/proxy/tests/.gitignore | 49 +++ .../backend/proxy/tests/Directory.Build.props | 9 + source/backend/tests/core/ControllerHelper.cs | 2 +- source/backend/tests/core/DatabaseHelper.cs | 2 +- source/backend/tests/core/PimsAssert.cs | 4 +- source/backend/tests/core/PrincipalHelper.cs | 2 +- source/backend/tests/core/ServiceHelper.cs | 2 +- .../api/Controllers/AccessControllerTest.cs | 2 +- .../Acquisition/AcquisitionControllerTest.cs | 2 +- .../Acquisition/AgreementControllerTest.cs | 2 +- .../Acquisition/ChecklistControllerTest.cs | 4 +- .../InterestHolderControllerTest.cs | 2 +- .../Admin/AccessRequestControllerTest.cs | 2 +- .../Admin/FinancialCodeControllerTest.cs | 2 +- .../Controllers/Admin/UserControllerTest.cs | 2 +- .../Contacts/SearchControllerTest.cs | 4 +- .../Disposition/ChecklistControllerTest.cs | 4 +- .../Disposition/DispositionControllerTest.cs | 2 +- .../Disposition/SearchControllerTest.cs | 2 +- .../Document/DocumentControllerTest.cs | 4 +- .../FinancialCodeControllerTest.cs | 2 +- .../Forms/FormDocumentControllerTest.cs | 4 +- .../H120CategoryControllerTest.cs | 2 +- .../Keycloak/AccessRequestControllerTest.cs | 2 +- .../Keycloak/UserControllerTest.cs | 2 +- .../Leases/ConsultationControllerTest.cs | 4 +- .../Controllers/Leases/LeaseControllerTest.cs | 2 +- .../Leases/LeaseImprovementControllerTest.cs | 2 +- .../Leases/LeasePaymentControllerTest.cs | 2 +- .../Leases/LeasePeriodControllerTest.cs | 2 +- .../Leases/LeaseStakeholderControllerTest.cs | 2 +- .../Leases/SearchControllerTest.cs | 4 +- .../api/Controllers/LookupControllerTest.cs | 2 +- .../Controllers/Note/NoteControllerTest.cs | 2 +- .../OrganizationControllerTest.cs | 2 +- .../Projects/ProjectControllerTest.cs | 4 +- .../Projects/SearchControllerTest.cs | 2 +- .../Property/PropertyControllerTest.cs | 2 +- .../Property/SearchControllerTest.cs | 2 +- .../PropertyOperationControllerTest.cs | 2 +- .../Reports/LeaseControllerTest.cs | 11 +- .../Reports/PropertyControllerTest.cs | 4 +- .../Controllers/Reports/UserControllerTest.cs | 4 +- .../Research/ResearchControllerTest.cs | 4 +- .../Controllers/Takes/TakeControllerTest.cs | 4 +- .../Tools/GeocoderControllerTest.cs | 2 +- .../Controllers/Tools/LtsaControllerTest.cs | 2 +- .../Exceptions/ApiHttpRequestExceptionTest.cs | 6 +- .../api/Helpers/ExceptionExtensionsTest.cs | 2 +- .../api/Helpers/PrincipalExtensionsTest.cs | 1 + .../Acquisition/AcquisitionControllerTest.cs | 2 +- .../Admin/AccessRequestControllerTest.cs | 2 +- .../Keycloak/AccessRequestControllerTest.cs | 2 +- .../api/Routes/Notes/NoteControllerTest.cs | 2 +- .../Routes/Property/PropertyControllerTest.cs | 2 +- .../Routes/Property/SearchControllerTest.cs | 2 +- .../Routes/Reports/PropertyControllerTest.cs | 2 +- .../Routes/Tools/GeocoderControllerTest.cs | 2 +- .../Services/AcquisitionFileServiceTest.cs | 4 +- .../Services/CompReqFinancialServiceTest.cs | 3 +- .../CompensationRequisitionServiceTest.cs | 4 +- .../Services/DispositionFileServiceTest.cs | 4 +- .../api/Services/DocumentFileServiceTest.cs | 5 +- .../unit/api/Services/DocumentServiceTest.cs | 4 +- .../api/Services/DocumentSyncServiceTest.cs | 2 +- .../ExpropriationPaymentServiceTest.cs | 3 +- .../api/Services/FinancialCodeServiceTest.cs | 2 +- .../api/Services/FormDocumentServiceTest.cs | 3 +- .../api/Services/H120CategoryServiceTest.cs | 2 +- .../api/Services/LeasePeriodServiceTest.cs | 2 +- .../api/Services/LeaseReportsServiceTest.cs | 3 +- .../unit/api/Services/LeaseServiceTest.cs | 2 +- .../unit/api/Services/NoteServiceTest.cs | 3 +- .../unit/api/Services/PaymentServiceTest.cs | 2 +- .../unit/api/Services/ProjectServiceTest.cs | 2 +- .../Services/PropertyOperationServiceTest.cs | 2 +- .../unit/api/Services/PropertyServiceTest.cs | 4 +- .../api/Services/ResearchFileServiceTest.cs | 3 +- .../unit/api/Services/TakeServiceTest.cs | 2 +- .../Converters/JsonEnumValueConverterTest.cs | 2 +- .../unit/dal/Core/Helpers/CsvHelperTest.cs | 2 +- .../Exceptions/NotAuthorizedExceptionTest.cs | 3 +- .../Extensions/EntityExtensionsTest.cs | 3 +- .../Keycloak/PimsKeycloakUserServiceTest.cs | 3 +- .../AccessRequestRepositoryTest.cs | 3 +- .../AcquisitionFileChecklistRepositoryTest.cs | 2 +- .../AcquisitionFileDocumentRepositoryTest.cs | 2 +- .../AcquisitionFileFormRepositoryTest.cs | 2 +- .../AcquisitionFilePropertyRepositoryTest.cs | 2 +- .../Repositories/AcquisitionRepositoryTest.cs | 2 +- .../Repositories/AgreementRepositoryTest.cs | 2 +- .../BusinessFunctionCodeRepositoryTest.cs | 2 +- .../ChartOfAccountsCodeRepositoryTest.cs | 2 +- .../CompReqFinancialRepositoryTest.cs | 3 +- .../ConsultationRepositoryTest.cs | 2 +- .../dal/Repositories/ContactRepositoryTest.cs | 3 +- .../CostTypeCodeRepositoryTest.cs | 2 +- .../DispositionFileChecklistRepositoryTest.cs | 2 +- .../DispositionFileDocumentRepositoryTest.cs | 2 +- .../DispositionFilePropertyRepositoryTest.cs | 2 +- .../DispositionFileRepositoryTest.cs | 2 +- .../Repositories/DocumentRepositoryTest.cs | 3 +- .../ExpropriationPaymentRepositoryTest.cs | 2 +- .../FinancialActivityCodeRepositoryTest.cs | 2 +- .../H120CategoryRepositoryTest.cs | 3 +- .../InterestHolderRepositoryTest.cs | 2 +- .../dal/Repositories/LeaseRepositoryTest.cs | 2 +- .../dal/Repositories/NoteRepositoryTest.cs | 2 +- .../OrganizationRepositoryTest.cs | 2 +- .../dal/Repositories/PersonRepositoryTest.cs | 2 +- .../dal/Repositories/ProductRepositoryTest.cs | 2 +- .../dal/Repositories/ProjectRepositoryTest.cs | 3 +- .../PropertyActivityDocumentRepositoryTest.cs | 2 +- .../PropertyActivityRepositoryTest.cs | 2 +- .../PropertyOperationRepositoryTest.cs | 2 +- .../Repositories/PropertyRepositoryTest.cs | 2 +- .../Repositories/ProvinceRepositoryTest.cs | 2 +- .../ResearchFileDocumentRepositoryTest.cs | 2 +- .../ResearchFilePropertyRepositoryTest.cs | 2 +- .../Repositories/ResearchRepositoryTest.cs | 2 +- .../ResponsibilityCodeRepositoryTest.cs | 2 +- .../dal/Repositories/RoleRepositoryTest.cs | 3 +- .../dal/Repositories/TakeRepositoryTest.cs | 2 +- .../dal/Repositories/UserRepositoryTest.cs | 3 +- .../WorkActivityCodeRepositoryTest.cs | 2 +- .../YearlyFinancialCodeRepositoryTest.cs | 2 +- .../Repositories/ContactRepositoryTest.cs | 2 +- source/frontend/src/mocks/msw/handlers.ts | 11 +- source/frontend/src/setupProxy.js | 43 --- source/frontend/vite.config.ts | 2 +- 304 files changed, 2496 insertions(+), 951 deletions(-) delete mode 100644 .github/workflows/ci-cd-pims-master.yml delete mode 100644 source/backend/.s2i/environment create mode 100644 source/backend/Dockerfile.proxy rename source/backend/{ => api}/Pims.sln (86%) create mode 100644 source/backend/api/appsettings.Docker.json rename source/backend/{api/Helpers => core.api}/Exceptions/ApiHttpRequestException.cs (98%) rename source/backend/{api/Helpers => core.api}/Exceptions/AuthenticationException.cs (97%) rename source/backend/{api/Helpers => core.api}/Exceptions/BadRequestException.cs (97%) create mode 100644 source/backend/core.api/Handlers/LoggingHandler.cs create mode 100644 source/backend/core.api/Helpers/ConfigurationExtensions.cs rename source/backend/{api/Helpers/Swagger => core.api/Helpers}/ConfigureSwaggerForOpenApi.cs (98%) rename source/backend/{api/Helpers/Logging => core.api/Helpers}/LoggerExtensions.cs (96%) rename source/backend/{api/Helpers/Swagger => core.api/Helpers}/SwaggerDefaultValues.cs (98%) rename source/backend/{api/Helpers/Swagger => core.api/Helpers}/SwaggerDocumentFilter.cs (100%) rename source/backend/{api/Helpers => core.api}/Middleware/LogRequestMiddleware.cs (98%) rename source/backend/{api/Helpers => core.api}/Middleware/LogResponseMiddleware.cs (98%) rename source/backend/{api/Helpers => core.api}/Middleware/ResponseTimeMiddleware.cs (97%) create mode 100644 source/backend/core.api/Pims.Core.Api.csproj rename source/backend/{api => core.api}/Policies/HasPermissionAttribute.cs (96%) rename source/backend/{api => core.api}/Policies/PermissionFilter.cs (96%) create mode 100644 source/backend/core.api/Properties/launchSettings.json rename source/backend/{dal => core}/Exceptions/NotAuthorizedException.cs (98%) rename source/backend/{dal => core}/Security/Permissions.cs (99%) delete mode 100644 source/backend/dal/Helpers/Extensions/IdentityExtensions.cs create mode 100644 source/backend/dal/Helpers/Extensions/OrganizationExtensions.cs create mode 100644 source/backend/entrypoint.proxy.sh create mode 100644 source/backend/proxy/.dockerignore create mode 100644 source/backend/proxy/.editorconfig create mode 100644 source/backend/proxy/.gitignore rename source/backend/{api => proxy}/Configuration/GeoserverProxyOptions.cs (100%) create mode 100644 source/backend/proxy/Configuration/ProgramOptions.cs rename source/backend/{api => proxy}/Controllers/PimsGeoserverController.cs (91%) create mode 100644 source/backend/proxy/Directory.Build.props create mode 100644 source/backend/proxy/Pims.Proxy.csproj create mode 100644 source/backend/proxy/Program.cs create mode 100644 source/backend/proxy/Properties/launchSettings.json create mode 100644 source/backend/proxy/Proxy.sln create mode 100644 source/backend/proxy/README.md create mode 100644 source/backend/proxy/Startup.cs create mode 100644 source/backend/proxy/appsettings.Development.json create mode 100644 source/backend/proxy/appsettings.Docker.json create mode 100644 source/backend/proxy/appsettings.Local.json create mode 100644 source/backend/proxy/appsettings.Test.json create mode 100644 source/backend/proxy/appsettings.Uat.json create mode 100644 source/backend/proxy/appsettings.json create mode 100644 source/backend/proxy/omnisharp.json create mode 100644 source/backend/proxy/tests/.editorconfig create mode 100644 source/backend/proxy/tests/.gitignore create mode 100644 source/backend/proxy/tests/Directory.Build.props delete mode 100644 source/frontend/src/setupProxy.js diff --git a/.github/workflows/api-dotnetcore.yml b/.github/workflows/api-dotnetcore.yml index a21a58c2f2..0249fc5f72 100644 --- a/.github/workflows/api-dotnetcore.yml +++ b/.github/workflows/api-dotnetcore.yml @@ -24,12 +24,16 @@ jobs: build-backend: needs: check-changes - if: ${{ needs.check-changes.outputs.backend == 'true' }} runs-on: ubuntu-latest + if: ${{ needs.check-changes.outputs.backend == 'true' }} + strategy: + matrix: + services: [{directory: ./source/backend/api, solution: 'Pims.sln'}, {directory: ./source/backend/proxy, solution: 'Proxy.sln'}] env: - working-directory: ./source/backend + working-directory: ${{ matrix.services.directory }} + solution-name: ${{ matrix.services.solution }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GIT_BRANCH: "${{github.ref}}" + GIT_BRANCH: "${{ github.ref }}" steps: - uses: actions/checkout@v4 @@ -45,19 +49,20 @@ jobs: dotnet-version: "8.0.x" - name: Install dependencies - run: dotnet restore + run: dotnet restore ${{env.solution-name}} working-directory: ${{env.working-directory}} - - name: Install coverlet for code coverage - run: dotnet tool install -g coverlet.console --version 1.7.2 + - name: Build + run: dotnet build ${{env.solution-name}} --configuration Release --no-restore working-directory: ${{env.working-directory}} - - name: Build - run: dotnet build --configuration Release --no-restore + - name: Install coverlet for code coverage + run: dotnet tool install -g coverlet.console --version 1.7.2 working-directory: ${{env.working-directory}} - name: Test - run: dotnet test --no-restore --verbosity normal + if: ${{ env.solution-name == 'Pims.sln' }} + run: dotnet test Pims.sln --no-restore --verbosity normal working-directory: ${{env.working-directory}} # For future reference, if we have N test projects the flow of events would be: @@ -84,33 +89,41 @@ jobs: # # The final `coverage.opencover.xml` is the one we want - name: Generate code coverage - working-directory: ${{env.working-directory}}/tests/unit + if: ${{ env.solution-name == 'Pims.sln' }} + working-directory: ${{env.working-directory}}/../tests/unit run: | + pwd mkdir -p TestResults rm -rf api/TestResults rm -rf dal/TestResults rm -rf mockdal/TestResults cd api - dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore + dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore > out.txt + ls + cat out.txt mv TestResults/*/* ../TestResults/ cd .. cd dal dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore + ls mv TestResults/*/* ../TestResults/ cd .. cd mockdal dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore + ls mv TestResults/*/* ../TestResults/ cd .. head TestResults/coverage.opencover.xml - name: Save PR number and scan results + if: ${{ env.solution-name == 'Pims.sln' }} run: | mkdir -p ./pr echo ${{ github.event.pull_request.number }} > ./pr/NR - cp ${{env.working-directory}}/tests/unit/TestResults/coverage.opencover.xml ./pr + cp ${{env.working-directory}}/../tests/unit/TestResults/coverage.opencover.xml ./pr - uses: actions/upload-artifact@v4 + if: ${{ env.solution-name == 'Pims.sln' }} with: name: pr-codecov path: pr/ @@ -118,12 +131,12 @@ jobs: - name: SonarScanner for .NET 8 with pull request decoration support id: scan uses: highbyte/sonarscan-dotnet@v2.3.2 - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && env.solution-name == 'Pims.sln' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: - dotnetBuildArguments: ${{env.working-directory}} - dotnetTestArguments: ${{env.working-directory}} --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover + dotnetBuildArguments: ${{env.working-directory}}/${{ env.solution-name }} + dotnetTestArguments: ${{env.working-directory}}/${{ env.solution-name }} --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover # Optional extra command arguments the the SonarScanner 'begin' command sonarBeginArguments: /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx" -d:sonar.qualitygate.wait=true # The key of the SonarQube project @@ -132,7 +145,14 @@ jobs: sonarProjectName: PIMS-API # The SonarQube server URL. For SonarCloud, skip this setting. sonarHostname: ${{secrets.SONAR_URL}} - + post-build: + needs: build-backend + runs-on: ubuntu-latest + env: + working-directory: ./source/backend + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GIT_BRANCH: "${{github.ref}}" + steps: # Send notifications only if MS_TEAMS_NOTIFY_URL secret has been set - name: Failure notification to Teams Channel env: diff --git a/.github/workflows/ci-cd-pims-dev.yml b/.github/workflows/ci-cd-pims-dev.yml index c30e40a654..ec16c3d1e1 100644 --- a/.github/workflows/ci-cd-pims-dev.yml +++ b/.github/workflows/ci-cd-pims-dev.yml @@ -24,7 +24,6 @@ env: TAG_DEV: "dev" TAG_TEST: "test" TAG_PROD: "prod" - on: pull_request_target: branches: [dev] @@ -78,9 +77,10 @@ jobs: openshift_token: ${{ env.OPENSHIFT_TOKEN }} insecure_skip_tls_verify: true namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }} - - name: Call script to build backend (pims-api) + - name: Call script to build backend services run: | ./openshift/4.0/player.sh build api -apply + ./openshift/4.0/player.sh build proxy -apply deploy: name: Deploy frontend and api to OpenShift @@ -99,6 +99,7 @@ jobs: - name: call scripts to deploy api and frontend run: | ./openshift/4.0/player.sh deploy api $DESTINATION -apply + ./openshift/4.0/player.sh deploy proxy $DESTINATION -apply ./openshift/4.0/player.sh deploy app $DESTINATION -apply oc tag mayan-bcgov:latest-$DESTINATION mayan-bcgov:$DESTINATION diff --git a/.github/workflows/ci-cd-pims-master.yml b/.github/workflows/ci-cd-pims-master.yml deleted file mode 100644 index f5ba8f044a..0000000000 --- a/.github/workflows/ci-cd-pims-master.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: CI-CD PIMS UAT Development -env: - OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }} - # service account: gitaction - OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} - OPENSHIFT_TOOLS_NAMESPACE: "3cd915-tools" - MS_TEAMS_WEBHOOK_BUILD_CHANNEL: ${{ secrets.MS_TEAMS_WEBHOOK_URI_BUILD_CHANNEL }} - - ## variables for scripts under git\openshift\4.0\scripts\oc-*.sh - APP_PORT: 8080 - DESTINATION: "uat" - OC_JOB_NAME: "master" - GIT_URL: "${{github.server_url}}/${{github.repository}}" - GIT_BRANCH: "master" - APP_NAME: "pims" - PROJ_PREFIX: "3cd915" - PROJ_TOOLS: "3cd915-tools" - PROJ_DEV: "dev" - PROJ_TEST: "test" - PROJ_PROD: "prod" - TAG_DEV: "dev" - TAG_TEST: "test" - TAG_PROD: "prod" - INSTANCE: "-uat" - NAMESPACE_OVERRIDE: "3cd915-test" - -on: workflow_dispatch - -jobs: - ci-cd-start-notification: - name: CI-CD Start Notification to Teams Channel - runs-on: ubuntu-latest - steps: - - name: Start notification to Teams Channel - uses: dragos-cojocari/ms-teams-notification@v1.0.2 - with: - github-token: ${{ github.token }} - ms-teams-webhook-uri: ${{ env.MS_TEAMS_WEBHOOK_BUILD_CHANNEL }} - notification-summary: PIMS CI-CD GitHub Action STARTED in UAT - notification-color: 17a2b8 - timezone: America/Los_Angeles - - build-frontend: - name: Build frontend - needs: ci-cd-start-notification - runs-on: ubuntu-latest - steps: - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - ref: master - - name: Login to OpenShift - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ env.OPENSHIFT_SERVER }} - openshift_token: ${{ env.OPENSHIFT_TOKEN }} - insecure_skip_tls_verify: true - namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }} - - name: Call script to build frontend (pims-app and pims-app-base) - run: | - ./openshift/4.0/player.sh build app-base -apply - ./openshift/4.0/player.sh build app -apply - - build-api: - name: Build api - needs: ci-cd-start-notification - runs-on: ubuntu-latest - steps: - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - ref: master - - name: Login to OpenShift - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ env.OPENSHIFT_SERVER }} - openshift_token: ${{ env.OPENSHIFT_TOKEN }} - insecure_skip_tls_verify: true - namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }} - - name: Call script to build backend (pims-api) - run: | - ./openshift/4.0/player.sh build api -apply - - tag-images: - name: Tag frontend and api images with version number - needs: [build-frontend, build-api] - runs-on: ubuntu-latest - steps: - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - ref: master - - name: Fetch Tags - run: git fetch --unshallow --tags - - name: Login to OpenShift - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ env.OPENSHIFT_SERVER }} - openshift_token: ${{ env.OPENSHIFT_TOKEN }} - insecure_skip_tls_verify: true - namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }} - - name: call script to tag frontend and api images with version number - run: | - ./openshift/4.0/scripts/oc-tag.sh $DESTINATION - - deploy: - name: Deploy frontend and api to OpenShift - needs: [build-frontend, build-api] - runs-on: ubuntu-latest - steps: - - name: Checkout Source Code - uses: actions/checkout@v4 - with: - ref: master - - name: Login to OpenShift - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ env.OPENSHIFT_SERVER }} - openshift_token: ${{ env.OPENSHIFT_TOKEN }} - insecure_skip_tls_verify: true - namespace: ${{ env.OPENSHIFT_TOOLS_NAMESPACE }} - - name: call scripts to deploy api and frontend - run: | - ./openshift/4.0/player.sh deploy api $DESTINATION -apply - ./openshift/4.0/player.sh deploy app $DESTINATION -apply - - ci-cd-end-notification: - name: CI-CD End Notification to Teams Channel - runs-on: ubuntu-latest - needs: deploy - steps: - - name: check workflow status - uses: martialonline/workflow-status@v4 - id: check - - name: End notification to Teams Channel - uses: dragos-cojocari/ms-teams-notification@v1.0.2 - with: - github-token: ${{ github.token }} - ms-teams-webhook-uri: ${{ env.MS_TEAMS_WEBHOOK_BUILD_CHANNEL }} - notification-summary: PIMS CI-CD GitHub Action COMPLETED in UAT environment with status ${{ steps.check.outputs.status }} - notification-color: 17a2b8 - timezone: America/Los_Angeles diff --git a/.github/workflows/uat_hotfix.yml b/.github/workflows/uat_hotfix.yml index 598d473fac..366df8bd37 100644 --- a/.github/workflows/uat_hotfix.yml +++ b/.github/workflows/uat_hotfix.yml @@ -80,6 +80,7 @@ jobs: - name: Call script to build backend (pims-api) run: | ./openshift/4.0/player.sh build api -apply + ./openshift/4.0/player.sh build proxy -apply deploy: name: Deploy frontend and api to OpenShift @@ -98,6 +99,7 @@ jobs: - name: call scripts to deploy api and frontend run: | ./openshift/4.0/player.sh deploy api $DESTINATION -apply + ./openshift/4.0/player.sh deploy proxy $DESTINATION -apply ./openshift/4.0/player.sh deploy app $DESTINATION -apply # the command: diff --git a/.github/workflows/uat_pre_release_hotfix.yml b/.github/workflows/uat_pre_release_hotfix.yml index b4f270c31b..2713184f32 100644 --- a/.github/workflows/uat_pre_release_hotfix.yml +++ b/.github/workflows/uat_pre_release_hotfix.yml @@ -106,6 +106,7 @@ jobs: - name: Call script to build backend (pims-api) run: | OC_JOB_NAME=${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh build api -apply + OC_JOB_NAME=${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh build proxy -apply deploy: name: Deploy frontend and api to OpenShift @@ -124,6 +125,7 @@ jobs: - name: call scripts to deploy api and frontend run: | RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy api $DESTINATION -apply + RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy proxy $DESTINATION -apply RELEASE_TAG=latest-${{github.event.inputs.HOTFIX_BRANCH}} && ./openshift/4.0/player.sh deploy app $DESTINATION -apply # the command: @@ -212,6 +214,7 @@ jobs: VERSION=$(make version) oc tag pims-app:uat pims-app:v${VERSION}-master oc tag pims-api:uat pims-api:v${VERSION}-master + oc tag pims-proxy:uat pims-api:v${VERSION}-master ci-cd-end-notification: if: always() diff --git a/docker-compose.yml b/docker-compose.yml index 4c7ab2ccf0..da85dba690 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,8 @@ services: args: BUILD_CONFIGURATION: Debug env_file: source/backend/api/.env + environment: + - ASPNETCORE_ENVIRONMENT=Docker ports: - ${API_HTTPS_PORT:-5001}:443 - ${API_HTTP_PORT:-5000}:8080 @@ -67,6 +69,29 @@ services: networks: - psp + ####################### Proxy ####################### + proxy: + profiles: + - all + - psp + restart: on-failure:1 + container_name: psp-proxy + build: + context: source/backend + dockerfile: Dockerfile.proxy + args: + BUILD_CONFIGURATION: Debug + env_file: source/backend/proxy/.env + environment: + - ASPNETCORE_ENVIRONMENT=Docker + ports: + - ${PROXY_HTTPS_PORT:-5003}:443 + - ${PROXY_HTTP_PORT:-5002}:8080 + depends_on: + - geoserver + networks: + - psp + ####################### Frontend ####################### frontend: profiles: diff --git a/source/backend/.s2i/environment b/source/backend/.s2i/environment deleted file mode 100644 index 03ee0f8957..0000000000 --- a/source/backend/.s2i/environment +++ /dev/null @@ -1 +0,0 @@ -DOTNET_STARTUP_PROJECT=api/Pims.Api.csproj diff --git a/source/backend/Dockerfile b/source/backend/Dockerfile index d972bedba6..b62370980f 100644 --- a/source/backend/Dockerfile +++ b/source/backend/Dockerfile @@ -1,12 +1,12 @@ ARG BUILD_CONFIGURATION=Release FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app -EXPOSE 443 8080 +EXPOSE 5001 5000 # Copy csproj and restore as distinct layers FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src -COPY *.sln . +COPY api/*.sln api/ COPY Directory.Build.props . COPY api/*.csproj api/ COPY apimodels/*.csproj apimodels/ @@ -20,6 +20,7 @@ COPY dal.keycloak/*.csproj dal.keycloak/ COPY keycloak/*.csproj keycloak/ COPY geocoder/*.csproj geocoder/ COPY core/*.csproj core/ +COPY core.api/*.csproj core.api/ COPY ltsa/*.csproj ltsa/ COPY clamav/*.csproj clamav/ @@ -38,6 +39,6 @@ RUN dotnet publish "Pims.Api.csproj" -c "$BUILD_CONFIGURATION" -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY entrypoint.sh . +COPY api/entrypoint.sh . RUN chmod +x /app/entrypoint.sh ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/source/backend/Dockerfile.proxy b/source/backend/Dockerfile.proxy new file mode 100644 index 0000000000..31ea2b9931 --- /dev/null +++ b/source/backend/Dockerfile.proxy @@ -0,0 +1,32 @@ +ARG BUILD_CONFIGURATION=Release +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +WORKDIR /app +EXPOSE 5001 5000 + +# Copy csproj and restore as distinct layers +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src +COPY proxy proxy/ +COPY proxy/Directory.Build.props proxy/ +COPY api api/ +COPY core core/ +COPY core.api core.api/ +COPY keycloak keycloak/ +COPY proxy/*.csproj proxy/ + +RUN dotnet restore proxy/Proxy.sln +ENV PATH="$PATH:/root/.dotnet/tools" +# Copy everything else and build +WORKDIR /src/proxy +RUN dotnet build "Pims.Proxy.csproj" -c "$BUILD_CONFIGURATION" -o /app/build + +FROM build AS publish +RUN dotnet publish "Pims.Proxy.csproj" -c "$BUILD_CONFIGURATION" -o /app/publish + +# Runtime image +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +COPY entrypoint.proxy.sh . +RUN chmod +x /app/entrypoint.proxy.sh +ENTRYPOINT ["/app/entrypoint.proxy.sh"] diff --git a/source/backend/api/Areas/Acquisition/Controllers/AcquisitionFileController.cs b/source/backend/api/Areas/Acquisition/Controllers/AcquisitionFileController.cs index c5059edb0f..8938e9e55a 100644 --- a/source/backend/api/Areas/Acquisition/Controllers/AcquisitionFileController.cs +++ b/source/backend/api/Areas/Acquisition/Controllers/AcquisitionFileController.cs @@ -8,13 +8,13 @@ using Pims.Api.Models; using Pims.Api.Models.Concepts.AcquisitionFile; using Pims.Api.Models.Concepts.ExpropriationPayment; -using Pims.Api.Policies; using Pims.Api.Services; +using Pims.Core.Api.Policies; using Pims.Core.Extensions; using Pims.Core.Json; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Acquisition.Controllers diff --git a/source/backend/api/Areas/Acquisition/Controllers/AgreementController.cs b/source/backend/api/Areas/Acquisition/Controllers/AgreementController.cs index 05b14bd907..2aaaf79f0a 100644 --- a/source/backend/api/Areas/Acquisition/Controllers/AgreementController.cs +++ b/source/backend/api/Areas/Acquisition/Controllers/AgreementController.cs @@ -4,13 +4,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; using Pims.Api.Models.Concepts.AcquisitionFile; -using Pims.Api.Policies; using Pims.Api.Services; +using Pims.Core.Api.Exceptions; +using Pims.Core.Api.Policies; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Acquisition.Controllers diff --git a/source/backend/api/Areas/Acquisition/Controllers/ChecklistController.cs b/source/backend/api/Areas/Acquisition/Controllers/ChecklistController.cs index 73265a5bac..269b3b074f 100644 --- a/source/backend/api/Areas/Acquisition/Controllers/ChecklistController.cs +++ b/source/backend/api/Areas/Acquisition/Controllers/ChecklistController.cs @@ -2,13 +2,13 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; using Pims.Api.Models.Concepts.AcquisitionFile; using Pims.Api.Models.Concepts.File; -using Pims.Api.Policies; using Pims.Api.Services; +using Pims.Core.Api.Exceptions; +using Pims.Core.Api.Policies; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Acquisition.Controllers diff --git a/source/backend/api/Areas/Acquisition/Controllers/InterestHolderController.cs b/source/backend/api/Areas/Acquisition/Controllers/InterestHolderController.cs index 247b87110e..195b93b31c 100644 --- a/source/backend/api/Areas/Acquisition/Controllers/InterestHolderController.cs +++ b/source/backend/api/Areas/Acquisition/Controllers/InterestHolderController.cs @@ -4,10 +4,10 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Models; using Pims.Api.Models.Concepts.InterestHolder; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Acquisition.Controllers diff --git a/source/backend/api/Areas/Acquisition/Controllers/SearchController.cs b/source/backend/api/Areas/Acquisition/Controllers/SearchController.cs index e24f742915..f2edd21e96 100644 --- a/source/backend/api/Areas/Acquisition/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Acquisition/Controllers/SearchController.cs @@ -8,16 +8,16 @@ namespace Pims.Api.Areas.Acquisition.Controllers using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Areas.Acquisition.Models.Search; - using Pims.Api.Helpers.Exceptions; + using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.AcquisitionFile; - using Pims.Api.Policies; + using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities.Models; - using Pims.Dal.Security; + using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; /// diff --git a/source/backend/api/Areas/Admin/Controllers/AccessRequestController.cs b/source/backend/api/Areas/Admin/Controllers/AccessRequestController.cs index 84da375c97..f04a067f5d 100644 --- a/source/backend/api/Areas/Admin/Controllers/AccessRequestController.cs +++ b/source/backend/api/Areas/Admin/Controllers/AccessRequestController.cs @@ -3,10 +3,10 @@ using Pims.Api.Models; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.AccessRequest; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; using EModel = Pims.Dal.Entities.Models; using Entity = Pims.Dal.Entities; diff --git a/source/backend/api/Areas/Admin/Controllers/ClaimController.cs b/source/backend/api/Areas/Admin/Controllers/ClaimController.cs index c508d9b0d6..0c4e464ec1 100644 --- a/source/backend/api/Areas/Admin/Controllers/ClaimController.cs +++ b/source/backend/api/Areas/Admin/Controllers/ClaimController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Claim; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Admin.Controllers diff --git a/source/backend/api/Areas/Admin/Controllers/FinancialCodeController.cs b/source/backend/api/Areas/Admin/Controllers/FinancialCodeController.cs index b0666781fb..2e03230f18 100644 --- a/source/backend/api/Areas/Admin/Controllers/FinancialCodeController.cs +++ b/source/backend/api/Areas/Admin/Controllers/FinancialCodeController.cs @@ -2,11 +2,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.FinancialCode; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Admin.Controllers diff --git a/source/backend/api/Areas/Admin/Controllers/RoleController.cs b/source/backend/api/Areas/Admin/Controllers/RoleController.cs index b26b8bc93c..679330d35e 100644 --- a/source/backend/api/Areas/Admin/Controllers/RoleController.cs +++ b/source/backend/api/Areas/Admin/Controllers/RoleController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Role; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Admin.Controllers diff --git a/source/backend/api/Areas/Admin/Controllers/UserController.cs b/source/backend/api/Areas/Admin/Controllers/UserController.cs index 6f0a9ebe18..4669e33ba0 100644 --- a/source/backend/api/Areas/Admin/Controllers/UserController.cs +++ b/source/backend/api/Areas/Admin/Controllers/UserController.cs @@ -4,12 +4,12 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.User; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Admin.Controllers diff --git a/source/backend/api/Areas/Autocomplete/Controllers/AutocompleteController.cs b/source/backend/api/Areas/Autocomplete/Controllers/AutocompleteController.cs index 6004a79400..c9b723aae0 100644 --- a/source/backend/api/Areas/Autocomplete/Controllers/AutocompleteController.cs +++ b/source/backend/api/Areas/Autocomplete/Controllers/AutocompleteController.cs @@ -4,12 +4,12 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Areas.Autocomplete.Models; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Autocomplete.Controllers diff --git a/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs b/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs index fc368cd332..0248f787b7 100644 --- a/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs +++ b/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs @@ -4,17 +4,17 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.AcquisitionFile; using Pims.Api.Models.Concepts.CompensationRequisition; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.CompensationRequisition.Controllers diff --git a/source/backend/api/Areas/Contacts/Controllers/SearchController.cs b/source/backend/api/Areas/Contacts/Controllers/SearchController.cs index 4ece351922..7c0a4a6407 100644 --- a/source/backend/api/Areas/Contacts/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Contacts/Controllers/SearchController.cs @@ -5,15 +5,16 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Areas.Contact.Models.Search; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Contact; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services.Interfaces; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Areas.Contact.Controllers { diff --git a/source/backend/api/Areas/Disposition/Controllers/ChecklistController.cs b/source/backend/api/Areas/Disposition/Controllers/ChecklistController.cs index 0587a22ce6..af993497d6 100644 --- a/source/backend/api/Areas/Disposition/Controllers/ChecklistController.cs +++ b/source/backend/api/Areas/Disposition/Controllers/ChecklistController.cs @@ -2,13 +2,13 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.DispositionFile; using Pims.Api.Models.Concepts.File; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Disposition.Controllers diff --git a/source/backend/api/Areas/Disposition/Controllers/DispositionFileController.cs b/source/backend/api/Areas/Disposition/Controllers/DispositionFileController.cs index 2a249191f5..19943fe016 100644 --- a/source/backend/api/Areas/Disposition/Controllers/DispositionFileController.cs +++ b/source/backend/api/Areas/Disposition/Controllers/DispositionFileController.cs @@ -5,15 +5,15 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.DispositionFile; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Disposition.Controllers diff --git a/source/backend/api/Areas/Disposition/Controllers/SearchController.cs b/source/backend/api/Areas/Disposition/Controllers/SearchController.cs index ad9a59ed4f..6dd591c8ba 100644 --- a/source/backend/api/Areas/Disposition/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Disposition/Controllers/SearchController.cs @@ -6,16 +6,16 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Areas.Disposition.Models.Search; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.DispositionFile; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Disposition.Controllers diff --git a/source/backend/api/Areas/Documents/DocumentController.cs b/source/backend/api/Areas/Documents/DocumentController.cs index 81a6064546..1b4a2563d2 100644 --- a/source/backend/api/Areas/Documents/DocumentController.cs +++ b/source/backend/api/Areas/Documents/DocumentController.cs @@ -4,17 +4,16 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; - using Pims.Api.Models.Mayan; using Pims.Api.Models.Mayan.Document; using Pims.Api.Models.Requests.Document.UpdateMetadata; using Pims.Api.Models.Requests.Http; -using Pims.Api.Policies; using Pims.Api.Services; +using Pims.Core.Api.Exceptions; +using Pims.Core.Api.Policies; using Pims.Core.Exceptions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Controllers diff --git a/source/backend/api/Areas/Documents/DocumentRelationshipController.cs b/source/backend/api/Areas/Documents/DocumentRelationshipController.cs index e58747614f..5202ab1026 100644 --- a/source/backend/api/Areas/Documents/DocumentRelationshipController.cs +++ b/source/backend/api/Areas/Documents/DocumentRelationshipController.cs @@ -4,15 +4,15 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.Document; using Pims.Api.Models.Requests.Document.Upload; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Controllers diff --git a/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs b/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs index 794acce65a..92628121ad 100644 --- a/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs +++ b/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs @@ -3,13 +3,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.ExpropriationPayment; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.ExpropriationPayment diff --git a/source/backend/api/Areas/FinancialCodes/FinancialCodeController.cs b/source/backend/api/Areas/FinancialCodes/FinancialCodeController.cs index d2aa3dd27e..646fc902d5 100644 --- a/source/backend/api/Areas/FinancialCodes/FinancialCodeController.cs +++ b/source/backend/api/Areas/FinancialCodes/FinancialCodeController.cs @@ -2,10 +2,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.FinancialCode; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Controllers diff --git a/source/backend/api/Areas/FormDocument/FormDocumentController.cs b/source/backend/api/Areas/FormDocument/FormDocumentController.cs index a68f8d2728..736d35e464 100644 --- a/source/backend/api/Areas/FormDocument/FormDocumentController.cs +++ b/source/backend/api/Areas/FormDocument/FormDocumentController.cs @@ -3,13 +3,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.FormDocument; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Controllers diff --git a/source/backend/api/Areas/HistoricalNumber/HistoricalNumberController.cs b/source/backend/api/Areas/HistoricalNumber/HistoricalNumberController.cs index 9f2e1f38db..c89d13eb60 100644 --- a/source/backend/api/Areas/HistoricalNumber/HistoricalNumberController.cs +++ b/source/backend/api/Areas/HistoricalNumber/HistoricalNumberController.cs @@ -5,12 +5,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.HistoricalNumber.Controllers diff --git a/source/backend/api/Areas/Keycloak/Controllers/AccessRequestController.cs b/source/backend/api/Areas/Keycloak/Controllers/AccessRequestController.cs index e9cda2d23d..609f0f5e17 100644 --- a/source/backend/api/Areas/Keycloak/Controllers/AccessRequestController.cs +++ b/source/backend/api/Areas/Keycloak/Controllers/AccessRequestController.cs @@ -2,10 +2,10 @@ using MapsterMapper; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.AccessRequest; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Keycloak; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; using Entity = Pims.Dal.Entities; diff --git a/source/backend/api/Areas/Keycloak/Controllers/UserController.cs b/source/backend/api/Areas/Keycloak/Controllers/UserController.cs index 3a2bd84da3..8712c8cd2f 100644 --- a/source/backend/api/Areas/Keycloak/Controllers/UserController.cs +++ b/source/backend/api/Areas/Keycloak/Controllers/UserController.cs @@ -3,10 +3,10 @@ using MapsterMapper; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.User; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Json; using Pims.Dal.Keycloak; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; using Entity = Pims.Dal.Entities; diff --git a/source/backend/api/Areas/Leases/Controllers/ConsultationController.cs b/source/backend/api/Areas/Leases/Controllers/ConsultationController.cs index 6d496b7a32..fa0b95d9af 100644 --- a/source/backend/api/Areas/Leases/Controllers/ConsultationController.cs +++ b/source/backend/api/Areas/Leases/Controllers/ConsultationController.cs @@ -5,13 +5,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/InsuranceController.cs b/source/backend/api/Areas/Leases/Controllers/InsuranceController.cs index 2355a37f41..c1112fbf27 100644 --- a/source/backend/api/Areas/Leases/Controllers/InsuranceController.cs +++ b/source/backend/api/Areas/Leases/Controllers/InsuranceController.cs @@ -6,12 +6,12 @@ using Microsoft.Extensions.Logging; using Pims.Api.Areas.Lease.Controllers; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Leases.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/LeaseController.cs b/source/backend/api/Areas/Leases/Controllers/LeaseController.cs index b87b883309..21321863d7 100644 --- a/source/backend/api/Areas/Leases/Controllers/LeaseController.cs +++ b/source/backend/api/Areas/Leases/Controllers/LeaseController.cs @@ -5,15 +5,15 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.File; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/LeasePaymentController.cs b/source/backend/api/Areas/Leases/Controllers/LeasePaymentController.cs index bc48bd0ea9..b620fa8b28 100644 --- a/source/backend/api/Areas/Leases/Controllers/LeasePaymentController.cs +++ b/source/backend/api/Areas/Leases/Controllers/LeasePaymentController.cs @@ -4,12 +4,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/LeasePeriodController.cs b/source/backend/api/Areas/Leases/Controllers/LeasePeriodController.cs index d33d8504a1..10e875c328 100644 --- a/source/backend/api/Areas/Leases/Controllers/LeasePeriodController.cs +++ b/source/backend/api/Areas/Leases/Controllers/LeasePeriodController.cs @@ -5,12 +5,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/LeaseRenewalController.cs b/source/backend/api/Areas/Leases/Controllers/LeaseRenewalController.cs index 1db5a597f4..e3cfd37d7c 100644 --- a/source/backend/api/Areas/Leases/Controllers/LeaseRenewalController.cs +++ b/source/backend/api/Areas/Leases/Controllers/LeaseRenewalController.cs @@ -6,11 +6,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/LeaseStakeholderController.cs b/source/backend/api/Areas/Leases/Controllers/LeaseStakeholderController.cs index b4fac9ce8e..f462da383b 100644 --- a/source/backend/api/Areas/Leases/Controllers/LeaseStakeholderController.cs +++ b/source/backend/api/Areas/Leases/Controllers/LeaseStakeholderController.cs @@ -5,11 +5,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/PropertyImprovementController.cs b/source/backend/api/Areas/Leases/Controllers/PropertyImprovementController.cs index 6b0bc66ade..f8f8d21525 100644 --- a/source/backend/api/Areas/Leases/Controllers/PropertyImprovementController.cs +++ b/source/backend/api/Areas/Leases/Controllers/PropertyImprovementController.cs @@ -5,11 +5,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/PropertyLeaseController.cs b/source/backend/api/Areas/Leases/Controllers/PropertyLeaseController.cs index 3acaca556a..ee9f916bdf 100644 --- a/source/backend/api/Areas/Leases/Controllers/PropertyLeaseController.cs +++ b/source/backend/api/Areas/Leases/Controllers/PropertyLeaseController.cs @@ -5,11 +5,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/SearchController.cs b/source/backend/api/Areas/Leases/Controllers/SearchController.cs index 79b2dee718..9ba979a98e 100644 --- a/source/backend/api/Areas/Leases/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Leases/Controllers/SearchController.cs @@ -5,16 +5,16 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Pims.Api.Areas.Lease.Models.Search; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Lease; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/SecurityDepositController.cs b/source/backend/api/Areas/Leases/Controllers/SecurityDepositController.cs index fa8dff37f5..1f861e772d 100644 --- a/source/backend/api/Areas/Leases/Controllers/SecurityDepositController.cs +++ b/source/backend/api/Areas/Leases/Controllers/SecurityDepositController.cs @@ -4,14 +4,14 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Deposit; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Leases/Controllers/SecurityDepositReturnController.cs b/source/backend/api/Areas/Leases/Controllers/SecurityDepositReturnController.cs index c958b5d397..ef066317ad 100644 --- a/source/backend/api/Areas/Leases/Controllers/SecurityDepositReturnController.cs +++ b/source/backend/api/Areas/Leases/Controllers/SecurityDepositReturnController.cs @@ -3,14 +3,14 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Deposit; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Notes/Controllers/NoteController.cs b/source/backend/api/Areas/Notes/Controllers/NoteController.cs index 30e03e860d..64736d84e8 100644 --- a/source/backend/api/Areas/Notes/Controllers/NoteController.cs +++ b/source/backend/api/Areas/Notes/Controllers/NoteController.cs @@ -4,10 +4,10 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Constants; using Pims.Api.Models.Concepts.Note; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Notes.Controllers diff --git a/source/backend/api/Areas/Organizations/Controllers/OrganizationController.cs b/source/backend/api/Areas/Organizations/Controllers/OrganizationController.cs index 096eb9807d..63b1fe72a5 100644 --- a/source/backend/api/Areas/Organizations/Controllers/OrganizationController.cs +++ b/source/backend/api/Areas/Organizations/Controllers/OrganizationController.cs @@ -3,12 +3,12 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.Organization; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Organizations.Controllers diff --git a/source/backend/api/Areas/Persons/Controllers/PersonController.cs b/source/backend/api/Areas/Persons/Controllers/PersonController.cs index 22a7c8ba73..e3927baf4f 100644 --- a/source/backend/api/Areas/Persons/Controllers/PersonController.cs +++ b/source/backend/api/Areas/Persons/Controllers/PersonController.cs @@ -3,12 +3,12 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.Person; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Persons.Controllers diff --git a/source/backend/api/Areas/Products/Controllers/ProductController.cs b/source/backend/api/Areas/Products/Controllers/ProductController.cs index 52ef630a32..7120d8f17e 100644 --- a/source/backend/api/Areas/Products/Controllers/ProductController.cs +++ b/source/backend/api/Areas/Products/Controllers/ProductController.cs @@ -3,10 +3,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.AcquisitionFile; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Projects.Controllers diff --git a/source/backend/api/Areas/Projects/Controllers/ProjectController.cs b/source/backend/api/Areas/Projects/Controllers/ProjectController.cs index aced1ea4b5..683ec1b4b3 100644 --- a/source/backend/api/Areas/Projects/Controllers/ProjectController.cs +++ b/source/backend/api/Areas/Projects/Controllers/ProjectController.cs @@ -3,15 +3,15 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Product; using Pims.Api.Models.Concepts.Project; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Json; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Projects.Controllers diff --git a/source/backend/api/Areas/Projects/Controllers/SearchController.cs b/source/backend/api/Areas/Projects/Controllers/SearchController.cs index 0b4ea92dfa..8be2fac94a 100644 --- a/source/backend/api/Areas/Projects/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Projects/Controllers/SearchController.cs @@ -6,11 +6,11 @@ using Pims.Api.Areas.Projects.Models; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Project; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Projects.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyActivityController.cs b/source/backend/api/Areas/Property/Controllers/PropertyActivityController.cs index 86657c9d14..37909e8bcc 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyActivityController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyActivityController.cs @@ -2,14 +2,14 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs b/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs index f1d9ee08e6..7f61e57a04 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs @@ -2,13 +2,13 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyController.cs b/source/backend/api/Areas/Property/Controllers/PropertyController.cs index dd567c16a9..42475cb076 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyController.cs @@ -3,11 +3,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyManagementController.cs b/source/backend/api/Areas/Property/Controllers/PropertyManagementController.cs index e4a10db84e..708d394477 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyManagementController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyManagementController.cs @@ -2,10 +2,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyOperationController.cs b/source/backend/api/Areas/Property/Controllers/PropertyOperationController.cs index 0a77703e6a..fe4796efd6 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyOperationController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyOperationController.cs @@ -4,10 +4,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Concepts.PropertyOperation; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/SearchController.cs b/source/backend/api/Areas/Property/Controllers/SearchController.cs index fc78a64166..0699b1c23d 100644 --- a/source/backend/api/Areas/Property/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Property/Controllers/SearchController.cs @@ -5,14 +5,14 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Areas.Property.Models.Search; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.Property; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Property.Controllers diff --git a/source/backend/api/Areas/PropertyOperation/Controllers/PropertyOperationController.cs b/source/backend/api/Areas/PropertyOperation/Controllers/PropertyOperationController.cs index 3d1bd4045d..a6f4159d95 100644 --- a/source/backend/api/Areas/PropertyOperation/Controllers/PropertyOperationController.cs +++ b/source/backend/api/Areas/PropertyOperation/Controllers/PropertyOperationController.cs @@ -7,11 +7,11 @@ using Microsoft.Extensions.Logging; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.PropertyOperation; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.PropertyOperation.Controllers diff --git a/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs b/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs index c0debd780b..4bd9eb441f 100644 --- a/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs +++ b/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs @@ -8,14 +8,14 @@ using Pims.Api.Areas.Reports.Models.Acquisition; using Pims.Api.Areas.Reports.Models.Agreement; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Helpers.Reporting; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Reports.Controllers diff --git a/source/backend/api/Areas/Reports/Controllers/DispositionController.cs b/source/backend/api/Areas/Reports/Controllers/DispositionController.cs index 33ebcfa3cc..c82d97be38 100644 --- a/source/backend/api/Areas/Reports/Controllers/DispositionController.cs +++ b/source/backend/api/Areas/Reports/Controllers/DispositionController.cs @@ -5,14 +5,14 @@ using Microsoft.Extensions.Logging; using Pims.Api.Areas.Disposition.Models.Search; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Helpers.Reporting; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Reports.Controllers diff --git a/source/backend/api/Areas/Reports/Controllers/LeaseController.cs b/source/backend/api/Areas/Reports/Controllers/LeaseController.cs index 61f0bf4908..5a7dde92b1 100644 --- a/source/backend/api/Areas/Reports/Controllers/LeaseController.cs +++ b/source/backend/api/Areas/Reports/Controllers/LeaseController.cs @@ -10,17 +10,17 @@ using Microsoft.AspNetCore.Mvc; using Pims.Api.Areas.Reports.Models.Lease; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Helpers.Reporting; using Pims.Api.Models.Report.Lease; -using Pims.Api.Policies; using Pims.Api.Services; +using Pims.Core.Api.Exceptions; +using Pims.Core.Api.Policies; using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Reports.Controllers diff --git a/source/backend/api/Areas/Reports/Controllers/PropertyController.cs b/source/backend/api/Areas/Reports/Controllers/PropertyController.cs index 6284718c94..e36ac33e93 100644 --- a/source/backend/api/Areas/Reports/Controllers/PropertyController.cs +++ b/source/backend/api/Areas/Reports/Controllers/PropertyController.cs @@ -4,15 +4,16 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Helpers.Reporting; using Pims.Api.Models.Base; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Areas.Reports.Controllers { diff --git a/source/backend/api/Areas/Reports/Controllers/UserController.cs b/source/backend/api/Areas/Reports/Controllers/UserController.cs index 5dfae04e43..1fd1abd221 100644 --- a/source/backend/api/Areas/Reports/Controllers/UserController.cs +++ b/source/backend/api/Areas/Reports/Controllers/UserController.cs @@ -4,13 +4,13 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Helpers.Reporting; using Pims.Api.Models.Base; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; using EModel = Pims.Dal.Entities.Models; diff --git a/source/backend/api/Areas/Research/Controllers/ResearchFileController.cs b/source/backend/api/Areas/Research/Controllers/ResearchFileController.cs index 97cc1574dd..6eb7f47775 100644 --- a/source/backend/api/Areas/Research/Controllers/ResearchFileController.cs +++ b/source/backend/api/Areas/Research/Controllers/ResearchFileController.cs @@ -3,15 +3,16 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.ResearchFile; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Areas.ResearchFile.Controllers { diff --git a/source/backend/api/Areas/Research/Controllers/SearchController.cs b/source/backend/api/Areas/Research/Controllers/SearchController.cs index 74ed6af17d..f15fb2e551 100644 --- a/source/backend/api/Areas/Research/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Research/Controllers/SearchController.cs @@ -7,15 +7,15 @@ namespace Pims.Api.Areas.Research.Controllers using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Pims.Api.Areas.Research.Models.Search; - using Pims.Api.Helpers.Exceptions; + using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.Base; using Pims.Api.Models.Concepts.ResearchFile; - using Pims.Api.Policies; + using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Json; using Pims.Dal.Entities.Models; - using Pims.Dal.Security; + using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; /// diff --git a/source/backend/api/Areas/Takes/Controllers/TakeController.cs b/source/backend/api/Areas/Takes/Controllers/TakeController.cs index 162dffc5c4..8229cc68f3 100644 --- a/source/backend/api/Areas/Takes/Controllers/TakeController.cs +++ b/source/backend/api/Areas/Takes/Controllers/TakeController.cs @@ -5,15 +5,15 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Take; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Json; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Takes.Controllers diff --git a/source/backend/api/Areas/Tools/Controllers/GeocoderController.cs b/source/backend/api/Areas/Tools/Controllers/GeocoderController.cs index 588302a1bb..49b3ff307a 100644 --- a/source/backend/api/Areas/Tools/Controllers/GeocoderController.cs +++ b/source/backend/api/Areas/Tools/Controllers/GeocoderController.cs @@ -5,8 +5,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.Requests.Geocoder; -using Pims.Api.Policies; -using Pims.Dal.Security; +using Pims.Core.Api.Policies; +using Pims.Core.Security; using Pims.Geocoder; using Pims.Geocoder.Extensions; using Pims.Geocoder.Parameters; diff --git a/source/backend/api/Areas/Tools/Controllers/LtsaController.cs b/source/backend/api/Areas/Tools/Controllers/LtsaController.cs index d3d57aec00..251d961195 100644 --- a/source/backend/api/Areas/Tools/Controllers/LtsaController.cs +++ b/source/backend/api/Areas/Tools/Controllers/LtsaController.cs @@ -3,9 +3,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Helpers; -using Pims.Dal.Security; +using Pims.Core.Security; using Pims.Ltsa; using Swashbuckle.AspNetCore.Annotations; using Model = Pims.Ltsa.Models; diff --git a/source/backend/api/Controllers/AccessRequestController.cs b/source/backend/api/Controllers/AccessRequestController.cs index c9f01c1cb6..83628b2068 100644 --- a/source/backend/api/Controllers/AccessRequestController.cs +++ b/source/backend/api/Controllers/AccessRequestController.cs @@ -1,7 +1,7 @@ using MapsterMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.AccessRequest; using Pims.Dal.Repositories; using Swashbuckle.AspNetCore.Annotations; diff --git a/source/backend/api/Controllers/SyncMayanController.cs b/source/backend/api/Controllers/SyncMayanController.cs index 34d6dd4a03..40ca6ba356 100644 --- a/source/backend/api/Controllers/SyncMayanController.cs +++ b/source/backend/api/Controllers/SyncMayanController.cs @@ -1,10 +1,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Pims.Api.Models.PimsSync; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Api.Services; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Controllers diff --git a/source/backend/api/Helpers/ConfigurationExtensions.cs b/source/backend/api/Helpers/ConfigurationExtensions.cs index d08a5b2ea3..44feaa18af 100644 --- a/source/backend/api/Helpers/ConfigurationExtensions.cs +++ b/source/backend/api/Helpers/ConfigurationExtensions.cs @@ -23,23 +23,5 @@ public static PimsOptions GeneratePimsOptions(this IConfiguration configuration) HelpDeskEmail = configuration["Pims:HelpDeskEmail"], }; } - - /// - /// Parses the environment configuration and returns 'JsonSerializerOptions'. - /// - /// - /// - public static JsonSerializerOptions GenerateJsonSerializerOptions(this IConfiguration configuration) - { - return new JsonSerializerOptions() - { - DefaultIgnoreCondition = (!string.IsNullOrWhiteSpace(configuration["Serialization:Json:IgnoreNullValues"]) && bool.Parse(configuration["Serialization:Json:IgnoreNullValues"])) ? JsonIgnoreCondition.WhenWritingNull : JsonIgnoreCondition.Never, - PropertyNameCaseInsensitive = !string.IsNullOrWhiteSpace(configuration["Serialization:Json:PropertyNameCaseInsensitive"]) && bool.Parse(configuration["Serialization:Json:PropertyNameCaseInsensitive"]), - PropertyNamingPolicy = configuration["Serialization:Json:PropertyNamingPolicy"] == "CamelCase" ? JsonNamingPolicy.CamelCase : null, - WriteIndented = !string.IsNullOrWhiteSpace(configuration["Serialization:Json:WriteIndented"]) && bool.Parse(configuration["Serialization:Json:WriteIndented"]), - Converters = { new JsonStringEnumMemberConverter(JsonNamingPolicy.CamelCase) }, - ReferenceHandler = ReferenceHandler.IgnoreCycles, - }; - } } } diff --git a/source/backend/api/Helpers/Extensions/ExceptionExtensions.cs b/source/backend/api/Helpers/Extensions/ExceptionExtensions.cs index 71aafdf9c6..eb0b6114ef 100644 --- a/source/backend/api/Helpers/Extensions/ExceptionExtensions.cs +++ b/source/backend/api/Helpers/Extensions/ExceptionExtensions.cs @@ -1,5 +1,5 @@ using System; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Helpers.Extensions { diff --git a/source/backend/api/Helpers/Extensions/PrincipalExtensions.cs b/source/backend/api/Helpers/Extensions/PrincipalExtensions.cs index 2377af76cd..b4cfe5ff00 100644 --- a/source/backend/api/Helpers/Extensions/PrincipalExtensions.cs +++ b/source/backend/api/Helpers/Extensions/PrincipalExtensions.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; +using Pims.Core.Exceptions; using Pims.Dal.Entities; -using Pims.Dal.Exceptions; using Pims.Dal.Repositories; namespace Pims.Core.Extensions diff --git a/source/backend/api/Helpers/Middleware/ErrorHandlingMiddleware.cs b/source/backend/api/Helpers/Middleware/ErrorHandlingMiddleware.cs index a15b2a9e5e..a0ca277d84 100644 --- a/source/backend/api/Helpers/Middleware/ErrorHandlingMiddleware.cs +++ b/source/backend/api/Helpers/Middleware/ErrorHandlingMiddleware.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Core.Exceptions; using Pims.Dal.Exceptions; diff --git a/source/backend/api/Pims.Api.csproj b/source/backend/api/Pims.Api.csproj index e62439b924..1f5cf4b922 100644 --- a/source/backend/api/Pims.Api.csproj +++ b/source/backend/api/Pims.Api.csproj @@ -6,7 +6,7 @@ 5.7.0-93.5 5.7.0.93 true - 16BC0468-78F6-4C91-87DA-7403C919E646 + {16BC0468-78F6-4C91-87DA-7403C919E646} net8.0 @@ -17,7 +17,6 @@ - @@ -27,8 +26,8 @@ - - + + @@ -44,24 +43,23 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + @@ -86,5 +84,6 @@ + diff --git a/source/backend/Pims.sln b/source/backend/api/Pims.sln similarity index 86% rename from source/backend/Pims.sln rename to source/backend/api/Pims.sln index 4604744efb..0a83937ba1 100644 --- a/source/backend/Pims.sln +++ b/source/backend/api/Pims.sln @@ -3,22 +3,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33110.190 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api", "api\Pims.Api.csproj", "{16BC0468-78F6-4C91-87DA-7403C919E646}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api", "Pims.Api.csproj", "{16BC0468-78F6-4C91-87DA-7403C919E646}" ProjectSection(ProjectDependencies) = postProject {1ED5DF03-7784-44EC-B02B-516167210CCF} = {1ED5DF03-7784-44EC-B02B-516167210CCF} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api.Models", "apimodels\Pims.Api.Models.csproj", "{58C42283-68DA-477F-915D-C67597543546}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api.Models", "..\apimodels\Pims.Api.Models.csproj", "{58C42283-68DA-477F-915D-C67597543546}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal", "dal\Pims.Dal.csproj", "{6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal", "..\dal\Pims.Dal.csproj", "{6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Entities", "entities\Pims.Dal.Entities.csproj", "{1C724CD5-CD24-46CD-835A-A83F673F97B5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Entities", "..\entities\Pims.Dal.Entities.csproj", "{1C724CD5-CD24-46CD-835A-A83F673F97B5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Keycloak", "keycloak\Pims.Keycloak.csproj", "{970903E9-BC53-436F-BA77-C62349546425}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Keycloak", "..\keycloak\Pims.Keycloak.csproj", "{970903E9-BC53-436F-BA77-C62349546425}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core", "core\Pims.Core.csproj", "{AC8F04FF-3164-41FB-9EDF-E468B8B77837}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core", "..\core\Pims.Core.csproj", "{AC8F04FF-3164-41FB-9EDF-E468B8B77837}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Keycloak", "dal.keycloak\Pims.Dal.Keycloak.csproj", "{5697DD19-62CC-4377-ABA8-1E192376F4F6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Keycloak", "..\dal.keycloak\Pims.Dal.Keycloak.csproj", "{5697DD19-62CC-4377-ABA8-1E192376F4F6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{8D3E4CB2-41D6-4AA6-B9E4-CFCAB0E2F5BC}" ProjectSection(SolutionItems) = preProject @@ -44,25 +44,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A0343C94-4 docs\VERSIONING.md = docs\VERSIONING.md EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F256F2A5-0DBF-4137-A7D6-21F08111BD4A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "..\tests", "{F256F2A5-0DBF-4137-A7D6-21F08111BD4A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{3D70B211-74A8-484C-9B86-B0A2835C71E7}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "..\unit", "{3D70B211-74A8-484C-9B86-B0A2835C71E7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api.Test", "tests\unit\api\Pims.Api.Test.csproj", "{1F4E301C-F03B-4A31-A6F2-6A77384A74DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api.Test", "..\tests\unit\api\Pims.Api.Test.csproj", "{1F4E301C-F03B-4A31-A6F2-6A77384A74DA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Test", "tests\unit\dal\Pims.Dal.Test.csproj", "{412BF533-2759-4FBE-B4C6-B89DB44FB6B5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Test", "..\tests\unit\dal\Pims.Dal.Test.csproj", "{412BF533-2759-4FBE-B4C6-B89DB44FB6B5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{04780892-FC30-4B6B-A10C-5795C657E574}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "..\core", "{04780892-FC30-4B6B-A10C-5795C657E574}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core.Test", "tests\core\Pims.Core.Test.csproj", "{5A83C636-741A-4795-8588-70F033E79B5A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core.Test", "..\tests\core\Pims.Core.Test.csproj", "{5A83C636-741A-4795-8588-70F033E79B5A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Geocoder", "geocoder\Pims.Geocoder.csproj", "{BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Geocoder", "..\geocoder\Pims.Geocoder.csproj", "{BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Ltsa", "ltsa\Pims.Ltsa.csproj", "{1ED5DF03-7784-44EC-B02B-516167210CCF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Ltsa", "..\ltsa\Pims.Ltsa.csproj", "{1ED5DF03-7784-44EC-B02B-516167210CCF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Mock.Test", "tests\unit\mockdal\Pims.Dal.Mock.Test.csproj", "{2C31E92C-9C95-45FF-9F95-928C2962F37D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Mock.Test", "..\tests\unit\mockdal\Pims.Dal.Mock.Test.csproj", "{2C31E92C-9C95-45FF-9F95-928C2962F37D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Av", "clamav\Pims.Av.csproj", "{16C06BDA-112F-4D04-82FF-0BBE45072372}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Av", "..\clamav\Pims.Av.csproj", "{16C06BDA-112F-4D04-82FF-0BBE45072372}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core.Api", "..\core.api\Pims.Core.Api.csproj", "{89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -86,6 +88,18 @@ Global {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x64.Build.0 = Release|Any CPU {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.ActiveCfg = Release|Any CPU {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.Build.0 = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|x64.ActiveCfg = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|x64.Build.0 = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|x86.ActiveCfg = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Debug|x86.Build.0 = Debug|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|Any CPU.Build.0 = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|x64.ActiveCfg = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|x64.Build.0 = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|x86.ActiveCfg = Release|Any CPU + {58C42283-68DA-477F-915D-C67597543546}.Release|x86.Build.0 = Release|Any CPU {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|Any CPU.Build.0 = Debug|Any CPU {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -110,20 +124,6 @@ Global {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x64.Build.0 = Release|Any CPU {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x86.ActiveCfg = Release|Any CPU {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x86.Build.0 = Release|Any CPU - - {58C42283-68DA-477F-915D-C67597543546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Debug|Any CPU.Build.0 = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Debug|x64.ActiveCfg = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Debug|x64.Build.0 = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Debug|x86.ActiveCfg = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Debug|x86.Build.0 = Debug|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|Any CPU.ActiveCfg = Release|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|Any CPU.Build.0 = Release|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|x64.ActiveCfg = Release|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|x64.Build.0 = Release|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|x86.ActiveCfg = Release|Any CPU - {58C42283-68DA-477F-915D-C67597543546}.Release|x86.Build.0 = Release|Any CPU - {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.Build.0 = Debug|Any CPU {970903E9-BC53-436F-BA77-C62349546425}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -244,6 +244,18 @@ Global {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x64.Build.0 = Release|Any CPU {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.ActiveCfg = Release|Any CPU {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x64.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x64.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x86.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x86.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|Any CPU.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x64.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x64.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x86.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -263,6 +275,7 @@ Global {1ED5DF03-7784-44EC-B02B-516167210CCF} = {5237F8A4-67F5-4751-B8B2-B93A06791480} {2C31E92C-9C95-45FF-9F95-928C2962F37D} = {3D70B211-74A8-484C-9B86-B0A2835C71E7} {16C06BDA-112F-4D04-82FF-0BBE45072372} = {5237F8A4-67F5-4751-B8B2-B93A06791480} + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8} = {5237F8A4-67F5-4751-B8B2-B93A06791480} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3433C5DD-DC49-4A96-A1AE-90C1A1EBA87C} diff --git a/source/backend/api/Properties/launchSettings.json b/source/backend/api/Properties/launchSettings.json index fa5f208261..e0cc8027f3 100644 --- a/source/backend/api/Properties/launchSettings.json +++ b/source/backend/api/Properties/launchSettings.json @@ -21,7 +21,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Local" }, - "applicationUrl": "https://localhost:5000" + "applicationUrl": "http://localhost:5000" } } } diff --git a/source/backend/api/Repositories/Cdogs/CdogsAuthRepository.cs b/source/backend/api/Repositories/Cdogs/CdogsAuthRepository.cs index 17b0a01adf..f86a032277 100644 --- a/source/backend/api/Repositories/Cdogs/CdogsAuthRepository.cs +++ b/source/backend/api/Repositories/Cdogs/CdogsAuthRepository.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Cdogs; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Requests.Http; diff --git a/source/backend/api/Repositories/Mayan/MayanAuthRepository.cs b/source/backend/api/Repositories/Mayan/MayanAuthRepository.cs index 2710e37ba4..4f534fdc29 100644 --- a/source/backend/api/Repositories/Mayan/MayanAuthRepository.cs +++ b/source/backend/api/Repositories/Mayan/MayanAuthRepository.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Mayan; using Pims.Api.Models.Requests.Http; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Repositories.Mayan { diff --git a/source/backend/api/Services/AcquisitionFileService.cs b/source/backend/api/Services/AcquisitionFileService.cs index 4b4b020e09..a5bbb03334 100644 --- a/source/backend/api/Services/AcquisitionFileService.cs +++ b/source/backend/api/Services/AcquisitionFileService.cs @@ -4,7 +4,7 @@ using System.Security.Claims; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.CodeTypes; using Pims.Core.Exceptions; @@ -15,7 +15,8 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; +using Pims.Core.Api.Exceptions; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/CompReqFinancialService.cs b/source/backend/api/Services/CompReqFinancialService.cs index 8fe7a7a20d..f495c546fb 100644 --- a/source/backend/api/Services/CompReqFinancialService.cs +++ b/source/backend/api/Services/CompReqFinancialService.cs @@ -8,7 +8,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/CompensationRequisitionService.cs b/source/backend/api/Services/CompensationRequisitionService.cs index 225e275861..a4bd9df995 100644 --- a/source/backend/api/Services/CompensationRequisitionService.cs +++ b/source/backend/api/Services/CompensationRequisitionService.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Security.Claims; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Core.Exceptions; using Pims.Core.Extensions; @@ -11,7 +11,7 @@ using Pims.Dal.Entities.Extensions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/ContactService.cs b/source/backend/api/Services/ContactService.cs index 5c19d904b2..dd0c96baf6 100644 --- a/source/backend/api/Services/ContactService.cs +++ b/source/backend/api/Services/ContactService.cs @@ -1,11 +1,11 @@ using System.Security.Claims; using Microsoft.Extensions.Logging; using Pims.Api.Services.Interfaces; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/DispositionFileService.cs b/source/backend/api/Services/DispositionFileService.cs index ef78871ef0..aded90176d 100644 --- a/source/backend/api/Services/DispositionFileService.cs +++ b/source/backend/api/Services/DispositionFileService.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Pims.Api.Models.CodeTypes; using Pims.Core.Exceptions; @@ -17,7 +17,7 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/DocumentFileService.cs b/source/backend/api/Services/DocumentFileService.cs index 3eead144a0..f87910eb59 100644 --- a/source/backend/api/Services/DocumentFileService.cs +++ b/source/backend/api/Services/DocumentFileService.cs @@ -5,15 +5,15 @@ using MapsterMapper; using Microsoft.Extensions.Logging; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.Document; using Pims.Api.Models.Requests.Document.Upload; using Pims.Api.Models.Requests.Http; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/DocumentGenerationService.cs b/source/backend/api/Services/DocumentGenerationService.cs index ac85e75b1b..6ad5f9a26a 100644 --- a/source/backend/api/Services/DocumentGenerationService.cs +++ b/source/backend/api/Services/DocumentGenerationService.cs @@ -14,9 +14,9 @@ using Pims.Api.Models.Requests.Http; using Pims.Api.Repositories.Cdogs; using Pims.Av; +using Pims.Core.Extensions; using Pims.Core.Http.Configuration; -using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/DocumentService.cs b/source/backend/api/Services/DocumentService.cs index 42f84ff18d..cbd5a44052 100644 --- a/source/backend/api/Services/DocumentService.cs +++ b/source/backend/api/Services/DocumentService.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.Document; @@ -24,11 +24,11 @@ using Pims.Api.Repositories.Mayan; using Pims.Av; using Pims.Core.Exceptions; +using Pims.Core.Extensions; using Pims.Core.Http.Configuration; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; using Polly; namespace Pims.Api.Services diff --git a/source/backend/api/Services/DocumentSyncService.cs b/source/backend/api/Services/DocumentSyncService.cs index 18c341ba47..ae7030ef0a 100644 --- a/source/backend/api/Services/DocumentSyncService.cs +++ b/source/backend/api/Services/DocumentSyncService.cs @@ -12,11 +12,11 @@ using Pims.Api.Models.PimsSync; using Pims.Api.Models.Requests.Http; using Pims.Api.Repositories.Mayan; +using Pims.Core.Extensions; using Pims.Core.Http.Configuration; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/ExpropriationPaymentService.cs b/source/backend/api/Services/ExpropriationPaymentService.cs index 2cc4efa0c1..e0ac0bc0da 100644 --- a/source/backend/api/Services/ExpropriationPaymentService.cs +++ b/source/backend/api/Services/ExpropriationPaymentService.cs @@ -4,7 +4,7 @@ using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/FinancialCodeService.cs b/source/backend/api/Services/FinancialCodeService.cs index 55233e8d5c..01ca8f84b0 100644 --- a/source/backend/api/Services/FinancialCodeService.cs +++ b/source/backend/api/Services/FinancialCodeService.cs @@ -3,13 +3,13 @@ using MapsterMapper; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.FinancialCode; using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/FormDocumentService.cs b/source/backend/api/Services/FormDocumentService.cs index 20e10bf7d8..dc56329c7e 100644 --- a/source/backend/api/Services/FormDocumentService.cs +++ b/source/backend/api/Services/FormDocumentService.cs @@ -8,10 +8,10 @@ using Pims.Api.Models.Concepts.Document; using Pims.Api.Models.Requests.Document.Upload; using Pims.Api.Models.Requests.Http; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/H120CategoryService.cs b/source/backend/api/Services/H120CategoryService.cs index aae9e00be2..bef0384c3c 100644 --- a/source/backend/api/Services/H120CategoryService.cs +++ b/source/backend/api/Services/H120CategoryService.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.Security.Claims; using Microsoft.Extensions.Logging; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/LeasePeriodService.cs b/source/backend/api/Services/LeasePeriodService.cs index 455463bd10..7bf58400f3 100644 --- a/source/backend/api/Services/LeasePeriodService.cs +++ b/source/backend/api/Services/LeasePeriodService.cs @@ -4,9 +4,9 @@ using System.Security.Claims; using Microsoft.Extensions.Logging; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; +using Pims.Core.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using static Pims.Dal.Entities.PimsLeasePeriodStatusType; namespace Pims.Api.Services diff --git a/source/backend/api/Services/LeaseReportsService.cs b/source/backend/api/Services/LeaseReportsService.cs index 61f0bc512b..7ad2865c9e 100644 --- a/source/backend/api/Services/LeaseReportsService.cs +++ b/source/backend/api/Services/LeaseReportsService.cs @@ -6,7 +6,7 @@ using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using static Pims.Dal.Entities.PimsLeaseStatusType; namespace Pims.Api.Services diff --git a/source/backend/api/Services/LeaseService.cs b/source/backend/api/Services/LeaseService.cs index f257fe1029..2a4e7a3fce 100644 --- a/source/backend/api/Services/LeaseService.cs +++ b/source/backend/api/Services/LeaseService.cs @@ -5,7 +5,7 @@ using System.Security.Claims; using System.Text; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Core.Exceptions; using Pims.Core.Extensions; @@ -15,7 +15,7 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using static Pims.Dal.Entities.PimsLeaseStatusType; namespace Pims.Api.Services diff --git a/source/backend/api/Services/NoteService.cs b/source/backend/api/Services/NoteService.cs index fdbeecb39c..2c5554c606 100644 --- a/source/backend/api/Services/NoteService.cs +++ b/source/backend/api/Services/NoteService.cs @@ -5,13 +5,13 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.Note; using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/OrganizationService.cs b/source/backend/api/Services/OrganizationService.cs index b7cecece76..a3c9b23a52 100644 --- a/source/backend/api/Services/OrganizationService.cs +++ b/source/backend/api/Services/OrganizationService.cs @@ -5,7 +5,7 @@ using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/PersonService.cs b/source/backend/api/Services/PersonService.cs index be2ab8de59..52eee6b61b 100644 --- a/source/backend/api/Services/PersonService.cs +++ b/source/backend/api/Services/PersonService.cs @@ -5,7 +5,7 @@ using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/ProjectService.cs b/source/backend/api/Services/ProjectService.cs index 3ca3773068..96022d2212 100644 --- a/source/backend/api/Services/ProjectService.cs +++ b/source/backend/api/Services/ProjectService.cs @@ -11,7 +11,7 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/PropertyOperationService.cs b/source/backend/api/Services/PropertyOperationService.cs index c9537712a2..4d8c8e80a7 100644 --- a/source/backend/api/Services/PropertyOperationService.cs +++ b/source/backend/api/Services/PropertyOperationService.cs @@ -1,14 +1,13 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; -using LinqKit; using Microsoft.Extensions.Logging; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Core.Exceptions; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; +using Pims.Core.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/PropertyService.cs b/source/backend/api/Services/PropertyService.cs index 0505d98e8a..4c0b502fb5 100644 --- a/source/backend/api/Services/PropertyService.cs +++ b/source/backend/api/Services/PropertyService.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging; using NetTopologySuite.Geometries; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Models.Concepts.Property; using Pims.Core.Exceptions; @@ -16,7 +16,7 @@ using Pims.Dal.Helpers; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/ResearchFileService.cs b/source/backend/api/Services/ResearchFileService.cs index 2df7c1311d..ab8e10e58a 100644 --- a/source/backend/api/Services/ResearchFileService.cs +++ b/source/backend/api/Services/ResearchFileService.cs @@ -10,7 +10,7 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/SecurityDepositReturnService.cs b/source/backend/api/Services/SecurityDepositReturnService.cs index 75962c7fb8..1dcde0a8bd 100644 --- a/source/backend/api/Services/SecurityDepositReturnService.cs +++ b/source/backend/api/Services/SecurityDepositReturnService.cs @@ -1,8 +1,8 @@ using System.Security.Claims; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/SecurityDepositService.cs b/source/backend/api/Services/SecurityDepositService.cs index 4a8e0f82ce..364d75a3c9 100644 --- a/source/backend/api/Services/SecurityDepositService.cs +++ b/source/backend/api/Services/SecurityDepositService.cs @@ -3,10 +3,10 @@ using System.Linq; using System.Security.Claims; using Microsoft.Extensions.Logging; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Services/TakeService.cs b/source/backend/api/Services/TakeService.cs index c3f11f30c5..f860c71873 100644 --- a/source/backend/api/Services/TakeService.cs +++ b/source/backend/api/Services/TakeService.cs @@ -7,9 +7,9 @@ using Pims.Core.Exceptions; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Helpers.Extensions; +using Pims.Core.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Api.Services { diff --git a/source/backend/api/Startup.cs b/source/backend/api/Startup.cs index 73242c924c..00265f6669 100644 --- a/source/backend/api/Startup.cs +++ b/source/backend/api/Startup.cs @@ -31,28 +31,27 @@ using Microsoft.OpenApi.Models; using Pims.Api.Handlers; using Pims.Api.Helpers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Healthchecks; using Pims.Api.Helpers.HealthChecks; -using Pims.Api.Helpers.Logging; using Pims.Api.Helpers.Mapping; using Pims.Api.Helpers.Middleware; -using Pims.Api.Helpers.Swagger; using Pims.Api.Models.Config; using Pims.Api.Repositories.Cdogs; using Pims.Api.Repositories.Mayan; using Pims.Api.Services; using Pims.Api.Services.Interfaces; using Pims.Av; +using Pims.Core.Api.Helpers; using Pims.Core.Converters; using Pims.Core.Http; -using Pims.Core.Http.Configuration; using Pims.Core.Json; using Pims.Dal; using Pims.Dal.Keycloak; using Pims.Geocoder; using Pims.Ltsa; using Prometheus; +using Pims.Core.Api.Middleware; namespace Pims.Api { @@ -127,7 +126,6 @@ public void ConfigureServices(IServiceCollection services) services.Configure(this.Configuration.GetSection("OpenIdConnect")); services.Configure(this.Configuration.GetSection("Keycloak")); services.Configure(this.Configuration.GetSection("Pims")); - services.Configure(this.Configuration.GetSection("Geoserver")); services.Configure(this.Configuration.GetSection("HealthChecks")); services.AddOptions(); @@ -364,7 +362,7 @@ public void ConfigureServices(IServiceCollection services) { options.EnableAnnotations(false, true); options.CustomSchemaIds(o => o.FullName); - options.OperationFilter(); + options.OperationFilter(); options.DocumentFilter(); options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { diff --git a/source/backend/api/appsettings.Docker.json b/source/backend/api/appsettings.Docker.json new file mode 100644 index 0000000000..4189b506bd --- /dev/null +++ b/source/backend/api/appsettings.Docker.json @@ -0,0 +1,83 @@ +{ + "HealthChecks": { + "Port": "5000", + "PmbcExternalApi": { + "Url": "https://delivery.openmaps.gov.bc.ca/geo/pub/WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW/wfs?service=WFS&REQUEST=GetFeature&VERSION=1.3.0&outputFormat=application/json&typeNames=pub:WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW&srsName=EPSG:4326&count=0", + "StatusCode": 200, + "Period": 60, + "Enabled": false + }, + "Cdogs": { + "Period": 60, + "Enabled": false + }, + "Geocoder": { + "Period": 60, + "Enabled": false + }, + "Geoserver": { + "Period": 60, + "Enabled": false + }, + "Ltsa": { + "Period": 60, + "Enabled": false + }, + "Mayan": { + "Period": 60, + "Enabled": false + } + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error", + "Pims.Api.Handlers": "Trace" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Warning", + "System": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error" + } + } + }, + "ConnectionStrings": { + "PIMS": "Server=database,1433;User ID=admin;Database=pims;TrustServerCertificate=True;Encrypt=false;" + }, + "Pims": { + "Environment": { + "Uri": "http://localhost:3000", + "Name": "Local" + }, + "Notifications": { + "ThrowExceptions": true + } + }, + "OpenIdConnect": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "property-services-project-api-dev-only-4700", + "Client": "property-services-project-api-dev-only-4700", + "ServiceAccount": { + "Environment": "dev", + "Integration": "4699" + } + }, + "Mayan": { + "BaseUri": "http://mayan-app:8000/api/v4", + "ConnectionUser": "admin", + "ConnectionPassword": "", + "ExposeErrors": "true" + } +} diff --git a/source/backend/api/appsettings.Local.json b/source/backend/api/appsettings.Local.json index 496e749bf8..5f119b3cb8 100644 --- a/source/backend/api/appsettings.Local.json +++ b/source/backend/api/appsettings.Local.json @@ -79,10 +79,5 @@ "ConnectionUser": "admin", "ConnectionPassword": "", "ExposeErrors": "true" - }, - "Geoserver": { - "ProxyUrl": "http://localhost:8600/geoserver", - "ServiceUser": "admin", - "ServicePassword": "admin" } } diff --git a/source/backend/api/appsettings.json b/source/backend/api/appsettings.json index cb3d0be1bf..4399742c76 100644 --- a/source/backend/api/appsettings.json +++ b/source/backend/api/appsettings.json @@ -147,10 +147,5 @@ "CDogsHost": "[CDOGS_HOST]", "ServiceClientId": "[CLIENT_ID]", "ServiceClientSecret": "[CLIENT_SECRET]" - }, - "Geoserver": { - "ProxyUrl": "[GEOSERVER_PROXY_URL]", - "ServiceUser": "[SERVICE_ACCOUNT_USER]", - "ServicePassword": "[SERVICE_ACCOUNT_PASSWORD]" } } diff --git a/source/backend/api/Helpers/Exceptions/ApiHttpRequestException.cs b/source/backend/core.api/Exceptions/ApiHttpRequestException.cs similarity index 98% rename from source/backend/api/Helpers/Exceptions/ApiHttpRequestException.cs rename to source/backend/core.api/Exceptions/ApiHttpRequestException.cs index dd3bd26e89..3d8db945af 100644 --- a/source/backend/api/Helpers/Exceptions/ApiHttpRequestException.cs +++ b/source/backend/core.api/Exceptions/ApiHttpRequestException.cs @@ -2,7 +2,7 @@ using System.Net; using System.Net.Http; -namespace Pims.Api.Helpers.Exceptions +namespace Pims.Core.Api.Exceptions { /// /// ApiHttpRequestException class, provides a way to express HTTP request exceptions that occur. diff --git a/source/backend/api/Helpers/Exceptions/AuthenticationException.cs b/source/backend/core.api/Exceptions/AuthenticationException.cs similarity index 97% rename from source/backend/api/Helpers/Exceptions/AuthenticationException.cs rename to source/backend/core.api/Exceptions/AuthenticationException.cs index 71568ed9cc..201724071a 100644 --- a/source/backend/api/Helpers/Exceptions/AuthenticationException.cs +++ b/source/backend/core.api/Exceptions/AuthenticationException.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.Serialization; -namespace Pims.Api.Helpers.Exceptions +namespace Pims.Core.Api.Exceptions { /// /// AuthenticationException class, provides a way to handle exceptions that occur when validating authentication. diff --git a/source/backend/api/Helpers/Exceptions/BadRequestException.cs b/source/backend/core.api/Exceptions/BadRequestException.cs similarity index 97% rename from source/backend/api/Helpers/Exceptions/BadRequestException.cs rename to source/backend/core.api/Exceptions/BadRequestException.cs index 3a064a538e..b1cd870490 100644 --- a/source/backend/api/Helpers/Exceptions/BadRequestException.cs +++ b/source/backend/core.api/Exceptions/BadRequestException.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.Serialization; -namespace Pims.Api.Helpers.Exceptions +namespace Pims.Core.Api.Exceptions { /// /// BadRequestException class, provides a way to handle bad request exceptions so that they are returned by the middleware in a standardized way. diff --git a/source/backend/core.api/Handlers/LoggingHandler.cs b/source/backend/core.api/Handlers/LoggingHandler.cs new file mode 100644 index 0000000000..2d7329de61 --- /dev/null +++ b/source/backend/core.api/Handlers/LoggingHandler.cs @@ -0,0 +1,38 @@ +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Pims.Core.Api.Handlers +{ + public class LoggingHandler : DelegatingHandler + { + private readonly ILogger _logger; + + public LoggingHandler(ILogger logger) + { + _logger = logger; + } + + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + _logger.LogTrace("Request:"); + _logger.LogTrace("{request}", request.ToString()); + if (request.Content != null) + { + _logger.LogTrace("{cancellationToken}", await request.Content.ReadAsStringAsync(cancellationToken)); + } + + HttpResponseMessage response = await base.SendAsync(request, cancellationToken); + + _logger.LogTrace("Response:"); + _logger.LogTrace("{response}", response.ToString()); + if (response.Content != null) + { + _logger.LogTrace("{cancellationToken}", await response.Content.ReadAsStringAsync(cancellationToken)); + } + + return response; + } + } +} diff --git a/source/backend/core.api/Helpers/ConfigurationExtensions.cs b/source/backend/core.api/Helpers/ConfigurationExtensions.cs new file mode 100644 index 0000000000..75d90a3515 --- /dev/null +++ b/source/backend/core.api/Helpers/ConfigurationExtensions.cs @@ -0,0 +1,30 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Microsoft.Extensions.Configuration; + +namespace Pims.Core.Api.Helpers +{ + /// + /// ConfigurationExtensions static class, provides extension methods for IConfiguration. + /// + public static class ConfigurationExtensions + { + /// + /// Parses the environment configuration and returns 'JsonSerializerOptions'. + /// + /// + /// + public static JsonSerializerOptions GenerateJsonSerializerOptions(this IConfiguration configuration) + { + return new JsonSerializerOptions() + { + DefaultIgnoreCondition = (!string.IsNullOrWhiteSpace(configuration["Serialization:Json:IgnoreNullValues"]) && bool.Parse(configuration["Serialization:Json:IgnoreNullValues"])) ? JsonIgnoreCondition.WhenWritingNull : JsonIgnoreCondition.Never, + PropertyNameCaseInsensitive = !string.IsNullOrWhiteSpace(configuration["Serialization:Json:PropertyNameCaseInsensitive"]) && bool.Parse(configuration["Serialization:Json:PropertyNameCaseInsensitive"]), + PropertyNamingPolicy = configuration["Serialization:Json:PropertyNamingPolicy"] == "CamelCase" ? JsonNamingPolicy.CamelCase : null, + WriteIndented = !string.IsNullOrWhiteSpace(configuration["Serialization:Json:WriteIndented"]) && bool.Parse(configuration["Serialization:Json:WriteIndented"]), + Converters = { new JsonStringEnumMemberConverter(JsonNamingPolicy.CamelCase) }, + ReferenceHandler = ReferenceHandler.IgnoreCycles, + }; + } + } +} diff --git a/source/backend/api/Helpers/Swagger/ConfigureSwaggerForOpenApi.cs b/source/backend/core.api/Helpers/ConfigureSwaggerForOpenApi.cs similarity index 98% rename from source/backend/api/Helpers/Swagger/ConfigureSwaggerForOpenApi.cs rename to source/backend/core.api/Helpers/ConfigureSwaggerForOpenApi.cs index ff7f2d1032..48659c5f64 100644 --- a/source/backend/api/Helpers/Swagger/ConfigureSwaggerForOpenApi.cs +++ b/source/backend/core.api/Helpers/ConfigureSwaggerForOpenApi.cs @@ -8,7 +8,7 @@ using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerUI; -namespace Pims.Api.Helpers.Swagger +namespace Pims.Core.Api.Helpers { public static class ConfigureSwaggerForOpenApi { diff --git a/source/backend/api/Helpers/Logging/LoggerExtensions.cs b/source/backend/core.api/Helpers/LoggerExtensions.cs similarity index 96% rename from source/backend/api/Helpers/Logging/LoggerExtensions.cs rename to source/backend/core.api/Helpers/LoggerExtensions.cs index bd77edc369..93deb4e200 100644 --- a/source/backend/api/Helpers/Logging/LoggerExtensions.cs +++ b/source/backend/core.api/Helpers/LoggerExtensions.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Serilog; -namespace Pims.Api.Helpers.Logging +namespace Pims.Core.Api.Helpers { [ExcludeFromCodeCoverage] public static class LoggerExtensions diff --git a/source/backend/api/Helpers/Swagger/SwaggerDefaultValues.cs b/source/backend/core.api/Helpers/SwaggerDefaultValues.cs similarity index 98% rename from source/backend/api/Helpers/Swagger/SwaggerDefaultValues.cs rename to source/backend/core.api/Helpers/SwaggerDefaultValues.cs index 069c5ae2b9..ee1a73fb04 100644 --- a/source/backend/api/Helpers/Swagger/SwaggerDefaultValues.cs +++ b/source/backend/core.api/Helpers/SwaggerDefaultValues.cs @@ -4,7 +4,7 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; -namespace Pims.Api.Helpers.Swagger +namespace Pims.Core.Api.Helpers { /// /// Represents the Swagger/Swashbuckle operation filter used to document the implicit API version parameter. diff --git a/source/backend/api/Helpers/Swagger/SwaggerDocumentFilter.cs b/source/backend/core.api/Helpers/SwaggerDocumentFilter.cs similarity index 100% rename from source/backend/api/Helpers/Swagger/SwaggerDocumentFilter.cs rename to source/backend/core.api/Helpers/SwaggerDocumentFilter.cs diff --git a/source/backend/api/Helpers/Middleware/LogRequestMiddleware.cs b/source/backend/core.api/Middleware/LogRequestMiddleware.cs similarity index 98% rename from source/backend/api/Helpers/Middleware/LogRequestMiddleware.cs rename to source/backend/core.api/Middleware/LogRequestMiddleware.cs index 934e61522d..e2aa599eb6 100644 --- a/source/backend/api/Helpers/Middleware/LogRequestMiddleware.cs +++ b/source/backend/core.api/Middleware/LogRequestMiddleware.cs @@ -7,7 +7,7 @@ using Pims.Core.Extensions; using Serilog; -namespace Pims.Api.Helpers.Middleware +namespace Pims.Core.Api.Middleware { /// /// LogRequestMiddleware class, provides a way to log requests inbound to the API. diff --git a/source/backend/api/Helpers/Middleware/LogResponseMiddleware.cs b/source/backend/core.api/Middleware/LogResponseMiddleware.cs similarity index 98% rename from source/backend/api/Helpers/Middleware/LogResponseMiddleware.cs rename to source/backend/core.api/Middleware/LogResponseMiddleware.cs index 9da7824a22..1b9a952295 100644 --- a/source/backend/api/Helpers/Middleware/LogResponseMiddleware.cs +++ b/source/backend/core.api/Middleware/LogResponseMiddleware.cs @@ -7,7 +7,7 @@ using Pims.Core.Extensions; using Serilog; -namespace Pims.Api.Helpers.Middleware +namespace Pims.Core.Api.Middleware { /// /// LogResponseMiddleware class, provides a way to log responses to requests to the API. diff --git a/source/backend/api/Helpers/Middleware/ResponseTimeMiddleware.cs b/source/backend/core.api/Middleware/ResponseTimeMiddleware.cs similarity index 97% rename from source/backend/api/Helpers/Middleware/ResponseTimeMiddleware.cs rename to source/backend/core.api/Middleware/ResponseTimeMiddleware.cs index 3746d1ebd2..72c2b7d1e5 100644 --- a/source/backend/api/Helpers/Middleware/ResponseTimeMiddleware.cs +++ b/source/backend/core.api/Middleware/ResponseTimeMiddleware.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Pims.Api.Helpers.Middleware +namespace Pims.Core.Api.Middleware { /// /// ResponseTimeMiddleware class, provides a way to include the response time in the header. diff --git a/source/backend/core.api/Pims.Core.Api.csproj b/source/backend/core.api/Pims.Core.Api.csproj new file mode 100644 index 0000000000..2e34c312af --- /dev/null +++ b/source/backend/core.api/Pims.Core.Api.csproj @@ -0,0 +1,28 @@ + + + + Library + 2.0.0.0 + 2.0.0.0 + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8} + Debug;Release + net8.0 + + + + + + + + + + + + + + + + + + + diff --git a/source/backend/api/Policies/HasPermissionAttribute.cs b/source/backend/core.api/Policies/HasPermissionAttribute.cs similarity index 96% rename from source/backend/api/Policies/HasPermissionAttribute.cs rename to source/backend/core.api/Policies/HasPermissionAttribute.cs index dbbaede77f..3bdcde9d64 100644 --- a/source/backend/api/Policies/HasPermissionAttribute.cs +++ b/source/backend/core.api/Policies/HasPermissionAttribute.cs @@ -1,8 +1,8 @@ using System; using Microsoft.AspNetCore.Mvc; -using Pims.Dal.Security; +using Pims.Core.Security; -namespace Pims.Api.Policies +namespace Pims.Core.Api.Policies { /// /// HasPermissionAttribute class, provides an attribute that will authorize a users claims to determine if they have permission to perform the requested action. diff --git a/source/backend/api/Policies/PermissionFilter.cs b/source/backend/core.api/Policies/PermissionFilter.cs similarity index 96% rename from source/backend/api/Policies/PermissionFilter.cs rename to source/backend/core.api/Policies/PermissionFilter.cs index fbb5d4a432..ccca6f337a 100644 --- a/source/backend/api/Policies/PermissionFilter.cs +++ b/source/backend/core.api/Policies/PermissionFilter.cs @@ -2,11 +2,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Options; -using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Keycloak.Configuration; -namespace Pims.Api.Policies +namespace Pims.Core.Api.Policies { /// /// PermissionFilter class, provides a authorization filter that validates the specified permissions. diff --git a/source/backend/core.api/Properties/launchSettings.json b/source/backend/core.api/Properties/launchSettings.json new file mode 100644 index 0000000000..aefa40a40d --- /dev/null +++ b/source/backend/core.api/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Pims.Core.Api": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:65416;http://localhost:65417" + } + } +} diff --git a/source/backend/dal/Exceptions/NotAuthorizedException.cs b/source/backend/core/Exceptions/NotAuthorizedException.cs similarity index 98% rename from source/backend/dal/Exceptions/NotAuthorizedException.cs rename to source/backend/core/Exceptions/NotAuthorizedException.cs index 6f020b6508..6955f938be 100644 --- a/source/backend/dal/Exceptions/NotAuthorizedException.cs +++ b/source/backend/core/Exceptions/NotAuthorizedException.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.Serialization; -namespace Pims.Dal.Exceptions +namespace Pims.Core.Exceptions { /// /// NotAuthorizedException class, provides a way to throw an exception when a user is not authorized to perform an action. diff --git a/source/backend/core/Extensions/EnumExtensions.cs b/source/backend/core/Extensions/EnumExtensions.cs index 56977b17ac..e2c32a2fee 100644 --- a/source/backend/core/Extensions/EnumExtensions.cs +++ b/source/backend/core/Extensions/EnumExtensions.cs @@ -1,4 +1,6 @@ +using Pims.Core.Security; using System; +using System.ComponentModel.DataAnnotations; using System.Linq; namespace Pims.Core.Extensions @@ -46,6 +48,20 @@ public static T_Destination ConvertTo(this T_Source val { return Enum.TryParse(typeof(T_Destination), value.ToString(), out object result) ? (T_Destination)result : default; } - #endregion - } + + /// + /// Get the Keycloak name value of the specified permission. + /// + /// + /// + public static string GetName(this Permissions permission) + { + var enumType = typeof(Permissions); + var memberInfos = enumType.GetMember(permission.ToString()); + var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == enumType); + var attribute = (DisplayAttribute)enumValueMemberInfo.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault(); + return attribute.Name; + } + #endregion +} } diff --git a/source/backend/core/Extensions/IdentityExtensions.cs b/source/backend/core/Extensions/IdentityExtensions.cs index a00d6823c0..bdfc7af562 100644 --- a/source/backend/core/Extensions/IdentityExtensions.cs +++ b/source/backend/core/Extensions/IdentityExtensions.cs @@ -2,6 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; +using Microsoft.Extensions.Options; +using Pims.Core.Exceptions; +using Pims.Core.Http.Configuration; +using Pims.Core.Security; namespace Pims.Core.Extensions { @@ -140,10 +144,7 @@ public static string GetEmail(this ClaimsPrincipal user) /// True if the user has any of the roles. public static bool HasRole(this ClaimsPrincipal user, params string[] role) { - if (role == null) - { - throw new ArgumentNullException(nameof(role)); - } + ArgumentNullException.ThrowIfNull(role); if (role.Length == 0) { @@ -172,5 +173,197 @@ public static bool HasRoles(this ClaimsPrincipal user, params string[] role) return count == role.Length; } + + /// + /// Determine if the user any of the specified permission. + /// + /// + /// + /// True if the user has any of the permission. + public static bool HasPermission(this ClaimsPrincipal user, params Permissions[] permission) + { + ArgumentNullException.ThrowIfNull(permission); + + if (permission.Length == 0) + { + throw new ArgumentOutOfRangeException(nameof(permission)); + } + + var roles = permission.Select(r => r.GetName()).ToArray(); + return user.Claims.AsEnumerable().Any(c => c.Type == "client_roles" && roles.Contains(c.Value)); + } + + /// + /// Determine if the user all of the specified permissions. + /// + /// + /// + /// True if the user has all of the permissions. + public static bool HasPermissions(this ClaimsPrincipal user, params Permissions[] permission) + { + ArgumentNullException.ThrowIfNull(permission); + + if (permission.Length == 0) + { + throw new ArgumentOutOfRangeException(nameof(permission)); + } + + var roles = permission.Select(r => r.GetName()).ToArray(); + var claims = user.Claims.Where(c => c.Type == "client_roles"); + return roles.All(r => claims.Any(c => c.Value == r)); + } + + /// + /// Determine if the user is the keycloak service account for the API. + /// + /// + /// + /// True if the user has any of the permission. + public static bool IsServiceAccount(this ClaimsPrincipal user, IOptionsMonitor keycloakOptions) + { + return user.Claims.AsEnumerable().Any(c => c.Type == "clientId" && c.Value == keycloakOptions.CurrentValue.Client); + } + + /// + /// If the user does has not been authenticated throw a NotAuthorizedException. + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, string message = null) + { + if (user == null || !user.Identity.IsAuthenticated) + { + throw new NotAuthorizedException(message); + } + + return user; + } + + /// + /// If the user does not have the specified 'role' and is not the pims API service account, throw a NotAuthorizedException. + /// + /// + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorizedOrServiceAccount(this ClaimsPrincipal user, Permissions permission, IOptionsMonitor keycloakOptions, string message = null) + { + if (user == null || (!user.HasPermission(permission) && !user.IsServiceAccount(keycloakOptions))) + { + throw new NotAuthorizedException(message); + } + + return user; + } + + /// + /// If the user does not have the specified 'role' throw a NotAuthorizedException. + /// + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, string role, string message) + { + if (user == null || !user.HasRole(role)) + { + throw new NotAuthorizedException(message); + } + + return user; + } + + /// + /// If the user does not have the specified 'permission' throw a NotAuthorizedException. + /// + /// + /// + /// + /// User does not have the specified 'permission'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, Permissions permission, string message = null) + { + if (user == null || !user.HasPermission(permission)) + { + throw new NotAuthorizedException(message); + } + + return user; + } + + /// + /// If the user does not have any of the specified 'permission' throw a NotAuthorizedException. + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, params Permissions[] permission) + { + if (user == null || !user.HasPermission(permission)) + { + throw new NotAuthorizedException(); + } + + return user; + } + + /// + /// If the user does not have the all specified 'permission' throw a NotAuthorizedException. + /// + /// + /// + /// + /// User does not have the specified 'permission'. + /// + public static ClaimsPrincipal ThrowIfNotAllAuthorized(this ClaimsPrincipal user, Permissions permission, string message = null) + { + if (user == null || !user.HasPermissions(permission)) + { + throw new NotAuthorizedException(message); + } + + return user; + } + + /// + /// If the user does not have all of the specified 'permission' throw a NotAuthorizedException. + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAllAuthorized(this ClaimsPrincipal user, params Permissions[] permission) + { + if (user == null || !user.HasPermissions(permission)) + { + throw new NotAuthorizedException(); + } + + return user; + } + + /// + /// If the user does not have any of the specified 'permission' throw a NotAuthorizedException. + /// + /// + /// + /// + /// User does not have the specified 'role'. + /// + public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, Permissions[] permission, string message = null) + { + if (user == null || !user.HasPermission(permission)) + { + throw new NotAuthorizedException(message); + } + + return user; + } } } diff --git a/source/backend/core/Pims.Core.csproj b/source/backend/core/Pims.Core.csproj index d3ed750924..7186c70c2f 100644 --- a/source/backend/core/Pims.Core.csproj +++ b/source/backend/core/Pims.Core.csproj @@ -12,7 +12,7 @@ - + diff --git a/source/backend/dal/Security/Permissions.cs b/source/backend/core/Security/Permissions.cs similarity index 99% rename from source/backend/dal/Security/Permissions.cs rename to source/backend/core/Security/Permissions.cs index 8dd91f1229..f76675a12e 100644 --- a/source/backend/dal/Security/Permissions.cs +++ b/source/backend/core/Security/Permissions.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Pims.Dal.Security +namespace Pims.Core.Security { /// /// Permissions enum, provides a list of compile-time safe claim names. diff --git a/source/backend/dal.keycloak/PimsKeycloakService.cs b/source/backend/dal.keycloak/PimsKeycloakService.cs index 710262821b..2eb13f7d4a 100644 --- a/source/backend/dal.keycloak/PimsKeycloakService.cs +++ b/source/backend/dal.keycloak/PimsKeycloakService.cs @@ -6,7 +6,7 @@ using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Pims.Keycloak; using Pims.Keycloak.Models; using Entity = Pims.Dal.Entities; diff --git a/source/backend/dal/Helpers/Extensions/EntityExtensions.cs b/source/backend/dal/Helpers/Extensions/EntityExtensions.cs index 3234119ddb..9b5e71bc2d 100644 --- a/source/backend/dal/Helpers/Extensions/EntityExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/EntityExtensions.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Pims.Core.Extensions; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Helpers.Extensions { diff --git a/source/backend/dal/Helpers/Extensions/EnumExtensions.cs b/source/backend/dal/Helpers/Extensions/EnumExtensions.cs index bf15fb9301..37fb843352 100644 --- a/source/backend/dal/Helpers/Extensions/EnumExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/EnumExtensions.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.Linq; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Helpers.Extensions { diff --git a/source/backend/dal/Helpers/Extensions/IdentityExtensions.cs b/source/backend/dal/Helpers/Extensions/IdentityExtensions.cs deleted file mode 100644 index bda0b0049f..0000000000 --- a/source/backend/dal/Helpers/Extensions/IdentityExtensions.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Linq; -using System.Security.Claims; -using Microsoft.Extensions.Options; -using Pims.Core.Extensions; -using Pims.Core.Http.Configuration; -using Pims.Dal.Entities; -using Pims.Dal.Exceptions; -using Pims.Dal.Security; - -namespace Pims.Dal.Helpers.Extensions -{ - /// - /// IdentityExtensions static class, provides extension methods for user identity. - /// - public static class IdentityExtensions - { - /// - /// Determine if the user any of the specified permission. - /// - /// - /// - /// True if the user has any of the permission. - public static bool HasPermission(this ClaimsPrincipal user, params Permissions[] permission) - { - if (permission == null) - { - throw new ArgumentNullException(nameof(permission)); - } - - if (permission.Length == 0) - { - throw new ArgumentOutOfRangeException(nameof(permission)); - } - - var roles = permission.Select(r => r.GetName()).ToArray(); - return user.Claims.AsEnumerable().Any(c => c.Type == "client_roles" && roles.Contains(c.Value)); - } - - /// - /// Determine if the user all of the specified permissions. - /// - /// - /// - /// True if the user has all of the permissions. - public static bool HasPermissions(this ClaimsPrincipal user, params Permissions[] permission) - { - if (permission == null) - { - throw new ArgumentNullException(nameof(permission)); - } - - if (permission.Length == 0) - { - throw new ArgumentOutOfRangeException(nameof(permission)); - } - - var roles = permission.Select(r => r.GetName()).ToArray(); - var claims = user.Claims.Where(c => c.Type == "client_roles"); - return roles.All(r => claims.Any(c => c.Value == r)); - } - - /// - /// Determine if the user is the keycloak service account for the API. - /// - /// - /// - /// True if the user has any of the permission. - public static bool IsServiceAccount(this ClaimsPrincipal user, IOptionsMonitor keycloakOptions) - { - return user.Claims.AsEnumerable().Any(c => c.Type == "clientId" && c.Value == keycloakOptions.CurrentValue.Client); - } - - /// - /// If the user does has not been authenticated throw a NotAuthorizedException. - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, string message = null) - { - if (user == null || !user.Identity.IsAuthenticated) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// If the user does not have the specified 'role' and is not the pims API service account, throw a NotAuthorizedException. - /// - /// - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorizedOrServiceAccount(this ClaimsPrincipal user, Permissions permission, IOptionsMonitor keycloakOptions, string message = null) - { - if (user == null || (!user.HasPermission(permission) && !user.IsServiceAccount(keycloakOptions))) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// If the user does not have the specified 'role' throw a NotAuthorizedException. - /// - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, string role, string message) - { - if (user == null || !user.HasRole(role)) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// If the user does not have the specified 'permission' throw a NotAuthorizedException. - /// - /// - /// - /// - /// User does not have the specified 'permission'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, Permissions permission, string message = null) - { - if (user == null || !user.HasPermission(permission)) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// If the user does not have any of the specified 'permission' throw a NotAuthorizedException. - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, params Permissions[] permission) - { - if (user == null || !user.HasPermission(permission)) - { - throw new NotAuthorizedException(); - } - - return user; - } - - /// - /// If the user does not have the all specified 'permission' throw a NotAuthorizedException. - /// - /// - /// - /// - /// User does not have the specified 'permission'. - /// - public static ClaimsPrincipal ThrowIfNotAllAuthorized(this ClaimsPrincipal user, Permissions permission, string message = null) - { - if (user == null || !user.HasPermissions(permission)) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// If the user does not have all of the specified 'permission' throw a NotAuthorizedException. - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAllAuthorized(this ClaimsPrincipal user, params Permissions[] permission) - { - if (user == null || !user.HasPermissions(permission)) - { - throw new NotAuthorizedException(); - } - - return user; - } - - /// - /// If the user does not have any of the specified 'permission' throw a NotAuthorizedException. - /// - /// - /// - /// - /// User does not have the specified 'role'. - /// - public static ClaimsPrincipal ThrowIfNotAuthorized(this ClaimsPrincipal user, Permissions[] permission, string message = null) - { - if (user == null || !user.HasPermission(permission)) - { - throw new NotAuthorizedException(message); - } - - return user; - } - - /// - /// A user is supposed to only belong to one child organization or one parent organization. - /// While in Keycloak these rules can be broken, we have to assume the first parent organization, or the first child organization is the user's primary. - /// - /// - /// - /// - public static PimsOrganization GetOrganization(this ClaimsPrincipal user, PimsContext context) - { - var organizationIds = user.GetOrganizations(); - - if (organizationIds == null || !organizationIds.Any()) - { - return null; - } - - var organizations = context.PimsOrganizations.Where(a => organizationIds.Contains(a.OrganizationId)).OrderBy(a => a.PrntOrganizationId); - - // If one of the organizations is a parent, return it. - var parentOrganization = organizations.FirstOrDefault(a => a.PrntOrganizationId == null); - if (parentOrganization != null) - { - return parentOrganization; - } - - // Assume the first organization is their primary - return organizations.FirstOrDefault(); - } - } -} diff --git a/source/backend/dal/Helpers/Extensions/OrganizationExtensions.cs b/source/backend/dal/Helpers/Extensions/OrganizationExtensions.cs new file mode 100644 index 0000000000..1bcd7dbf90 --- /dev/null +++ b/source/backend/dal/Helpers/Extensions/OrganizationExtensions.cs @@ -0,0 +1,40 @@ +using System.Linq; +using System.Security.Claims; +using Pims.Core.Extensions; +using Pims.Dal.Entities; + +namespace Pims.Dal.Helpers.Extensions +{ + public static class OrganizationExtensions + { + + /// + /// A user is supposed to only belong to one child organization or one parent organization. + /// While in Keycloak these rules can be broken, we have to assume the first parent organization, or the first child organization is the user's primary. + /// + /// + /// + /// + public static PimsOrganization GetOrganization(this ClaimsPrincipal user, PimsContext context) + { + var organizationIds = user.GetOrganizations(); + + if (organizationIds == null || !organizationIds.Any()) + { + return null; + } + + var organizations = context.PimsOrganizations.Where(a => organizationIds.Contains(a.OrganizationId)).OrderBy(a => a.PrntOrganizationId); + + // If one of the organizations is a parent, return it. + var parentOrganization = organizations.FirstOrDefault(a => a.PrntOrganizationId == null); + if (parentOrganization != null) + { + return parentOrganization; + } + + // Assume the first organization is their primary + return organizations.FirstOrDefault(); + } + } +} diff --git a/source/backend/dal/Helpers/Extensions/PropertyViewExtensions.cs b/source/backend/dal/Helpers/Extensions/PropertyViewExtensions.cs index ecf27506ee..ca0b520fba 100644 --- a/source/backend/dal/Helpers/Extensions/PropertyViewExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/PropertyViewExtensions.cs @@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore; using Pims.Core.Extensions; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Entity = Pims.Dal.Entities; namespace Pims.Dal.Helpers.Extensions diff --git a/source/backend/dal/Helpers/Extensions/UserExtensions.cs b/source/backend/dal/Helpers/Extensions/UserExtensions.cs index 4039ccf857..b3b085f451 100644 --- a/source/backend/dal/Helpers/Extensions/UserExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/UserExtensions.cs @@ -1,5 +1,5 @@ using System.Linq; -using Pims.Dal.Exceptions; +using Pims.Core.Exceptions; namespace Pims.Dal.Entities { diff --git a/source/backend/dal/Repositories/AccessRequestRepository.cs b/source/backend/dal/Repositories/AccessRequestRepository.cs index 8e9546ed9f..9e88bc321e 100644 --- a/source/backend/dal/Repositories/AccessRequestRepository.cs +++ b/source/backend/dal/Repositories/AccessRequestRepository.cs @@ -4,12 +4,11 @@ using System.Security.Claims; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using Pims.Core.Exceptions; using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; -using Pims.Dal.Exceptions; -using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/ClaimRepository.cs b/source/backend/dal/Repositories/ClaimRepository.cs index d9743d9770..a4bedb1cb2 100644 --- a/source/backend/dal/Repositories/ClaimRepository.cs +++ b/source/backend/dal/Repositories/ClaimRepository.cs @@ -8,7 +8,8 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; +using Pims.Core.Extensions; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/CompReqFinancialRepository.cs b/source/backend/dal/Repositories/CompReqFinancialRepository.cs index 7eeae53b06..a80bd59684 100644 --- a/source/backend/dal/Repositories/CompReqFinancialRepository.cs +++ b/source/backend/dal/Repositories/CompReqFinancialRepository.cs @@ -5,8 +5,10 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Pims.Core.Exceptions; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; +using Pims.Core.Extensions; using Pims.Dal.Helpers.Extensions; namespace Pims.Dal.Repositories @@ -34,7 +36,7 @@ public CompReqFinancialRepository(PimsContext dbContext, ClaimsPrincipal user, I public IEnumerable GetAllByAcquisitionFileId(long acquisitionFileId, bool? finalOnly) { - this._user.ThrowIfNotAllAuthorized(Security.Permissions.CompensationRequisitionView); + this._user.ThrowIfNotAllAuthorized(Permissions.CompensationRequisitionView); var query = Context.PimsCompReqFinancials .Include(c => c.CompensationRequisition) @@ -50,7 +52,7 @@ public IEnumerable GetAllByAcquisitionFileId(long acquisit public IEnumerable GetAllByLeaseFileId(long leaseFileId, bool? finalOnly) { - this._user.ThrowIfNotAuthorized(Security.Permissions.CompensationRequisitionView); + this._user.ThrowIfNotAuthorized(Permissions.CompensationRequisitionView); var query = Context.PimsCompReqFinancials .Include(c => c.CompensationRequisition) diff --git a/source/backend/dal/Repositories/ContactRepository.cs b/source/backend/dal/Repositories/ContactRepository.cs index c156838203..456e68fdc1 100644 --- a/source/backend/dal/Repositories/ContactRepository.cs +++ b/source/backend/dal/Repositories/ContactRepository.cs @@ -8,7 +8,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/DocumentRepository.cs b/source/backend/dal/Repositories/DocumentRepository.cs index 71c3407645..c9a9716baa 100644 --- a/source/backend/dal/Repositories/DocumentRepository.cs +++ b/source/backend/dal/Repositories/DocumentRepository.cs @@ -6,7 +6,7 @@ using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/H120CategoryRepository.cs b/source/backend/dal/Repositories/H120CategoryRepository.cs index 8e3efd5302..bfb61d4113 100644 --- a/source/backend/dal/Repositories/H120CategoryRepository.cs +++ b/source/backend/dal/Repositories/H120CategoryRepository.cs @@ -3,9 +3,9 @@ using System.Linq; using System.Security.Claims; using Microsoft.Extensions.Logging; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Entities; -using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/LeaseRepository.cs b/source/backend/dal/Repositories/LeaseRepository.cs index cbb49cf8e4..a3f7029031 100644 --- a/source/backend/dal/Repositories/LeaseRepository.cs +++ b/source/backend/dal/Repositories/LeaseRepository.cs @@ -11,7 +11,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/OrganizationRepository.cs b/source/backend/dal/Repositories/OrganizationRepository.cs index 2b1f3296e1..7dc8355089 100644 --- a/source/backend/dal/Repositories/OrganizationRepository.cs +++ b/source/backend/dal/Repositories/OrganizationRepository.cs @@ -7,7 +7,7 @@ using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/PersonRepository.cs b/source/backend/dal/Repositories/PersonRepository.cs index d2adf66bb2..32b3f256cc 100644 --- a/source/backend/dal/Repositories/PersonRepository.cs +++ b/source/backend/dal/Repositories/PersonRepository.cs @@ -8,7 +8,7 @@ using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/ProjectRepository.cs b/source/backend/dal/Repositories/ProjectRepository.cs index 31340da4ab..5fb6c42f84 100644 --- a/source/backend/dal/Repositories/ProjectRepository.cs +++ b/source/backend/dal/Repositories/ProjectRepository.cs @@ -9,7 +9,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/PropertyContactRepository.cs b/source/backend/dal/Repositories/PropertyContactRepository.cs index 44d8636bcb..c1d1278c17 100644 --- a/source/backend/dal/Repositories/PropertyContactRepository.cs +++ b/source/backend/dal/Repositories/PropertyContactRepository.cs @@ -7,7 +7,7 @@ using Pims.Core.Extensions; using Pims.Dal.Entities; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/PropertyLeaseRepository.cs b/source/backend/dal/Repositories/PropertyLeaseRepository.cs index 566f3bf52f..595868efa6 100644 --- a/source/backend/dal/Repositories/PropertyLeaseRepository.cs +++ b/source/backend/dal/Repositories/PropertyLeaseRepository.cs @@ -4,8 +4,9 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Pims.Dal.Entities; +using Pims.Core.Extensions; +using Pims.Core.Security; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/PropertyRepository.cs b/source/backend/dal/Repositories/PropertyRepository.cs index 364117144a..8accd98c84 100644 --- a/source/backend/dal/Repositories/PropertyRepository.cs +++ b/source/backend/dal/Repositories/PropertyRepository.cs @@ -13,7 +13,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/RoleRepository.cs b/source/backend/dal/Repositories/RoleRepository.cs index 362f987a8f..4b21318b32 100644 --- a/source/backend/dal/Repositories/RoleRepository.cs +++ b/source/backend/dal/Repositories/RoleRepository.cs @@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Pims.Core.Extensions; using Pims.Core.Http.Configuration; +using Pims.Core.Security; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; -using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/UserRepository.cs b/source/backend/dal/Repositories/UserRepository.cs index e6fae45d42..a280f14964 100644 --- a/source/backend/dal/Repositories/UserRepository.cs +++ b/source/backend/dal/Repositories/UserRepository.cs @@ -12,7 +12,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Dal.Repositories { diff --git a/source/backend/entrypoint.proxy.sh b/source/backend/entrypoint.proxy.sh new file mode 100644 index 0000000000..5cca2e0e2d --- /dev/null +++ b/source/backend/entrypoint.proxy.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# export MAIL_SERVER_URL=`route -n | grep "UG" | grep -v "UGH" | cut -f 10 -d " "` +# export MAIL_SERVER_PORT=1025 +dotnet Pims.Proxy.dll diff --git a/source/backend/proxy/.dockerignore b/source/backend/proxy/.dockerignore new file mode 100644 index 0000000000..7ed9d732a6 --- /dev/null +++ b/source/backend/proxy/.dockerignore @@ -0,0 +1,18 @@ +.vs/ +.env + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +**/[Bb]in/ +**/[Oo]bj/ +**/[Oo]ut/ +msbuild.log +msbuild.err +msbuild.wrn diff --git a/source/backend/proxy/.editorconfig b/source/backend/proxy/.editorconfig new file mode 100644 index 0000000000..01b3182133 --- /dev/null +++ b/source/backend/proxy/.editorconfig @@ -0,0 +1,257 @@ +# Editor configuration, see https://editorconfig.org +root = true + +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +indent_size = 2 + +[*.md] +max_line_length = off +trim_trailing_whitespace = false + +[*.env] +insert_final_newline = false + +[{Makefile,**.mk}] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab + +[*.cs] +indent_size = 4 + +# IDE0005: Using directive is unnecessary. +dotnet_diagnostic.IDE0005.severity = warning +# CA1032: Implement standard exception constructors +dotnet_diagnostic.CA1032.severity = warning +# CA1816: Call GC.SuppressFinalize correctly +dotnet_diagnostic.CA1816.severity = error +# CA1063: Implement IDisposable correctly +dotnet_diagnostic.CA1063.severity = error +# CA2007: Do not directly await a Task +dotnet_diagnostic.CA2007.severity = none +# CA1062: Validate arguments of public methods +dotnet_diagnostic.CA1062.severity = none +# CA1031: Do not catch general exception types +dotnet_diagnostic.CA1031.severity = none +# CA2000: Dispose objects before losing scope +dotnet_diagnostic.CA2000.severity = error +# CA1508: Avoid dead conditional code +dotnet_diagnostic.CA1508.severity = none #TODO: Requires further analysis +# CA1305: Specify IFormatProvider +dotnet_diagnostic.CA1305.severity = none # #TODO: Requires further analysis +# CA1801: Review unused parameters +dotnet_diagnostic.CA1801.severity = none # #TODO: Requires further analysis +# CA1822: Mark members as static +dotnet_diagnostic.CA1822.severity = warning +# CS1591: Missing XML comment +dotnet_diagnostic.CS1591.severity = none +# CS0108 X member hides inherited member Y. Use the new keyword if hiding was intended. +dotnet_diagnostic.CS0108.severity = error +# SA1400 Element X should declare an access modifier +dotnet_diagnostic.SA1400.severity = error +# SA1314 Type parameter names should begin with T +dotnet_diagnostic.SA1314.severity = error + +# SonarQube +# S4487 Unread "private" fields should be removed. +dotnet_diagnostic.S4487.severity = warning +# S927 Parameter names should match base declaration and other partial definitions +dotnet_diagnostic.S927.severity = error +# S1006 Remove the default parameter value to match the signature of overridden method +dotnet_diagnostic.S1006.severity = error +# S3928 The parameter name '{param}' is not declared in the argument list +dotnet_diagnostic.S3928.severity = error +# S1481 Remove the unused local variable +dotnet_diagnostic.S1481.severity = warning +# S1116 Remove empty statement +dotnet_diagnostic.S1116.severity = warning +# S1118 Utility classes should not have public constructors +dotnet_diagnostic.S1118.severity = error +# S3925 "ISerializable" should be implemented correctly +dotnet_diagnostic.S3925.severity = error +# S4457 Parameter validation in "async"/"await" methods should be wrapped +dotnet_diagnostic.S4457.severity = error +# S3442 "abstract" classes should not have "public" constructors +dotnet_diagnostic.S3442.severity = error +# S125 Remove commented out code +dotnet_diagnostic.S125.severity = warning +# S4136 Method overloads should be adjacent +dotnet_diagnostic.S4136.severity = none +# S1128 Remove this unnecessary 'using' +dotnet_diagnostic.S1128.severity = warning +# S3358 Extract this nested ternary operation into an independent statement. +dotnet_diagnostic.S3358.severity = warning +# SA1617 Void return value should not be documented +dotnet_diagnostic.SA1617.severity = error +# SA1122 Use string.Empty for empty strings +dotnet_diagnostic.SA1122.severity = error + +# StyleCop +# SA1600 Elements should be documented +dotnet_diagnostic.SA1600.severity = none +# SA1200 Using directive should appear within a namespace declaration +dotnet_diagnostic.SA1200.severity = none +# SA1633 The file header is missing or not located at the top of the file. +dotnet_diagnostic.SA1633.severity = none +# SA1642 Constructor summary documentation should begin with standard text +dotnet_diagnostic.SA1642.severity = none +# SA1614 Element parameter documentation should have text +dotnet_diagnostic.SA1614.severity = none +# SA1101 Prefix local calls with this +dotnet_diagnostic.SA1101.severity = none +# SA1616 Element return value documentation should have text +dotnet_diagnostic.SA1616.severity = none +# SA1623 The property's documentation summary text should begin with: 'Gets or sets' +dotnet_diagnostic.SA1623.severity = none +# SA1309 Field should not begin with an underscore +dotnet_diagnostic.SA1309.severity = none +# SA1513 Closing brace should be followed by an empty line +dotnet_diagnostic.SA1505.severity = none +# SA1505 Opening brace should be followed by an empty line +dotnet_diagnostic.SA1513.severity = none +# SA1124 Do not use regions +dotnet_diagnostic.SA1124.severity = none +# SA1139 Use literal suffix notation +dotnet_diagnostic.SA1139.severity = none +# SA1501 Statement should not be on a single line. +dotnet_diagnostic.SA1501.severity = none +# SA1000 The keyword 'new' should be followed by a space +dotnet_diagnostic.SA1000.severity = none + +# TODO: Fix these +# SA1622 Generic type parameter documentation should have text. // TODO: This should get added +dotnet_diagnostic.SA1622.severity = none +# SA1618 The documentation for type parameter 'T' is missing. // TODO: This should be an error +dotnet_diagnostic.SA1618.severity = none +# SA1402 File may only contain a single type. // TODO: This should be enabled +dotnet_diagnostic.SA1402.severity = none +# SA1649 File name should match first type name. // TODO: This should be an error || LTSA needs to be skiped +dotnet_diagnostic.SA1649.severity = none +# CA2254 The logging message template should not vary between calls. // TODO: requires code changes +dotnet_diagnostic.CA2254.severity = none +# SA1129 Do not use default value type constructor. +dotnet_diagnostic.SA1129.severity = none +# S1135 Complete the task associated to this 'TODO' comment +dotnet_diagnostic.S1135.severity = none +## + +# SA1611: The documentation for parameter X is missing. // Not necessary unless it proves value +dotnet_diagnostic.SA1611.severity = none +# SA1615 Element return value should be documented // Not necessary unless it proves value +dotnet_diagnostic.SA1615.severity = none +# SA1201 A constructor should not follow a property +dotnet_diagnostic.SA1201.severity = none +# SA1602 Enumeration items should be documented. // Not necessary unless it proves value +dotnet_diagnostic.SA1602.severity = none + +# SA0001 XML comment analysis is disabled due to project configuration +dotnet_diagnostic.SA0001.severity = none + +# --- Set to error before running formatter --- +# dotnet format --severity error --exclude entities/ef/** --exclude entities/PimsBaseContext.cs +# SA1515 Single-line comment should be preceded by blank line. +dotnet_diagnostic.SA1515.severity = warning +# SA1516 Elements should be separated by blank line +dotnet_diagnostic.SA1516.severity = warning +# SA1208 Using directive for 'X' should appear before directive 'Y' +dotnet_diagnostic.SA1208.severity = warning +# SA1507 Code should not contain multiple blank lines in a row +dotnet_diagnostic.SA1507.severity = warning +# SA1629 Documentation text should end with a period +dotnet_diagnostic.SA1629.severity = warning +# SA1121 Use built-in type alias +dotnet_diagnostic.SA1121.severity = warning +# SA1413 Use trailing comma in multi-line initializers +dotnet_diagnostic.SA1413.severity = warning +# SA1128 Put constructor initializers on their own line +dotnet_diagnostic.SA1128.severity = warning +# SA1514 Element documentation header should be preceded by blank line +dotnet_diagnostic.SA1514.severity = warning +# SA1502 Element should not be on a single line +dotnet_diagnostic.SA1502.severity = warning +# S1128 Remove this unnecessary 'using' +dotnet_diagnostic.S1128.severity = warning +# SA1517 Code should not contain blank lines at start of file +dotnet_diagnostic.SA1517.severity = warning +# S1128 Remove this unnecessary 'using' +dotnet_diagnostic.S1128.severity = warning +# SA1508 A closing brace should not be preceded by a blank line. +dotnet_diagnostic.SA1508.severity = warning +# SA1009 Closing parenthesis should be followed by a space +dotnet_diagnostic.SA1009.severity = warning +# SA1210 Using directives should be ordered alphabetically by the namespaces +dotnet_diagnostic.SA1210.severity = warning +# SA1610 Property documentation should have value text +dotnet_diagnostic.SA1610.severity = warning +# CS8019: Using directive is unnecessary. +dotnet_diagnostic.CS8019.severity = warning +# SA1005 Single line comment should begin with a space. +dotnet_diagnostic.SA1005.severity = warning +# SA1411 Attribute constructor should not use unnecessary parenthesis +dotnet_diagnostic.SA1411.severity = warning +# SA1519 Braces should not be omitted from multi-line child statement +dotnet_diagnostic.SA1519.severity = warning +# SA1202 'public' members should come before 'private' members +dotnet_diagnostic.SA1202.severity = warning +# SA1204 Static members should appear before non-static members. +dotnet_diagnostic.SA1204.severity = warning +# SA1127 Generic type constraints should be on their own line +dotnet_diagnostic.SA1127.severity = warning +# SA1520 Use braces consistently +dotnet_diagnostic.SA1520.severity = warning +# SA1028 Code should not contain trailing whitespace. +dotnet_diagnostic.SA1028.severity = warning +# SA1512 Single-line comments should not be followed by blank line. +dotnet_diagnostic.SA1512.severity = warning +# SA1500 Braces for multi-line statements should not share line +dotnet_diagnostic.SA1500.severity = warning +# SA1119 Statement should not use unnecessary parenthesis. +dotnet_diagnostic.SA1119.severity = warning +# CA1847 Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character +dotnet_diagnostic.CA1847.severity = warning +# SA1107 Code should not contain multiple statements on one line +dotnet_diagnostic.SA1107.severity = warning +# IDE0005 Using directive is unnecessary. +dotnet_diagnostic.IDE0005.severity = warning +# SA1518 Code should not contain blank lines at the end of the file +dotnet_diagnostic.SA1518.severity = warning +# SA1510 'else' statement should not be preceded by a blank line. +dotnet_diagnostic.SA1510.severity = warning +# SA1116 The parameters should begin on the line after the declaration. +dotnet_diagnostic.SA1116.severity = warning +# SA1137 Elements should have the same indentation +dotnet_diagnostic.SA1137.severity = warning +# SA1117 The parameters should all be placed on the same line or each parameter should be placed on its own line. +dotnet_diagnostic.SA1117.severity = warning +# SA1115 The parameter should begin on the line after the previous parameter. +dotnet_diagnostic.SA1115.severity = warning +# SA1612 The parameter 'id' does not exist. +dotnet_diagnostic.SA1612.severity = warning +# SA1025 Code should not contain multiple whitespace characters in a row. +dotnet_diagnostic.SA1025.severity = warning +# IDE0052 Private member X can be removed as the value assigned to it is never read. +dotnet_diagnostic.IDE0052.severity = warning +# SA1214 Readonly fields should appear before non-readonly fields. +dotnet_diagnostic.SA1214.severity = warning +# SA1300 Element X should begin with an uppercase letter +dotnet_diagnostic.SA1300.severity = warning + +# Entity Framework files +[**{entities/ef/*,PIMSContext,PimsBaseContext}.cs] +# CS8019: Using directive is unnecessary. +dotnet_diagnostic.CS8019.severity = none +# SA1502 Element should not be on a single line +dotnet_diagnostic.SA1502.severity = none +# SA1516 Elements should be separated by blank line +dotnet_diagnostic.SA1516.severity = none +# SonarQube +# S1128 Remove this unnecessary 'using' +dotnet_diagnostic.S1128.severity = none +# S3251 Supply an implementation for this partial method. +dotnet_diagnostic.S3251.severity = none \ No newline at end of file diff --git a/source/backend/proxy/.gitignore b/source/backend/proxy/.gitignore new file mode 100644 index 0000000000..7f9566aaa2 --- /dev/null +++ b/source/backend/proxy/.gitignore @@ -0,0 +1,55 @@ +# Environment variables +.env +connectionstrings.*json +.vscode/settings.json + +*.swp +*.*~ +project.lock.json +.DS_Store +*.pyc +nupkg/ + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +TestResults/ + +# Rider +.idea + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +**/[Dd]ebug/ +**/[Dd]ebugPublic/ +**/[Rr]elease/ +**/[Rr]eleases/ +**/x64/ +**/x86/ +**/build/ +**/bld/ +**/[Bb]in/ +**/[Oo]bj/ +**/[Oo]ut/ +**/msbuild.log +**/msbuild.err +**/msbuild.wrn + +# Visual Studio 2015 +.vs/ + +# SonarQube +.sonarqube/ + +# NET Core Healthchecks UI +healthchecksdb +healthchecksdb-shm +healthchecksdb-wal diff --git a/source/backend/api/Configuration/GeoserverProxyOptions.cs b/source/backend/proxy/Configuration/GeoserverProxyOptions.cs similarity index 100% rename from source/backend/api/Configuration/GeoserverProxyOptions.cs rename to source/backend/proxy/Configuration/GeoserverProxyOptions.cs diff --git a/source/backend/proxy/Configuration/ProgramOptions.cs b/source/backend/proxy/Configuration/ProgramOptions.cs new file mode 100644 index 0000000000..ce2c0d06c0 --- /dev/null +++ b/source/backend/proxy/Configuration/ProgramOptions.cs @@ -0,0 +1,51 @@ +using System.Globalization; +using System.Linq; +using CommandLine; +using Pims.Core.Extensions; + +namespace Pims.Api.Configuration +{ + /// + /// ProgramOptions class, provides a way to parse command line arguments for the PIMS API program. + /// + public class ProgramOptions + { + #region Properties + + /// + /// get/set - ASP NET Core environment. + /// + [Option('e', "environment", Required = false, HelpText = "ASPNETCORE_ENVIRONMENT")] + public string Environment { get; set; } + + /// + /// get/set - ASP NET Core URLs. + /// + [Option('u', "urls", Required = false, HelpText = "ASPNETCORE_URLS")] + public string Urls { get; set; } + + /// + /// get/set - ASP NET Core HTTPS port. + /// + [Option('p', "port", Required = false, HelpText = "ASPNETCORE_HTTPS_PORT")] + public int? HttpsPort { get; set; } + #endregion + + #region Methods + + /// + /// Return an array of arguments of valid option values. + /// + /// + public string[] ToArgs() + { + return new[] + { + this.Urls, + this.Environment, + this.HttpsPort?.ToString(CultureInfo.InvariantCulture), + }.NotNull().ToArray(); + } + #endregion + } +} diff --git a/source/backend/api/Controllers/PimsGeoserverController.cs b/source/backend/proxy/Controllers/PimsGeoserverController.cs similarity index 91% rename from source/backend/api/Controllers/PimsGeoserverController.cs rename to source/backend/proxy/Controllers/PimsGeoserverController.cs index 493c0ce567..7d9c56e9ca 100644 --- a/source/backend/api/Controllers/PimsGeoserverController.cs +++ b/source/backend/proxy/Controllers/PimsGeoserverController.cs @@ -8,12 +8,12 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Core.Extensions; using Pims.Core.Http.Configuration; -using Pims.Dal.Security; +using Pims.Core.Security; -namespace Pims.Api.Controllers +namespace Pims.Proxy.Controllers { /// /// PimsGeoserverController class, provides an authenticated proxy to the pims inventory layer. @@ -24,7 +24,6 @@ namespace Pims.Api.Controllers /// [Authorize] [ApiController] - [ApiVersion("1.0")] [Route("v{version:apiVersion}/geoserver")] [Route("/geoserver")] public class PimsGeoserverController : ControllerBase @@ -80,8 +79,9 @@ public Task ProxyCatchAll(string rest) return Task.CompletedTask; }).Build(); - - return this.HttpProxyAsync($"{_proxyOptions.CurrentValue.ProxyUrl}/{rest}{queryString}", httpOptions); + var proxyUrl = $"{_proxyOptions.CurrentValue.ProxyUrl}/{rest}{queryString}"; + _logger.LogInformation("Proxying request to: {proxyUrl}", proxyUrl); + return this.HttpProxyAsync(proxyUrl, httpOptions); } #endregion diff --git a/source/backend/proxy/Directory.Build.props b/source/backend/proxy/Directory.Build.props new file mode 100644 index 0000000000..d9a8909ec7 --- /dev/null +++ b/source/backend/proxy/Directory.Build.props @@ -0,0 +1,40 @@ + + + net8.0 + 11.0 + Minimum + 4 + true + true + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + all + runtime; build; native; contentfiles; analyzers; + + + + + + diff --git a/source/backend/proxy/Pims.Proxy.csproj b/source/backend/proxy/Pims.Proxy.csproj new file mode 100644 index 0000000000..ca76eeb62f --- /dev/null +++ b/source/backend/proxy/Pims.Proxy.csproj @@ -0,0 +1,54 @@ + + + + true + 16BC0468-78F6-4C91-87DA-7403C919E646 + net8.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + diff --git a/source/backend/proxy/Program.cs b/source/backend/proxy/Program.cs new file mode 100644 index 0000000000..ca84c56a77 --- /dev/null +++ b/source/backend/proxy/Program.cs @@ -0,0 +1,84 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using CommandLine; +using CommandLine.Text; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Pims.Api.Configuration; +using Serilog; + +namespace Pims.Proxy +{ + /// + /// Program class, provides the main program starting point for the Geo-spatial application. + /// + [ExcludeFromCodeCoverage] + public static class Program + { + /// + /// The primary entry point for the application. + /// + /// + public static void Main(string[] args) + { + var results = Parser.Default.ParseArguments(args); + + results.WithParsed((options) => + { + var builder = CreateWebHostBuilder(options); + builder.Build().Run(); + }) + .WithNotParsed((errors) => + { + var helpText = HelpText.AutoBuild( + results, + h => { return HelpText.DefaultParsingErrorsHandler(results, h); }, + e => e); + Console.WriteLine(helpText); + }); + } + + public static IHostBuilder CreateHostBuilder(string[] args) + { + DotNetEnv.Env.Load(); + return Host.CreateDefaultBuilder(args).ConfigureAppConfiguration((hostingContext, config) => + { + config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); + config.AddEnvironmentVariables(); + config.AddCommandLine(args); + }); + } + + /// + /// Create a default configuration and setup for a web application. + /// + /// + /// + private static IHostBuilder CreateWebHostBuilder(ProgramOptions options) + { + var args = options.ToArgs(); + DotNetEnv.Env.Load(); + var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + var config = new ConfigurationBuilder() + .AddEnvironmentVariables() + .AddCommandLine(args) + .Build(); + + return Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webHostBuilder => + webHostBuilder.ConfigureAppConfiguration((hostingContext, config) => + { + config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); + config.AddJsonFile($"appsettings.{env}.json", optional: true, reloadOnChange: true); + config.AddEnvironmentVariables(); + config.AddCommandLine(args); + }) + .UseUrls(config.GetValue("ASPNETCORE_URLS")) + .UseStartup() + .UseKestrel(options => + { + options.Limits.MaxRequestBodySize = 524288000; // 500MB + })).UseSerilog(); + } + } +} diff --git a/source/backend/proxy/Properties/launchSettings.json b/source/backend/proxy/Properties/launchSettings.json new file mode 100644 index 0000000000..ba889ba29d --- /dev/null +++ b/source/backend/proxy/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:5002;http://localhost:5003", + "sslPort": 44342 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": false, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Local" + } + }, + "Pims.Proxy": { + "commandName": "Project", + "launchBrowser": false, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Local", + "URLS": "http://localhost:5002;http://localhost:5003" + } + } + } +} diff --git a/source/backend/proxy/Proxy.sln b/source/backend/proxy/Proxy.sln new file mode 100644 index 0000000000..6c14663a79 --- /dev/null +++ b/source/backend/proxy/Proxy.sln @@ -0,0 +1,102 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33110.190 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Proxy", "Pims.Proxy.csproj", "{16BC0468-78F6-4C91-87DA-7403C919E646}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{8D3E4CB2-41D6-4AA6-B9E4-CFCAB0E2F5BC}" + ProjectSection(SolutionItems) = preProject + .dockerignore = .dockerignore + .editorconfig = .editorconfig + .gitignore = .gitignore + Dockerfile = Dockerfile + Dockerfile.bak = Dockerfile.bak + entrypoint.sh = entrypoint.sh + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{5237F8A4-67F5-4751-B8B2-B93A06791480}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F256F2A5-0DBF-4137-A7D6-21F08111BD4A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{3D70B211-74A8-484C-9B86-B0A2835C71E7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core.Api", "..\core.api\Pims.Core.Api.csproj", "{89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core", "..\core\Pims.Core.csproj", "{AC8F04FF-3164-41FB-9EDF-E468B8B77837}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Keycloak", "..\keycloak\Pims.Keycloak.csproj", "{970903E9-BC53-436F-BA77-C62349546425}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x64.ActiveCfg = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x64.Build.0 = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x86.ActiveCfg = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x86.Build.0 = Debug|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|Any CPU.Build.0 = Release|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x64.ActiveCfg = Release|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x64.Build.0 = Release|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.ActiveCfg = Release|Any CPU + {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x64.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x64.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x86.ActiveCfg = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Debug|x86.Build.0 = Debug|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|Any CPU.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x64.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x64.Build.0 = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x86.ActiveCfg = Release|Any CPU + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8}.Release|x86.Build.0 = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x64.ActiveCfg = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x64.Build.0 = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x86.ActiveCfg = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x86.Build.0 = Debug|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|Any CPU.Build.0 = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x64.ActiveCfg = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x64.Build.0 = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x86.ActiveCfg = Release|Any CPU + {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x86.Build.0 = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.Build.0 = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|x64.ActiveCfg = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|x64.Build.0 = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|x86.ActiveCfg = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Debug|x86.Build.0 = Debug|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|Any CPU.ActiveCfg = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|Any CPU.Build.0 = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|x64.ActiveCfg = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|x64.Build.0 = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|x86.ActiveCfg = Release|Any CPU + {970903E9-BC53-436F-BA77-C62349546425}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {3D70B211-74A8-484C-9B86-B0A2835C71E7} = {F256F2A5-0DBF-4137-A7D6-21F08111BD4A} + {89A99CC5-ADFB-4FC2-9136-7B0029EEA2D8} = {5237F8A4-67F5-4751-B8B2-B93A06791480} + {AC8F04FF-3164-41FB-9EDF-E468B8B77837} = {5237F8A4-67F5-4751-B8B2-B93A06791480} + {970903E9-BC53-436F-BA77-C62349546425} = {5237F8A4-67F5-4751-B8B2-B93A06791480} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3433C5DD-DC49-4A96-A1AE-90C1A1EBA87C} + EndGlobalSection +EndGlobal diff --git a/source/backend/proxy/README.md b/source/backend/proxy/README.md new file mode 100644 index 0000000000..3875eae4b6 --- /dev/null +++ b/source/backend/proxy/README.md @@ -0,0 +1,54 @@ +# PIMS RESTful API - .NET CORE + +The PIMS API provides an RESTful interface to interact with the configured data-source. + +The API is configured to run in a Docker container and has the following dependencies with other containers; database, keycloak. + +For more information refer to documentation [here](https://github.com/bcgov/PSP/wiki/api/API.md). + +To run the API locally you will need to create the appropriate environment variable `.env` files. You can do this through using the prebuilt scripts [here](../../scripts/README.md). + +## API Environment Variables + +The current environment is initialized through the environment variable `ASPNETCORE_ENVIRONMENT`. + +When running the solution it applies the configuration setting in the following order; + +> NOTE: When the environment is Development it will look for your _User Secrets_ file. + +1. appsettings.json +2. appsettings.`[environment]`.json +3. User Secrets `(if environment=Development)` +4. Environment Variables + +To run the solution with docker-compose create a `.env` file within the `/api` directory and populate with the following; + +```conf +ASPNETCORE_ENVIRONMENT=Development +ASPNETCORE_URLS=http://*:8080 +ASPNETCORE_FORWARDEDHEADERS_ENABLED=true +``` + +## Running Locally + +to run the API locally with vscode, comment out the following lines, and add the `ConnectionStrings__PIMS` value in your `.env` file; + +```conf +# ASPNETCORE_ENVIRONMENT=Development +# ASPNETCORE_URLS=http://*:8080 +``` + +This is so that the `/.vscode/launch.json` configured environment variables are used instead. Specifically it will run with the following; + +```json +{ + "configurations": [{ + ... + "env": { + "ASPNETCORE_ENVIRONMENT": "Local", + "ASPNETCORE_URLS": "http://*:5002" + } + ... + }] +} +``` diff --git a/source/backend/proxy/Startup.cs b/source/backend/proxy/Startup.cs new file mode 100644 index 0000000000..6cd40b17b5 --- /dev/null +++ b/source/backend/proxy/Startup.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Security.Claims; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; +using HealthChecks.UI.Client; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Diagnostics.HealthChecks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpOverrides; +using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.IdentityModel.Tokens; +using Microsoft.OpenApi.Models; +using Pims.Core.Api.Exceptions; +using Pims.Core.Api.Handlers; +using Pims.Core.Api.Helpers; +using Pims.Core.Api.Middleware; +using Pims.Core.Converters; +using Pims.Core.Http; +using Pims.Core.Http.Configuration; +using Pims.Core.Json; +using Prometheus; + +namespace Pims.Proxy +{ + /// + /// Startup class, provides a way to startup the .netcore RESTful API and configure it. + /// + [ExcludeFromCodeCoverage] + public class Startup + { + #region Properties + + /// + /// get - The application configuration settings. + /// + public IConfiguration Configuration { get; } + + /// + /// get/set - The environment settings for the application. + /// + public IWebHostEnvironment Environment { get; } + #endregion + + #region Constructors + + /// + /// Creates a new instances of a Startup class. + /// + /// + /// + public Startup(IConfiguration configuration, IWebHostEnvironment env) + { + this.Configuration = configuration; + this.Environment = env; + } + #endregion + + #region Methods + + /// + /// This method gets called by the runtime. Use this method to add services to the container. + /// + /// + public void ConfigureServices(IServiceCollection services) + { + services.AddSerilogging(this.Configuration); + var jsonSerializerOptions = this.Configuration.GenerateJsonSerializerOptions(); + services.Configure(options => + { + options.ReferenceHandler = ReferenceHandler.IgnoreCycles; + options.DefaultIgnoreCondition = jsonSerializerOptions.DefaultIgnoreCondition; + options.PropertyNameCaseInsensitive = jsonSerializerOptions.PropertyNameCaseInsensitive; + options.PropertyNamingPolicy = jsonSerializerOptions.PropertyNamingPolicy; + options.WriteIndented = jsonSerializerOptions.WriteIndented; + options.Converters.Add(new JsonStringEnumMemberConverter()); + options.Converters.Add(new Int32ToStringJsonConverter()); + }); + services.Configure(this.Configuration.GetSection("Keycloak")); + services.Configure(this.Configuration.GetSection("OpenIdConnect")); + services.Configure(this.Configuration.GetSection("Keycloak")); + services.Configure(this.Configuration.GetSection("Geoserver")); + services.AddOptions(); + services.AddApiVersioning(options => + { + options.ReportApiVersions = true; + options.AssumeDefaultVersionWhenUnspecified = true; + options.ApiVersionReader = new HeaderApiVersionReader("api-version"); + }); + + services.AddControllers() + .AddJsonOptions(options => + { + options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; + options.JsonSerializerOptions.DefaultIgnoreCondition = jsonSerializerOptions.DefaultIgnoreCondition; + options.JsonSerializerOptions.PropertyNameCaseInsensitive = jsonSerializerOptions.PropertyNameCaseInsensitive; + options.JsonSerializerOptions.PropertyNamingPolicy = jsonSerializerOptions.PropertyNamingPolicy; + options.JsonSerializerOptions.WriteIndented = jsonSerializerOptions.WriteIndented; + options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + options.JsonSerializerOptions.Converters.Add(new Int32ToStringJsonConverter()); + options.JsonSerializerOptions.Converters.Add(new DateOnlyJsonConverter()); + }); + + services.AddMvcCore() + .AddJsonOptions(options => + { + options.JsonSerializerOptions.DefaultIgnoreCondition = jsonSerializerOptions.DefaultIgnoreCondition; + options.JsonSerializerOptions.PropertyNameCaseInsensitive = jsonSerializerOptions.PropertyNameCaseInsensitive; + options.JsonSerializerOptions.PropertyNamingPolicy = jsonSerializerOptions.PropertyNamingPolicy; + options.JsonSerializerOptions.WriteIndented = jsonSerializerOptions.WriteIndented; + options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + options.JsonSerializerOptions.Converters.Add(new Int32ToStringJsonConverter()); + options.JsonSerializerOptions.Converters.Add(new DateOnlyJsonConverter()); + }); + + services.AddAuthentication(options => + { + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; + }) + .AddJwtBearer(options => + { + var key = Encoding.ASCII.GetBytes(Configuration["Keycloak:Secret"]); + options.RequireHttpsMetadata = false; + options.Authority = Configuration["OpenIdConnect:Authority"]; + options.Audience = Configuration["Keycloak:Audience"]; + options.SaveToken = true; + options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters() + { + ValidateIssuerSigningKey = true, + ValidateIssuer = false, + ValidateAudience = false, + ValidAlgorithms = new List() { "RS256" }, + }; + if (key.Length > 0) + { + options.TokenValidationParameters.IssuerSigningKey = new SymmetricSecurityKey(key); + } + + options.Events = new JwtBearerEvents() + { + OnTokenValidated = context => + { + return Task.CompletedTask; + }, + OnAuthenticationFailed = context => + { + context.NoResult(); + context.Response.StatusCode = StatusCodes.Status401Unauthorized; + throw new AuthenticationException("Failed to authenticate", context.Exception); + }, + OnForbidden = context => + { + return Task.CompletedTask; + }, + }; + }); + + services.AddHttpClient(); + services.AddTransient(); + services.AddHttpClient("Pims.Api.Logging").AddHttpMessageHandler(); + services.AddHttpContextAccessor(); + + services.AddTransient(s => s.GetService()?.HttpContext?.User); + services.AddScoped(); + services.AddResponseCaching(); + services.AddMemoryCache(); + + // Export metrics from all HTTP clients registered in services + services.UseHttpClientMetrics(); + + services.AddHealthChecks().ForwardToPrometheus(); + + services.Configure(Configuration.GetSection(nameof(OpenApiInfo))); + services.AddSwaggerGen(options => + { + options.EnableAnnotations(false, true); + options.CustomSchemaIds(o => o.FullName); + options.OperationFilter(); + options.DocumentFilter(); + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + { + Name = "Authorization", + In = ParameterLocation.Header, + Description = "Please enter into field the word 'Bearer' following by space and JWT", + Type = SecuritySchemeType.ApiKey, + }); + options.AddSecurityRequirement(new OpenApiSecurityRequirement() + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type = ReferenceType.SecurityScheme, + Id = "Bearer", + }, + Scheme = "oauth2", + Name = "Bearer", + In = ParameterLocation.Header, + }, + new List() + }, + }); + + var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + options.IncludeXmlComments(xmlPath); + }); + + services.Configure(options => + { + options.ForwardedHeaders = ForwardedHeaders.All; + options.AllowedHosts = this.Configuration.GetValue("AllowedHosts")?.Split(';').ToList(); + }); + } + + /// + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// + /// + /// + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + app.UseMetricServer(); + app.UseHttpMetrics(); + + if (!env.IsProduction()) + { + app.UseDeveloperExceptionPage(); + } + + var baseUrl = this.Configuration.GetValue("BaseUrl"); + app.UsePathBase(baseUrl); + app.UseForwardedHeaders(); + + app.UseMiddleware(); + app.UseMiddleware(); + app.UseMiddleware(); + + app.UseRouting(); + app.UseCors(); + + // Exception handler middleware that changes HTTP response codes must be registered after UseHttpMetrics() + // in order to ensure that prometheus-net reports the correct HTTP response status code. + app.UseHttpMetrics(); + + // Set responses secure headers. + ConfigureSecureHeaders(app); + + app.UseResponseCaching(); + + app.UseAuthentication(); + app.UseAuthorization(); + + var healthPort = this.Configuration.GetValue("HealthChecks:Port"); + app.UseHealthChecks(this.Configuration.GetValue("HealthChecks:LivePath"), healthPort, new HealthCheckOptions + { + Predicate = r => r.Name.Contains("SqlServer"), + ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse, + }); + app.UseHealthChecks(this.Configuration.GetValue("HealthChecks:ReadyPath"), healthPort, new HealthCheckOptions + { + Predicate = r => r.Tags.Contains("services") && !r.Tags.Contains("external"), + ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse, + }); + + app.UseEndpoints(config => + { + config.MapControllers(); + + // Enable the /metrics page to export Prometheus metrics + config.MapMetrics(); + }); + } + + /// + /// Configures the app to to use content security policies. + /// + /// The application builder provider. + private static void ConfigureSecureHeaders(IApplicationBuilder app) + { + app.Use( + async (context, next) => + { + context.Response.Headers.Add("Strict-Transport-Security", "max-age=86400; includeSubDomains"); + context.Response.Headers.Add("X-Content-Type-Options", "nosniff"); + context.Response.Headers.Add("X-XSS-Protection", "1"); + context.Response.Headers.Add("X-Frame-Options", " DENY"); + await next().ConfigureAwait(true); + }); + } + #endregion + } +} diff --git a/source/backend/proxy/appsettings.Development.json b/source/backend/proxy/appsettings.Development.json new file mode 100644 index 0000000000..a2a380fec6 --- /dev/null +++ b/source/backend/proxy/appsettings.Development.json @@ -0,0 +1,35 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Warning", + "System": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error" + } + } + }, + "Pims": { + "Environment": { + "Uri": "https://dev-pims.th.gov.bc.ca/geoserver", + "Name": "Development" + }, + "Notifications": { + "ThrowExceptions": true + } + }, + "OpenIdConnect": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "property-services-project-api-dev-only-4700", + "Client": "property-services-project-api-dev-only-4700", + "ServiceAccount": { + "Environment": "dev", + "Integration": "4699" + } + } +} diff --git a/source/backend/proxy/appsettings.Docker.json b/source/backend/proxy/appsettings.Docker.json new file mode 100644 index 0000000000..bcf6effa8c --- /dev/null +++ b/source/backend/proxy/appsettings.Docker.json @@ -0,0 +1,53 @@ +{ + "HealthChecks": { + "Port": "5002" + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error", + "Pims.Api.Handlers": "Trace" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Warning", + "System": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error" + } + } + }, + "Pims": { + "Environment": { + "Uri": "http://localhost:3000", + "Name": "Local" + }, + "Notifications": { + "ThrowExceptions": true + } + }, + "OpenIdConnect": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "property-services-project-api-dev-only-4700", + "Client": "property-services-project-api-dev-only-4700", + "ServiceAccount": { + "Environment": "dev", + "Integration": "4699" + } + }, + "Geoserver": { + "ProxyUrl": "http://geoserver:8080/geoserver", + "ServiceUser": "admin", + "ServicePassword": "admin" + } +} diff --git a/source/backend/proxy/appsettings.Local.json b/source/backend/proxy/appsettings.Local.json new file mode 100644 index 0000000000..c184d4ee49 --- /dev/null +++ b/source/backend/proxy/appsettings.Local.json @@ -0,0 +1,53 @@ +{ + "HealthChecks": { + "Port": "5002" + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error", + "Pims.Api.Handlers": "Trace" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Warning", + "System": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error" + } + } + }, + "Pims": { + "Environment": { + "Uri": "http://localhost:3000", + "Name": "Local" + }, + "Notifications": { + "ThrowExceptions": true + } + }, + "OpenIdConnect": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "property-services-project-api-dev-only-4700", + "Client": "property-services-project-api-dev-only-4700", + "ServiceAccount": { + "Environment": "dev", + "Integration": "4699" + } + }, + "Geoserver": { + "ProxyUrl": "http://localhost:8600/geoserver", + "ServiceUser": "admin", + "ServicePassword": "admin" + } +} diff --git a/source/backend/proxy/appsettings.Test.json b/source/backend/proxy/appsettings.Test.json new file mode 100644 index 0000000000..4a4bac0421 --- /dev/null +++ b/source/backend/proxy/appsettings.Test.json @@ -0,0 +1,26 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "OpenIdConnect": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "ServiceAccount": { + "Environment": "dev" + } + }, + "Pims": { + "Environment": { + "Uri": "https://pims-app-test-3cd915-dev.apps.silver.devops.gov.bc.ca", + "Name": "Testing" + } + } +} diff --git a/source/backend/proxy/appsettings.Uat.json b/source/backend/proxy/appsettings.Uat.json new file mode 100644 index 0000000000..cdc24d47c4 --- /dev/null +++ b/source/backend/proxy/appsettings.Uat.json @@ -0,0 +1,26 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "OpenIdConnect": { + "Authority": "https://test.loginproxy.gov.bc.ca/auth/realms/standard" + }, + "Keycloak": { + "Authority": "https://test.loginproxy.gov.bc.ca/auth/realms/standard", + "ServiceAccount": { + "Environment": "test" + } + }, + "Pims": { + "Environment": { + "Uri": "https://uat-pims.th.gov.bc.ca", + "Name": "Testing" + } + } +} diff --git a/source/backend/proxy/appsettings.json b/source/backend/proxy/appsettings.json new file mode 100644 index 0000000000..a7391730fb --- /dev/null +++ b/source/backend/proxy/appsettings.json @@ -0,0 +1,78 @@ +{ + "BaseUrl": "/proxy", + "HealthChecks": { + "Port": "8080", + "LivePath": "/health/live", + "ReadyPath": "/health/ready", + "ApiMetrics": { + "Enabled": true, + "Period": 1 + } + }, + "Swagger": { + "RoutePrefix": "proxy-docs", + "RouteTemplate": "/proxy-docs/swagger/{documentname}/swagger.json", + "EndpointPath": "/proxy-docs/swagger/{0}/swagger.json" + }, + "https_port": 443, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Error", + "HealthChecks.UI": "Error" + } + } + }, + "AllowedHosts": "*", + "Keycloak": { + "Authority": "https://loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "property-services-project-api-4380", + "Secret": "[USE SECRETS]", + "Client": "property-services-project-api-4380", + "ServiceAccount": { + "Authority": "https://loginproxy.gov.bc.ca/auth/realms/standard", + "Audience": "service-account-team-1295-4381", + "Secret": "[USE SECRETS]", + "Client": "service-account-team-1295-4381", + "API": "https://api.loginproxy.gov.bc.ca/api/v1", + "Integration": "4379", + "Environment": "prod" + } + }, + "OpenIdConnect": { + "Authority": "https://loginproxy.gov.bc.ca/auth/realms/standard", + "Login": "/protocol/openid-connect/auth", + "Logout": "/protocol/openid-connect/logout", + "Register": "/protocol/openid-connect/registrations", + "Token": "/protocol/openid-connect/token", + "TokenIntrospect": "/protocol/openid-connect/token/introspect", + "UserInfo": "/protocol/openid-connect/userinfo" + }, + "OpenApiInfo": { + "Description": "PSP Proxy service", + "Title": "PIMS Proxy", + "Contact": { + "Email": "support@pims.gov.bc.ca", + "Name": "Support" + }, + "License": { + "Name": "APACHE", + "Url": "https://github.com/bcgov/PSP/blob/dev/LICENSE" + } + }, + "Serialization": { + "Json": { + "PropertyNameCaseInsensitive": true, + "PropertyNamingPolicy": "CamelCase", + "IgnoreNullValues": true + } + }, + "Geoserver": { + "ProxyUrl": "[GEOSERVER_PROXY_URL]", + "ServiceUser": "[SERVICE_ACCOUNT_USER]", + "ServicePassword": "[SERVICE_ACCOUNT_PASSWORD]" + } +} diff --git a/source/backend/proxy/omnisharp.json b/source/backend/proxy/omnisharp.json new file mode 100644 index 0000000000..8982c08dc5 --- /dev/null +++ b/source/backend/proxy/omnisharp.json @@ -0,0 +1,5 @@ +{ + "RoslynExtensionsOptions": { + "enableAnalyzersSupport": true + } +} diff --git a/source/backend/proxy/tests/.editorconfig b/source/backend/proxy/tests/.editorconfig new file mode 100644 index 0000000000..3c1051119d --- /dev/null +++ b/source/backend/proxy/tests/.editorconfig @@ -0,0 +1,72 @@ +# Editor configuration, see https://editorconfig.org +root = true + +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +indent_size = 2 + +[*.md] +max_line_length = off +trim_trailing_whitespace = false + +[*.env] +insert_final_newline = false + +[{Makefile,**.mk}] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab + +[*.cs] +indent_size = 4 + + +# Test files +# SA1515 Single-line comment should be preceded by blank line +dotnet_diagnostic.SA1515.severity = none +# SA1513: Closing brace should be followed by blank line +dotnet_diagnostic.SA1513.severity = none +# SA1633 The file header is missing or not located at the top of the file +dotnet_diagnostic.SA1633.severity = none +# SA1200 Using directive should appear within a namespace declaration +dotnet_diagnostic.SA1200.severity = none +# SA1124 Do not use regions +dotnet_diagnostic.SA1124.severity = none +# SA1201 A constructor should not follow a property +dotnet_diagnostic.SA1201.severity = none +# SA1309 Field 'X' should not begin with an underscore +dotnet_diagnostic.SA1309.severity = none +# SA1117 The parameters should all be placed on the same line or each parameter should be placed on its own line. +dotnet_diagnostic.SA1117.severity = none + +# -- Set to 'error' before running formatter +# dotnet format --severity error --exclude entities/ef/** --exclude entities/PimsBaseContext.cs +# SA1208: Using directive for X should appear before directive for Y +dotnet_diagnostic.SA1208.severity = warning +# SA1121 Use built-in type alias +dotnet_diagnostic.SA1121.severity = warning +# SA1413 Use trailing comma in multi-line initializers. +dotnet_diagnostic.SA1413.severity = warning +# SA1122 Use string.Empty for empty strings +dotnet_diagnostic.SA1122.severity = warning +# SA1518 Code should not contain blank lines at the end of the file. +dotnet_diagnostic.SA1518.severity = warning +# SA1101 Prefix local calls with this +dotnet_diagnostic.SA1101.severity = warning +# SA1507 Code should not contain multiple blank lines in a row +dotnet_diagnostic.SA1507.severity = warning +# SA1127 Generic type constraints should be on their own line +dotnet_diagnostic.SA1127.severity = warning +# SA1002 Semicolons should be followed by a space. +dotnet_diagnostic.SA1002.severity = warning +# SA1009 Closing parenthesis should not be preceded by a space. +dotnet_diagnostic.SA1009.severity = warning +# SA1508 A closing brace should not be preceded by a blank line +dotnet_diagnostic.SA1508.severity = warning +# SA1005 Single line comment should begin with a space. +dotnet_diagnostic.SA1005.severity = warning \ No newline at end of file diff --git a/source/backend/proxy/tests/.gitignore b/source/backend/proxy/tests/.gitignore new file mode 100644 index 0000000000..5923334c0e --- /dev/null +++ b/source/backend/proxy/tests/.gitignore @@ -0,0 +1,49 @@ +# Environment variables +.env +# Build +.obj + +*.swp +*.*~ +project.lock.json +.DS_Store +*.pyc +nupkg/ + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# Rider +.idea + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +msbuild.log +msbuild.err +msbuild.wrn + +# Visual Studio 2015 +.vs/ + +# SonarQube +.sonarqube/ diff --git a/source/backend/proxy/tests/Directory.Build.props b/source/backend/proxy/tests/Directory.Build.props new file mode 100644 index 0000000000..4357d5e289 --- /dev/null +++ b/source/backend/proxy/tests/Directory.Build.props @@ -0,0 +1,9 @@ + + + net8.0 + 9.0 + + + + + diff --git a/source/backend/tests/core/ControllerHelper.cs b/source/backend/tests/core/ControllerHelper.cs index 103001b16b..a117c1d43f 100644 --- a/source/backend/tests/core/ControllerHelper.cs +++ b/source/backend/tests/core/ControllerHelper.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Pims.Dal; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Core.Test { diff --git a/source/backend/tests/core/DatabaseHelper.cs b/source/backend/tests/core/DatabaseHelper.cs index 0749049163..461b95dc83 100644 --- a/source/backend/tests/core/DatabaseHelper.cs +++ b/source/backend/tests/core/DatabaseHelper.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Options; using Moq; using Pims.Dal; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Core.Test { diff --git a/source/backend/tests/core/PimsAssert.cs b/source/backend/tests/core/PimsAssert.cs index 493584823e..99878deb77 100644 --- a/source/backend/tests/core/PimsAssert.cs +++ b/source/backend/tests/core/PimsAssert.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; -using Pims.Api.Policies; +using Pims.Core.Api.Policies; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Core.Test diff --git a/source/backend/tests/core/PrincipalHelper.cs b/source/backend/tests/core/PrincipalHelper.cs index 6182338338..01071c08d3 100644 --- a/source/backend/tests/core/PrincipalHelper.cs +++ b/source/backend/tests/core/PrincipalHelper.cs @@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Security.Claims; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Core.Test { diff --git a/source/backend/tests/core/ServiceHelper.cs b/source/backend/tests/core/ServiceHelper.cs index 1604f6baf1..31e0001892 100644 --- a/source/backend/tests/core/ServiceHelper.cs +++ b/source/backend/tests/core/ServiceHelper.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Security.Claims; using Pims.Dal; -using Pims.Dal.Security; +using Pims.Core.Security; namespace Pims.Core.Test { diff --git a/source/backend/tests/unit/api/Controllers/AccessControllerTest.cs b/source/backend/tests/unit/api/Controllers/AccessControllerTest.cs index 3d43cb022c..70589acb1c 100644 --- a/source/backend/tests/unit/api/Controllers/AccessControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/AccessControllerTest.cs @@ -7,7 +7,7 @@ using Pims.Api.Models.Concepts.AccessRequest; using Pims.Api.Models.Concepts.Role; using Pims.Api.Controllers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Core.Test; using Pims.Dal.Repositories; using Xunit; diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs index 638932361c..5b348d28c1 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs @@ -9,7 +9,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/AgreementControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/AgreementControllerTest.cs index 0b75e81439..9ec461dd70 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/AgreementControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/AgreementControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs index 6797340fd3..0411ff808d 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs @@ -6,11 +6,11 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Pims.Api.Models.Concepts.File; using System; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using FluentAssertions; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs index f0e1d4681d..8696126f3a 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs @@ -9,7 +9,7 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Admin/AccessRequestControllerTest.cs b/source/backend/tests/unit/api/Controllers/Admin/AccessRequestControllerTest.cs index 3344d38130..fa4321b7e9 100644 --- a/source/backend/tests/unit/api/Controllers/Admin/AccessRequestControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Admin/AccessRequestControllerTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; using Pims.Api.Models.Base; diff --git a/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs b/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs index 5fb73354fc..f21b5c5ebc 100644 --- a/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs @@ -8,7 +8,7 @@ using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Admin.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Admin/UserControllerTest.cs b/source/backend/tests/unit/api/Controllers/Admin/UserControllerTest.cs index aba2b1f5c2..ec4b0dc786 100644 --- a/source/backend/tests/unit/api/Controllers/Admin/UserControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Admin/UserControllerTest.cs @@ -10,7 +10,7 @@ using Pims.Api.Models.Concepts.User; using Pims.Core.Test; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs index e9bcc2acd6..657d1036bc 100644 --- a/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs @@ -4,11 +4,11 @@ using MapsterMapper; using Microsoft.AspNetCore.Http; using Moq; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services.Interfaces; using Pims.Core.Test; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; using SearchController = Pims.Api.Areas.Contact.Controllers.SearchController; diff --git a/source/backend/tests/unit/api/Controllers/Disposition/ChecklistControllerTest.cs b/source/backend/tests/unit/api/Controllers/Disposition/ChecklistControllerTest.cs index 5ca01fdb63..199c1fae27 100644 --- a/source/backend/tests/unit/api/Controllers/Disposition/ChecklistControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Disposition/ChecklistControllerTest.cs @@ -6,11 +6,11 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Pims.Api.Models.Concepts.File; using System; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using FluentAssertions; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Disposition/DispositionControllerTest.cs b/source/backend/tests/unit/api/Controllers/Disposition/DispositionControllerTest.cs index e4dfe32574..16c499c8b9 100644 --- a/source/backend/tests/unit/api/Controllers/Disposition/DispositionControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Disposition/DispositionControllerTest.cs @@ -8,7 +8,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Disposition/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Disposition/SearchControllerTest.cs index 9a88c34d3b..3fa42cebb7 100644 --- a/source/backend/tests/unit/api/Controllers/Disposition/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Disposition/SearchControllerTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Document/DocumentControllerTest.cs b/source/backend/tests/unit/api/Controllers/Document/DocumentControllerTest.cs index d784fded03..14ced1b1b9 100644 --- a/source/backend/tests/unit/api/Controllers/Document/DocumentControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Document/DocumentControllerTest.cs @@ -8,13 +8,13 @@ using Moq; using Pims.Api.Controllers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Requests.Document.UpdateMetadata; using Pims.Api.Models.Requests.Http; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs b/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs index d37cd7aa97..873f859421 100644 --- a/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs @@ -7,7 +7,7 @@ using Pims.Api.Controllers; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs b/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs index fb7c6532ed..3b18349e70 100644 --- a/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs @@ -6,11 +6,11 @@ using Pims.Api.Models.Concepts.FormDocument; using Pims.Api.Constants; using Pims.Api.Controllers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs b/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs index 33cf406633..16eef25070 100644 --- a/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Areas.CompensationRequisition.Controllers; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Keycloak/AccessRequestControllerTest.cs b/source/backend/tests/unit/api/Controllers/Keycloak/AccessRequestControllerTest.cs index bb4ae50c33..d8bcf105e7 100644 --- a/source/backend/tests/unit/api/Controllers/Keycloak/AccessRequestControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Keycloak/AccessRequestControllerTest.cs @@ -8,7 +8,7 @@ using Pims.Api.Models.Concepts.AccessRequest; using Pims.Core.Test; using Pims.Dal.Keycloak; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Keycloak/UserControllerTest.cs b/source/backend/tests/unit/api/Controllers/Keycloak/UserControllerTest.cs index a34904136a..0aa0a73a6e 100644 --- a/source/backend/tests/unit/api/Controllers/Keycloak/UserControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Keycloak/UserControllerTest.cs @@ -7,7 +7,7 @@ using Pims.Api.Models.Concepts.User; using Pims.Core.Test; using Pims.Dal.Keycloak; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Leases/ConsultationControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/ConsultationControllerTest.cs index b4c772c6ff..87472d793a 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/ConsultationControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/ConsultationControllerTest.cs @@ -7,14 +7,14 @@ using Moq; using Pims.Api.Areas.Disposition.Controllers; using Pims.Api.Areas.Lease.Controllers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Concepts.DispositionFile; using Pims.Api.Models.Concepts.Lease; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs index f069e2d70c..f72948b5a6 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs @@ -10,7 +10,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Lease diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs index 8c8266de65..b2f5487513 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Models.Concepts.Lease; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Lease diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs index 86d297fa49..1b3b015a25 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs @@ -5,7 +5,7 @@ using Pims.Api.Models.Concepts.Lease; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Lease diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeasePeriodControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeasePeriodControllerTest.cs index 33d34ef334..0d41c3237f 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeasePeriodControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeasePeriodControllerTest.cs @@ -5,7 +5,7 @@ using Pims.Api.Models.Concepts.Lease; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Lease diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseStakeholderControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseStakeholderControllerTest.cs index 41448861de..2fb601b51b 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseStakeholderControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseStakeholderControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Models.Concepts.Lease; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Lease diff --git a/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs index 587670bdcd..6274097835 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs @@ -5,11 +5,11 @@ using Microsoft.AspNetCore.Http; using Moq; using Pims.Api.Areas.Lease.Controllers; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; using SModel = Pims.Api.Areas.Lease.Models.Search; diff --git a/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs b/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs index ee98d5066f..a170bf8e6b 100644 --- a/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs @@ -9,7 +9,7 @@ using Pims.Api.Controllers; using Pims.Core.Test; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs b/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs index 3c94da30ad..66933d1473 100644 --- a/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Constants; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Note diff --git a/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs b/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs index 67e1849d3f..8a694ce39b 100644 --- a/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs @@ -5,7 +5,7 @@ using Pims.Api.Models.Concepts.Organization; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs b/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs index 2c97c40192..d56a3f1482 100644 --- a/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs @@ -7,13 +7,13 @@ using Moq; using Pims.Api.Areas.Projects.Controllers; using Pims.Api.Models.Concepts.Project; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Exceptions; using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs index c0e3a8c766..9d0ee05230 100644 --- a/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs @@ -4,7 +4,7 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities.Models; diff --git a/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs b/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs index 3a01b7ab2d..0b62a7317f 100644 --- a/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs @@ -6,7 +6,7 @@ using Pims.Api.Models.Concepts.Property; using Pims.Api.Services; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.Property diff --git a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs index 11a22c1721..f011110833 100644 --- a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs @@ -11,7 +11,7 @@ using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; using Pims.Api.Areas.Property.Models.Search; diff --git a/source/backend/tests/unit/api/Controllers/PropertyOperation/PropertyOperationControllerTest.cs b/source/backend/tests/unit/api/Controllers/PropertyOperation/PropertyOperationControllerTest.cs index 2ed2a7e6b1..2ace966c5b 100644 --- a/source/backend/tests/unit/api/Controllers/PropertyOperation/PropertyOperationControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/PropertyOperation/PropertyOperationControllerTest.cs @@ -12,7 +12,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Controllers.PropertyOperation diff --git a/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs index 9015e0e3b9..a9d8df3041 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs @@ -13,14 +13,14 @@ using Pims.Api.Areas.Lease.Models.Search; using Pims.Api.Areas.Reports.Controllers; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Extensions; using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; @@ -533,7 +533,7 @@ public void ExportAggregatedLeases_ExcelX_Success() var lease = EntityHelper.CreateLease(1, region: new PimsRegion() { Id = 1 }); var leases = new[] { lease }; - var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); + var path = Directory.GetCurrentDirectory(); this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); this._lookupRepository.Setup(m => m.GetAllRegions()).Returns(new List() { lease.RegionCodeNavigation }); @@ -562,9 +562,6 @@ public void ExportAggregatedLeases_ExcelX_InvalidFiscal() var leases = new[] { EntityHelper.CreateLease(1) }; - var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); - this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); - this._service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); // Act @@ -586,7 +583,7 @@ public void ExportLeasePayments_ExcelX_Success() var helper = new TestHelper(); this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); - var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); + var path = Directory.GetCurrentDirectory(); this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); this._paymentService.Setup(m => m.GetAllByDateRange(It.IsAny(), It.IsAny())).Returns(new List()); diff --git a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs index ed132ffb34..90f45a2f75 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs @@ -8,11 +8,11 @@ using Pims.Api.Areas.Property.Models.Search; using Pims.Api.Areas.Reports.Controllers; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs index e588e6bef2..3463db36b2 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs @@ -7,11 +7,11 @@ using Moq; using Pims.Api.Areas.Reports.Controllers; using Pims.Api.Helpers.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs index ba377c5e59..ce15e3ffee 100644 --- a/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs @@ -9,11 +9,11 @@ using Pims.Api.Areas.Research.Controllers; using Pims.Api.Areas.Research.Models.Search; using Pims.Api.Models.Concepts.ResearchFile; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities.Models; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; using SModel = Pims.Api.Areas.Research.Models.Search; diff --git a/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs b/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs index 7eb3cc9c50..45cee5ad8a 100644 --- a/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs @@ -9,10 +9,10 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using System; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Dal.Exceptions; namespace Pims.Api.Test.Controllers diff --git a/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs b/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs index 573792cc3f..f1388eacc8 100644 --- a/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs @@ -3,7 +3,7 @@ using Moq; using Pims.Api.Areas.Tools.Controllers; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Pims.Geocoder; using Pims.Geocoder.Models; using Pims.Geocoder.Parameters; diff --git a/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs b/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs index 823dc36ff8..4a0cea6fde 100644 --- a/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs @@ -5,7 +5,7 @@ using Moq; using Pims.Api.Areas.Tools.Controllers; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Pims.Ltsa; using Xunit; using Model = Pims.Ltsa.Models; diff --git a/source/backend/tests/unit/api/Exceptions/ApiHttpRequestExceptionTest.cs b/source/backend/tests/unit/api/Exceptions/ApiHttpRequestExceptionTest.cs index 532c579e31..6a803024cf 100644 --- a/source/backend/tests/unit/api/Exceptions/ApiHttpRequestExceptionTest.cs +++ b/source/backend/tests/unit/api/Exceptions/ApiHttpRequestExceptionTest.cs @@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis; using System.Net; using FluentAssertions; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Xunit; namespace Pims.Api.Test.Exceptions @@ -47,7 +47,7 @@ public void ApiHttpRequestException_Constructor_01_NullMessage() var exception = new ApiHttpRequestException((string)null); // Assert - exception.Message.Should().Be("Exception of type 'Pims.Api.Helpers.Exceptions.ApiHttpRequestException' was thrown."); + exception.Message.Should().Be("Exception of type 'Pims.Core.Api.Exceptions.ApiHttpRequestException' was thrown."); exception.StatusCode.Should().Be(HttpStatusCode.InternalServerError); } #endregion @@ -93,7 +93,7 @@ public void ApiHttpRequestException_Constructor_02_NullMessage() var exception = new ApiHttpRequestException((string)null, inner); // Assert - exception.Message.Should().Be("Exception of type 'Pims.Api.Helpers.Exceptions.ApiHttpRequestException' was thrown."); + exception.Message.Should().Be("Exception of type 'Pims.Core.Api.Exceptions.ApiHttpRequestException' was thrown."); exception.StatusCode.Should().Be(HttpStatusCode.InternalServerError); exception.InnerException.Should().Be(inner); } diff --git a/source/backend/tests/unit/api/Helpers/ExceptionExtensionsTest.cs b/source/backend/tests/unit/api/Helpers/ExceptionExtensionsTest.cs index 60e9ac35a1..11cac0be64 100644 --- a/source/backend/tests/unit/api/Helpers/ExceptionExtensionsTest.cs +++ b/source/backend/tests/unit/api/Helpers/ExceptionExtensionsTest.cs @@ -1,6 +1,6 @@ using System; using System.Diagnostics.CodeAnalysis; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Helpers.Extensions; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs b/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs index 8ec93e08e6..f7e9fc91f3 100644 --- a/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs +++ b/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using FluentAssertions; +using Pims.Core.Exceptions; using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; diff --git a/source/backend/tests/unit/api/Routes/Acquisition/AcquisitionControllerTest.cs b/source/backend/tests/unit/api/Routes/Acquisition/AcquisitionControllerTest.cs index c149812f8e..d6063a83a6 100644 --- a/source/backend/tests/unit/api/Routes/Acquisition/AcquisitionControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Acquisition/AcquisitionControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Models.Concepts.AcquisitionFile; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes diff --git a/source/backend/tests/unit/api/Routes/Admin/AccessRequestControllerTest.cs b/source/backend/tests/unit/api/Routes/Admin/AccessRequestControllerTest.cs index cfb2defb65..66c5ecd3af 100644 --- a/source/backend/tests/unit/api/Routes/Admin/AccessRequestControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Admin/AccessRequestControllerTest.cs @@ -2,7 +2,7 @@ using Pims.Api.Models.Concepts.AccessRequest; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes.Admin diff --git a/source/backend/tests/unit/api/Routes/Keycloak/AccessRequestControllerTest.cs b/source/backend/tests/unit/api/Routes/Keycloak/AccessRequestControllerTest.cs index a0dcb13288..0098a3a4bf 100644 --- a/source/backend/tests/unit/api/Routes/Keycloak/AccessRequestControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Keycloak/AccessRequestControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Models.Concepts.AccessRequest; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes.Keycloak diff --git a/source/backend/tests/unit/api/Routes/Notes/NoteControllerTest.cs b/source/backend/tests/unit/api/Routes/Notes/NoteControllerTest.cs index 520fd57276..698b32063e 100644 --- a/source/backend/tests/unit/api/Routes/Notes/NoteControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Notes/NoteControllerTest.cs @@ -4,7 +4,7 @@ using Pims.Api.Constants; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes diff --git a/source/backend/tests/unit/api/Routes/Property/PropertyControllerTest.cs b/source/backend/tests/unit/api/Routes/Property/PropertyControllerTest.cs index a521477e8a..10d77f6581 100644 --- a/source/backend/tests/unit/api/Routes/Property/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Property/PropertyControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Models.Concepts.Property; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes diff --git a/source/backend/tests/unit/api/Routes/Property/SearchControllerTest.cs b/source/backend/tests/unit/api/Routes/Property/SearchControllerTest.cs index 520bc5cccd..db96fc4c6d 100644 --- a/source/backend/tests/unit/api/Routes/Property/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Property/SearchControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Areas.Property.Models.Search; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes diff --git a/source/backend/tests/unit/api/Routes/Reports/PropertyControllerTest.cs b/source/backend/tests/unit/api/Routes/Reports/PropertyControllerTest.cs index 60679c7d0b..6a69f6a57d 100644 --- a/source/backend/tests/unit/api/Routes/Reports/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Reports/PropertyControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Areas.Reports.Controllers; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes.Reports diff --git a/source/backend/tests/unit/api/Routes/Tools/GeocoderControllerTest.cs b/source/backend/tests/unit/api/Routes/Tools/GeocoderControllerTest.cs index 44fe6b56cb..0ccecd8a9f 100644 --- a/source/backend/tests/unit/api/Routes/Tools/GeocoderControllerTest.cs +++ b/source/backend/tests/unit/api/Routes/Tools/GeocoderControllerTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Areas.Tools.Controllers; using Pims.Core.Extensions; using Pims.Core.Test; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Routes.Project diff --git a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs index 5063351fd2..8cddcd197c 100644 --- a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; using Moq; using NetTopologySuite.Geometries; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Services; using Pims.Core.Exceptions; @@ -15,7 +15,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs b/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs index 206c4556ad..1bbc197ff7 100644 --- a/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs +++ b/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs @@ -10,8 +10,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs b/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs index 11ae3c07a2..9675b4d833 100644 --- a/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs +++ b/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs @@ -8,7 +8,7 @@ using FluentAssertions; using Moq; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Cdogs; using Pims.Api.Models.CodeTypes; using Pims.Api.Services; @@ -17,7 +17,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Sprache; using Xunit; using FileTypes = Pims.Api.Models.CodeTypes.FileTypes; diff --git a/source/backend/tests/unit/api/Services/DispositionFileServiceTest.cs b/source/backend/tests/unit/api/Services/DispositionFileServiceTest.cs index 2970a1c815..b51dcb1ab8 100644 --- a/source/backend/tests/unit/api/Services/DispositionFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DispositionFileServiceTest.cs @@ -6,7 +6,7 @@ using Moq; using NetTopologySuite.Geometries; using Pims.Api.Constants; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Services; using Pims.Core.Exceptions; @@ -15,7 +15,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs index 0847b98d42..da9d935eb4 100644 --- a/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs @@ -4,19 +4,20 @@ using System.Threading.Tasks; using FluentAssertions; using Moq; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Pims.Api.Models.Concepts.Document; using Pims.Api.Models.Requests.Document.Upload; using Pims.Api.Models.Requests.Http; using Pims.Api.Models.CodeTypes; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/DocumentServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentServiceTest.cs index b21695aea4..b43525fab6 100644 --- a/source/backend/tests/unit/api/Services/DocumentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentServiceTest.cs @@ -5,7 +5,7 @@ using FluentAssertions; using Microsoft.AspNetCore.Http; using Moq; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.Mayan; using Pims.Api.Models.Mayan.Document; @@ -16,7 +16,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Pims.Api.Models.Concepts.Document; diff --git a/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs index b36460e3ed..c2226088e0 100644 --- a/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs @@ -16,7 +16,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; diff --git a/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs b/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs index a2d61d2bc0..54db265587 100644 --- a/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs @@ -4,8 +4,9 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Exceptions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs b/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs index 3f584e9ecf..28cd914d70 100644 --- a/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs +++ b/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs @@ -12,7 +12,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs b/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs index 214eefb882..7d1abef4b9 100644 --- a/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs @@ -11,8 +11,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs b/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs index 378306076b..e203af5557 100644 --- a/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs +++ b/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs @@ -3,7 +3,7 @@ using Pims.Api.Services; using Pims.Core.Test; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/LeasePeriodServiceTest.cs b/source/backend/tests/unit/api/Services/LeasePeriodServiceTest.cs index 22413b9738..cfd677675d 100644 --- a/source/backend/tests/unit/api/Services/LeasePeriodServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeasePeriodServiceTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs b/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs index 8dae7e488a..8f1b23779b 100644 --- a/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs @@ -10,8 +10,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/LeaseServiceTest.cs b/source/backend/tests/unit/api/Services/LeaseServiceTest.cs index dd521af512..206eedb102 100644 --- a/source/backend/tests/unit/api/Services/LeaseServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeaseServiceTest.cs @@ -13,7 +13,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/NoteServiceTest.cs b/source/backend/tests/unit/api/Services/NoteServiceTest.cs index 411a103498..e8378e363d 100644 --- a/source/backend/tests/unit/api/Services/NoteServiceTest.cs +++ b/source/backend/tests/unit/api/Services/NoteServiceTest.cs @@ -10,8 +10,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/PaymentServiceTest.cs b/source/backend/tests/unit/api/Services/PaymentServiceTest.cs index 51ce238337..4e0f6316c2 100644 --- a/source/backend/tests/unit/api/Services/PaymentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/PaymentServiceTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using static Pims.Dal.Entities.PimsLeasePaymentStatusType; diff --git a/source/backend/tests/unit/api/Services/ProjectServiceTest.cs b/source/backend/tests/unit/api/Services/ProjectServiceTest.cs index 7d7d174c7a..d3bd4b8423 100644 --- a/source/backend/tests/unit/api/Services/ProjectServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ProjectServiceTest.cs @@ -10,7 +10,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/PropertyOperationServiceTest.cs b/source/backend/tests/unit/api/Services/PropertyOperationServiceTest.cs index 82170e3d9d..d6e1990923 100644 --- a/source/backend/tests/unit/api/Services/PropertyOperationServiceTest.cs +++ b/source/backend/tests/unit/api/Services/PropertyOperationServiceTest.cs @@ -10,7 +10,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/PropertyServiceTest.cs b/source/backend/tests/unit/api/Services/PropertyServiceTest.cs index 3a13138780..3535ce0750 100644 --- a/source/backend/tests/unit/api/Services/PropertyServiceTest.cs +++ b/source/backend/tests/unit/api/Services/PropertyServiceTest.cs @@ -4,7 +4,7 @@ using FluentAssertions; using Moq; using NetTopologySuite.Geometries; -using Pims.Api.Helpers.Exceptions; +using Pims.Core.Api.Exceptions; using Pims.Api.Models.CodeTypes; using Pims.Api.Services; using Pims.Core.Exceptions; @@ -14,7 +14,7 @@ using Pims.Dal.Exceptions; using Pims.Dal.Helpers; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs b/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs index 503365eeca..86f0bd29b3 100644 --- a/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs @@ -13,8 +13,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Api.Test.Services { diff --git a/source/backend/tests/unit/api/Services/TakeServiceTest.cs b/source/backend/tests/unit/api/Services/TakeServiceTest.cs index 99ddee1831..135cb8aaa7 100644 --- a/source/backend/tests/unit/api/Services/TakeServiceTest.cs +++ b/source/backend/tests/unit/api/Services/TakeServiceTest.cs @@ -11,7 +11,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Api.Test.Services diff --git a/source/backend/tests/unit/dal/Core/Converters/JsonEnumValueConverterTest.cs b/source/backend/tests/unit/dal/Core/Converters/JsonEnumValueConverterTest.cs index 55c3e845a2..9bf7aac0b6 100644 --- a/source/backend/tests/unit/dal/Core/Converters/JsonEnumValueConverterTest.cs +++ b/source/backend/tests/unit/dal/Core/Converters/JsonEnumValueConverterTest.cs @@ -5,7 +5,7 @@ using FluentAssertions; using NetTopologySuite.Geometries; using Pims.Core.Converters; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Core.Converters diff --git a/source/backend/tests/unit/dal/Core/Helpers/CsvHelperTest.cs b/source/backend/tests/unit/dal/Core/Helpers/CsvHelperTest.cs index cb8c10ee2c..a6de6bc25b 100644 --- a/source/backend/tests/unit/dal/Core/Helpers/CsvHelperTest.cs +++ b/source/backend/tests/unit/dal/Core/Helpers/CsvHelperTest.cs @@ -3,7 +3,7 @@ using System.Data; using System.Diagnostics.CodeAnalysis; using Pims.Core.Helpers; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/dal/Exceptions/NotAuthorizedExceptionTest.cs b/source/backend/tests/unit/dal/Exceptions/NotAuthorizedExceptionTest.cs index 16cc3978ad..43b75d6225 100644 --- a/source/backend/tests/unit/dal/Exceptions/NotAuthorizedExceptionTest.cs +++ b/source/backend/tests/unit/dal/Exceptions/NotAuthorizedExceptionTest.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using FluentAssertions; +using Pims.Core.Exceptions; using Pims.Dal.Exceptions; using Xunit; @@ -22,7 +23,7 @@ public void NotAuthorizedException_Base_Constructor() var exception = new NotAuthorizedException(); // Assert - exception.Message.Should().Be("Exception of type 'Pims.Dal.Exceptions.NotAuthorizedException' was thrown."); + exception.Message.Should().Be("Exception of type 'Pims.Core.Exceptions.NotAuthorizedException' was thrown."); } [Fact] diff --git a/source/backend/tests/unit/dal/Helpers/Extensions/EntityExtensionsTest.cs b/source/backend/tests/unit/dal/Helpers/Extensions/EntityExtensionsTest.cs index 0f95b3361f..fa818b5644 100644 --- a/source/backend/tests/unit/dal/Helpers/Extensions/EntityExtensionsTest.cs +++ b/source/backend/tests/unit/dal/Helpers/Extensions/EntityExtensionsTest.cs @@ -4,8 +4,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Helpers.Extensions; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Helpers.Extensions { diff --git a/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs b/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs index 940078666f..7cecec773c 100644 --- a/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs +++ b/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs @@ -9,10 +9,11 @@ using Pims.Dal.Exceptions; using Pims.Dal.Keycloak; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Pims.Keycloak.Models; using Xunit; using Entity = Pims.Dal.Entities; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Libraries.Keycloak { diff --git a/source/backend/tests/unit/dal/Repositories/AccessRequestRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AccessRequestRepositoryTest.cs index d387395c93..32bde0396e 100644 --- a/source/backend/tests/unit/dal/Repositories/AccessRequestRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AccessRequestRepositoryTest.cs @@ -8,8 +8,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs index 1a735eda6e..dcd8dd0506 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs index 27d62e3e19..10b8a9aa0b 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs @@ -3,7 +3,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFileFormRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFileFormRepositoryTest.cs index 472fbb3d1f..6fcbb1712c 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFileFormRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFileFormRepositoryTest.cs @@ -6,7 +6,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFilePropertyRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFilePropertyRepositoryTest.cs index 48cba01aca..e467e3bcfc 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFilePropertyRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFilePropertyRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs index 5ce502195b..96e8f08ade 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs @@ -10,7 +10,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs index 901ea8921b..0f08893d87 100644 --- a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs index b0980c9ab9..563f7c954b 100644 --- a/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs index d4f74c6178..58e7bc3a3c 100644 --- a/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs index 1dcc1da749..18738e5e03 100644 --- a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs @@ -7,8 +7,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/ConsultationRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ConsultationRepositoryTest.cs index 83ed5c9bea..2c556fbe09 100644 --- a/source/backend/tests/unit/dal/Repositories/ConsultationRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ConsultationRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ContactRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ContactRepositoryTest.cs index 0e8b157ca0..d6aee7bf00 100644 --- a/source/backend/tests/unit/dal/Repositories/ContactRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ContactRepositoryTest.cs @@ -4,8 +4,9 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Services { diff --git a/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs index 63d6b4fa5c..c18ad65af8 100644 --- a/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/DispositionFileChecklistRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/DispositionFileChecklistRepositoryTest.cs index a2d86374d3..233c5b30af 100644 --- a/source/backend/tests/unit/dal/Repositories/DispositionFileChecklistRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/DispositionFileChecklistRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/DispositionFileDocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/DispositionFileDocumentRepositoryTest.cs index 75d1859400..0a2a765917 100644 --- a/source/backend/tests/unit/dal/Repositories/DispositionFileDocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/DispositionFileDocumentRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/DispositionFilePropertyRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/DispositionFilePropertyRepositoryTest.cs index b7124a8937..bf3dd0ab4c 100644 --- a/source/backend/tests/unit/dal/Repositories/DispositionFilePropertyRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/DispositionFilePropertyRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/DispositionFileRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/DispositionFileRepositoryTest.cs index 3e14a0c398..812f38e624 100644 --- a/source/backend/tests/unit/dal/Repositories/DispositionFileRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/DispositionFileRepositoryTest.cs @@ -9,7 +9,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/DocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/DocumentRepositoryTest.cs index 05c2cb759b..4735b77c92 100644 --- a/source/backend/tests/unit/dal/Repositories/DocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/DocumentRepositoryTest.cs @@ -7,8 +7,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/ExpropriationPaymentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ExpropriationPaymentRepositoryTest.cs index 7320c17034..8e36cba72c 100644 --- a/source/backend/tests/unit/dal/Repositories/ExpropriationPaymentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ExpropriationPaymentRepositoryTest.cs @@ -6,7 +6,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs index a0b47a4298..7a2d78f688 100644 --- a/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs index e82c8ab59d..5afcea10e7 100644 --- a/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs @@ -6,8 +6,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs index d84dbd07e1..0a5e37cb7e 100644 --- a/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/LeaseRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/LeaseRepositoryTest.cs index d879fa7244..c0df840be2 100644 --- a/source/backend/tests/unit/dal/Repositories/LeaseRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/LeaseRepositoryTest.cs @@ -13,7 +13,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs index 42dc374cd0..466db20393 100644 --- a/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/OrganizationRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/OrganizationRepositoryTest.cs index 6c90972370..a583d1b534 100644 --- a/source/backend/tests/unit/dal/Repositories/OrganizationRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/OrganizationRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/PersonRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/PersonRepositoryTest.cs index 2154d0e648..85d98baa0a 100644 --- a/source/backend/tests/unit/dal/Repositories/PersonRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/PersonRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs index 53711b63dc..62872c78ac 100644 --- a/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ProjectRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ProjectRepositoryTest.cs index 3d412ea9c9..43ffdbf6f1 100644 --- a/source/backend/tests/unit/dal/Repositories/ProjectRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ProjectRepositoryTest.cs @@ -8,8 +8,9 @@ using Pims.Dal.Entities; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/PropertyActivityDocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/PropertyActivityDocumentRepositoryTest.cs index d0334ef354..8e371c649d 100644 --- a/source/backend/tests/unit/dal/Repositories/PropertyActivityDocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/PropertyActivityDocumentRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/PropertyActivityRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/PropertyActivityRepositoryTest.cs index 8e82f2ac1c..9a8760dccf 100644 --- a/source/backend/tests/unit/dal/Repositories/PropertyActivityRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/PropertyActivityRepositoryTest.cs @@ -5,7 +5,7 @@ using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/PropertyOperationRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/PropertyOperationRepositoryTest.cs index bb2266d834..d342ddb7b7 100644 --- a/source/backend/tests/unit/dal/Repositories/PropertyOperationRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/PropertyOperationRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/PropertyRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/PropertyRepositoryTest.cs index e1cfc256e8..7d02c216c0 100644 --- a/source/backend/tests/unit/dal/Repositories/PropertyRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/PropertyRepositoryTest.cs @@ -11,7 +11,7 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/dal/Repositories/ProvinceRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ProvinceRepositoryTest.cs index 9a5abb2ace..8896ef91e1 100644 --- a/source/backend/tests/unit/dal/Repositories/ProvinceRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ProvinceRepositoryTest.cs @@ -2,7 +2,7 @@ using System.Linq; using Pims.Core.Test; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ResearchFileDocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ResearchFileDocumentRepositoryTest.cs index cafc889bbb..7cf97f7714 100644 --- a/source/backend/tests/unit/dal/Repositories/ResearchFileDocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ResearchFileDocumentRepositoryTest.cs @@ -3,7 +3,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ResearchFilePropertyRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ResearchFilePropertyRepositoryTest.cs index b678386eea..fb2d35e765 100644 --- a/source/backend/tests/unit/dal/Repositories/ResearchFilePropertyRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ResearchFilePropertyRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/ResearchRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ResearchRepositoryTest.cs index 20f5b57c0c..b82cc241e3 100644 --- a/source/backend/tests/unit/dal/Repositories/ResearchRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ResearchRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; diff --git a/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs index 1a659ef23b..9883fbc0a5 100644 --- a/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/RoleRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/RoleRepositoryTest.cs index 77c3fb294a..231f7a72e1 100644 --- a/source/backend/tests/unit/dal/Repositories/RoleRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/RoleRepositoryTest.cs @@ -6,9 +6,10 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/TakeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/TakeRepositoryTest.cs index f561df304f..0f23dec302 100644 --- a/source/backend/tests/unit/dal/Repositories/TakeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/TakeRepositoryTest.cs @@ -4,7 +4,7 @@ using FluentAssertions; using Pims.Core.Test; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/UserRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/UserRepositoryTest.cs index 3458992f7f..fb6407ae87 100644 --- a/source/backend/tests/unit/dal/Repositories/UserRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/UserRepositoryTest.cs @@ -10,9 +10,10 @@ using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; using Entity = Pims.Dal.Entities; +using Pims.Core.Exceptions; namespace Pims.Dal.Test.Repositories { diff --git a/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs index e1ec6709a6..6f361ce180 100644 --- a/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs index ee25c62617..5b31a1c266 100644 --- a/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs @@ -4,7 +4,7 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Xunit; namespace Pims.Dal.Test.Repositories diff --git a/source/backend/tests/unit/mockdal/Repositories/ContactRepositoryTest.cs b/source/backend/tests/unit/mockdal/Repositories/ContactRepositoryTest.cs index 662038f01a..e7f08b9848 100644 --- a/source/backend/tests/unit/mockdal/Repositories/ContactRepositoryTest.cs +++ b/source/backend/tests/unit/mockdal/Repositories/ContactRepositoryTest.cs @@ -7,7 +7,7 @@ using Pims.Core.Test; using Pims.Dal.Entities.Models; using Pims.Dal.Repositories; -using Pims.Dal.Security; +using Pims.Core.Security; using Entity = Pims.Dal.Entities; using FluentAssertions; using Xunit; diff --git a/source/frontend/src/mocks/msw/handlers.ts b/source/frontend/src/mocks/msw/handlers.ts index c71a582563..2b157df19b 100644 --- a/source/frontend/src/mocks/msw/handlers.ts +++ b/source/frontend/src/mocks/msw/handlers.ts @@ -1,4 +1,4 @@ -import { bypass, http, HttpResponse } from 'msw'; +import { http, HttpResponse } from 'msw'; import { getMockAddresses, @@ -37,13 +37,4 @@ export const handlers = [ return HttpResponse.json(mockDistrictLayerResponse, { status: 200 }); } }), - - http.get('http://localhost:3000/ogs-internal/ows', async ({ request }) => { - const search = new URL(request.url).search; - if (search.includes('ISS_PROVINCIAL_PUBLIC_HIGHWAY')) { - return HttpResponse.json(mockMotiRegionLayerResponse, { status: 200 }); - } else { - return await fetch(bypass(request)); - } - }), ]; diff --git a/source/frontend/src/setupProxy.js b/source/frontend/src/setupProxy.js deleted file mode 100644 index 1d610837f7..0000000000 --- a/source/frontend/src/setupProxy.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const { createProxyMiddleware } = require('http-proxy-middleware'); - -module.exports = function (app) { - app.use( - '/api', - createProxyMiddleware({ - target: import.meta.env.API_URL || 'http://localhost:5000/', - changeOrigin: true, - secure: false, - // timeout: 2000, - xfwd: true, - logLevel: 'debug', - cookiePathRewrite: '/', - cookieDomainRewrite: '', - pathRewrite: function (path) { - return path; - }, - onProxyReq: function (proxyReq) { - proxyReq.setHeader('x-powered-by', 'onProxyReq'); - }, - }), - ); - app.use( - '/ogs-internal', - createProxyMiddleware({ - target: 'http://localhost:5000/api/geoserver', - changeOrigin: true, - secure: false, - // timeout: 2000, - xfwd: true, - logLevel: 'debug', - cookiePathRewrite: '/', - cookieDomainRewrite: '', - pathRewrite: { - '^/ogs-internal/': '/', // remove base path - }, - onProxyReq: function (proxyReq) { - proxyReq.setHeader('x-powered-by', 'onProxyReq'); - }, - }), - ); -}; diff --git a/source/frontend/vite.config.ts b/source/frontend/vite.config.ts index bedf5cb655..57ca7e6faa 100644 --- a/source/frontend/vite.config.ts +++ b/source/frontend/vite.config.ts @@ -94,7 +94,7 @@ export default defineConfig({ cookieDomainRewrite: '', }, '/ogs-internal': { - target: 'http://localhost:5000/api/geoserver', + target: 'http://localhost:5002/proxy/geoserver', changeOrigin: true, rewrite: (path: string) => path.replace(/^\/ogs-internal/, '/'), xfwd: true, From e7983ef73df1f102c68c05e343e924f1dfb4ad5b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:24:43 +0000 Subject: [PATCH 2/2] CI: Bump version to v5.7.0-93.6 --- source/backend/api/Pims.Api.csproj | 4 ++-- source/frontend/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/backend/api/Pims.Api.csproj b/source/backend/api/Pims.Api.csproj index 1f5cf4b922..8b5539a366 100644 --- a/source/backend/api/Pims.Api.csproj +++ b/source/backend/api/Pims.Api.csproj @@ -2,8 +2,8 @@ 0ef6255f-9ea0-49ec-8c65-c172304b4926 - 5.7.0-93.5 - 5.7.0-93.5 + 5.7.0-93.6 + 5.7.0-93.6 5.7.0.93 true {16BC0468-78F6-4C91-87DA-7403C919E646} diff --git a/source/frontend/package.json b/source/frontend/package.json index 7b39f43056..9373c48b8e 100644 --- a/source/frontend/package.json +++ b/source/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "5.7.0-93.5", + "version": "5.7.0-93.6", "private": true, "dependencies": { "@bcgov/bc-sans": "1.0.1",