From 59f5285c889cf7e219d093524f3b4e5cc399087f Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 24 Jan 2023 19:57:28 +0100 Subject: [PATCH] [SM-460] Isolate SecretsManager files (#2616) Move SecretsManager files to directories called SecretsManager and add CodeOwners --- .github/CODEOWNERS | 5 +++ .../CreateAccessPoliciesCommand.cs | 10 ++--- .../DeleteAccessPolicyCommand.cs | 6 +-- .../UpdateAccessPolicyCommand.cs | 10 ++--- .../AccessTokens/CreateAccessTokenCommand.cs | 8 ++-- .../Projects/CreateProjectCommand.cs | 8 ++-- .../Projects/DeleteProjectCommand.cs | 8 ++-- .../Projects/UpdateProjectCommand.cs | 8 ++-- .../Commands}/Secrets/CreateSecretCommand.cs | 8 ++-- .../Commands}/Secrets/DeleteSecretCommand.cs | 10 ++--- .../Commands}/Secrets/UpdateSecretCommand.cs | 10 ++--- .../CreateServiceAccountCommand.cs | 8 ++-- .../UpdateServiceAccountCommand.cs | 8 ++-- .../SecretsManagerCollectionExtensions.cs} | 26 ++++++------ ...cretsManagerServiceCollectionExtensions.cs | 11 +++++ .../Utilities/ServiceCollectionExtensions.cs | 8 +--- .../Repositories/AccessPolicyRepository.cs | 40 +++++++++---------- .../Repositories/ProjectRepository.cs | 20 +++++----- .../Repositories/SecretRepository.cs | 28 ++++++------- .../Repositories/ServiceAccountRepository.cs | 12 +++--- ...tsManagerEFServiceCollectionExtensions.cs} | 10 ++--- .../CreateAccessPoliciesCommandTests.cs | 8 ++-- .../DeleteAccessPolicyCommandTests.cs | 8 ++-- .../UpdateAccessPolicyCommandTests.cs | 8 ++-- .../CreateAccessTokenCommandTests.cs | 8 ++-- .../Projects/DeleteProjectCommandTests.cs | 8 ++-- .../Projects/UpdateProjectCommandTests.cs | 10 ++--- .../Secrets/CreateSecretCommandTests.cs | 10 ++--- .../Secrets/DeleteSecretCommandTests.cs | 8 ++-- .../Secrets/UpdateSecretCommandTests.cs | 10 ++--- .../CreateServiceAccountCommandTests.cs | 8 ++-- .../UpdateServiceAccountCommandTests.cs | 8 ++-- .../Controllers/AccessPoliciesController.cs | 13 +++--- .../Controllers/ProjectsController.cs | 11 +++-- .../Controllers/SecretsController.cs | 11 +++-- .../Controllers/ServiceAccountsController.cs | 14 +++---- .../Request/AccessPoliciesCreateRequest.cs | 4 +- .../Request/AccessPolicyUpdateRequest.cs | 2 +- .../Request/AccessTokenCreateRequestModel.cs | 4 +- .../Request/ProjectCreateRequestModel.cs | 4 +- .../Request/ProjectUpdateRequestModel.cs | 4 +- .../Request/SecretCreateRequestModel.cs | 4 +- .../Request/SecretUpdateRequestModel.cs | 4 +- .../SerivceAccountUpdateRequestModel.cs | 4 +- .../ServiceAccountCreateRequestModel.cs | 4 +- .../Response/AccessPolicyResponseModel.cs | 4 +- .../AccessTokenCreationResponseModel.cs | 4 +- .../Response}/AccessTokenResponseModel.cs | 6 +-- .../Response/BulkDeleteResponseModel.cs | 2 +- .../ProjectAccessPoliciesResponseModel.cs | 6 +-- .../Models/Response/ProjectResponseModel.cs | 6 +-- .../Models/Response/SecretResponseModel.cs | 6 +-- .../SecretWithProjectsListResponseModel.cs | 6 +-- .../Response/ServiceAccountResponseModel.cs | 6 +-- .../SecretsManagerAttribute.cs | 2 +- src/Api/Startup.cs | 5 ++- .../Interfaces/ICreateAccessTokenCommand.cs | 8 ---- .../Interfaces/ICreateProjectCommand.cs | 8 ---- .../Interfaces/ICreateSecretCommand.cs | 8 ---- .../Interfaces/IUpdateSecretCommand.cs | 8 ---- .../ICreateAccessPoliciesCommand.cs | 4 +- .../Interfaces/IDeleteAccessPolicyCommand.cs | 2 +- .../Interfaces/IUpdateAccessPolicyCommand.cs | 4 +- .../Interfaces/ICreateAccessTokenCommand.cs | 8 ++++ .../Interfaces/ICreateProjectCommand.cs | 8 ++++ .../Interfaces/IDeleteProjectCommand.cs | 4 +- .../Interfaces/IUpdateProjectCommand.cs | 4 +- .../Interfaces/ICreateSecretCommand.cs | 8 ++++ .../Interfaces/IDeleteSecretCommand.cs | 4 +- .../Interfaces/IUpdateSecretCommand.cs | 8 ++++ .../ICreateServiceAccountCommand.cs | 4 +- .../IUpdateServiceAccountCommand.cs | 4 +- .../Entities/AccessPolicy.cs | 3 +- .../{ => SecretsManager}/Entities/ApiKey.cs | 3 +- .../{ => SecretsManager}/Entities/Project.cs | 3 +- .../{ => SecretsManager}/Entities/Secret.cs | 3 +- .../Entities/ServiceAccount.cs | 3 +- .../Models/Data/ApiKeyDetails.cs | 4 +- .../Repositories/IAccessPolicyRepository.cs | 4 +- .../Repositories/IApiKeyRepository.cs | 7 ++-- .../Repositories/IProjectRepository.cs | 6 +-- .../Repositories/ISecretRepository.cs | 4 +- .../Repositories/IServiceAccountRepository.cs | 6 +-- src/Identity/IdentityServer/ClientStore.cs | 3 +- .../DapperServiceCollectionExtensions.cs | 2 + .../Repositories/ApiKeyRepository.cs | 9 +++-- ...ityFrameworkServiceCollectionExtensions.cs | 2 + .../Models/ApiKey.cs | 16 -------- .../Repositories/DatabaseContext.cs | 1 + .../AccessPolicyEntityTypeConfiguration.cs | 4 +- .../ApiKeyEntityTypeConfiguration.cs | 4 +- .../ProjectEntityTypeConfiguration.cs | 4 +- .../SecretEntityTypeConfiguration.cs | 4 +- .../ServiceAccountEntityTypeConfiguration.cs | 4 +- .../Models/AccessPolicy.cs | 15 +++---- .../SecretsManager/Models/ApiKey.cs | 16 ++++++++ .../{ => SecretsManager}/Models/Project.cs | 7 ++-- .../{ => SecretsManager}/Models/Secret.cs | 7 ++-- .../Models/ServiceAccount.cs | 7 ++-- .../Repositories/ApiKeyRepository.cs | 15 +++---- .../ApiKey/ApiKeyDetails_ReadById.sql | 0 .../ApiKey/ApiKey_Create.sql | 0 .../ApiKey/ApiKey_ReadByServiceAccountId.sql | 0 .../dbo/Tables/AccessPolicy.sql | 0 .../dbo/Tables/ApiKey.sql | 0 .../dbo/Tables/Project.sql | 0 .../dbo/Tables/ProjectSecret.sql | 0 .../dbo/Tables/Secret.sql | 0 .../dbo/Tables/ServiceAccount.sql | 0 .../dbo/Views/ApiKeyDetailsView.sql | 0 .../dbo/Views/ApiKeyView.sql | 0 src/Sql/Sql.sqlproj | 22 +++++----- .../AccessPoliciesControllerTest.cs | 9 +++-- .../Controllers/ProjectsControllerTest.cs | 9 +++-- .../Controllers/SecretsControllerTest.cs | 9 +++-- .../ServiceAccountsControllerTests.cs | 9 +++-- .../AccessPoliciesControllerTests.cs | 12 +++--- .../Controllers/ProjectsControllerTests.cs | 10 ++--- .../Controllers/SecretsControllerTests.cs | 14 +++---- .../ServiceAccountsControllerTests.cs | 14 +++---- .../AutoFixture/ProjectFixtures.cs | 4 +- .../AutoFixture/SecretFixtures.cs | 4 +- 122 files changed, 449 insertions(+), 419 deletions(-) create mode 100644 .github/CODEOWNERS rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/CreateAccessPoliciesCommand.cs (86%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/DeleteAccessPolicyCommand.cs (77%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/UpdateAccessPolicyCommand.cs (75%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessTokens/CreateAccessTokenCommand.cs (89%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Projects/CreateProjectCommand.cs (64%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Projects/DeleteProjectCommand.cs (91%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Projects/UpdateProjectCommand.cs (87%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Secrets/CreateSecretCommand.cs (64%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Secrets/DeleteSecretCommand.cs (81%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/Secrets/UpdateSecretCommand.cs (77%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/ServiceAccounts/CreateServiceAccountCommand.cs (68%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures => SecretsManager/Commands}/ServiceAccounts/UpdateServiceAccountCommand.cs (87%) rename bitwarden_license/src/Commercial.Core/{SecretManagerFeatures/SecretManagerCollectionExtensions.cs => SecretsManager/SecretsManagerCollectionExtensions.cs} (55%) create mode 100644 bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerServiceCollectionExtensions.cs rename bitwarden_license/src/Commercial.Infrastructure.EntityFramework/{ => SecretsManager}/Repositories/AccessPolicyRepository.cs (76%) rename bitwarden_license/src/Commercial.Infrastructure.EntityFramework/{ => SecretsManager}/Repositories/ProjectRepository.cs (80%) rename bitwarden_license/src/Commercial.Infrastructure.EntityFramework/{ => SecretsManager}/Repositories/SecretRepository.cs (76%) rename bitwarden_license/src/Commercial.Infrastructure.EntityFramework/{ => SecretsManager}/Repositories/ServiceAccountRepository.cs (80%) rename bitwarden_license/src/Commercial.Infrastructure.EntityFramework/{CommercialEFServiceCollectionExtensions.cs => SecretsManager/SecretsManagerEFServiceCollectionExtensions.cs} (51%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/AccessPolicies/CreateAccessPoliciesCommandTests.cs (95%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/AccessPolicies/DeleteAccessPolicyCommandTests.cs (84%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/AccessPolicies/UpdateAccessPolicyCommandTests.cs (86%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/AccessTokens/CreateAccessTokenCommandTests.cs (92%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/Projects/DeleteProjectCommandTests.cs (95%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/Projects/UpdateProjectCommandTests.cs (91%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/Secrets/CreateSecretCommandTests.cs (65%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/Secrets/DeleteSecretCommandTests.cs (91%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/Secrets/UpdateSecretCommandTests.cs (93%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/ServiceAccounts/CreateServiceAccountCommandTests.cs (72%) rename bitwarden_license/test/Commercial.Core.Test/{SecretManagerFeatures => SecretsManager}/ServiceAccounts/UpdateServiceAccountCommandTests.cs (96%) rename src/Api/{ => SecretsManager}/Controllers/AccessPoliciesController.cs (90%) rename src/Api/{ => SecretsManager}/Controllers/ProjectsController.cs (94%) rename src/Api/{ => SecretsManager}/Controllers/SecretsController.cs (92%) rename src/Api/{ => SecretsManager}/Controllers/ServiceAccountsController.cs (93%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/AccessPoliciesCreateRequest.cs (96%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/AccessPolicyUpdateRequest.cs (77%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/AccessTokenCreateRequestModel.cs (90%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/ProjectCreateRequestModel.cs (80%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/ProjectUpdateRequestModel.cs (79%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/SecretCreateRequestModel.cs (89%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/SecretUpdateRequestModel.cs (89%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/SerivceAccountUpdateRequestModel.cs (80%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Request/ServiceAccountCreateRequestModel.cs (81%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/AccessPolicyResponseModel.cs (98%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/AccessTokenCreationResponseModel.cs (90%) rename src/Api/{Models/Response/SecretsManager => SecretsManager/Models/Response}/AccessTokenResponseModel.cs (84%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/BulkDeleteResponseModel.cs (91%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/ProjectAccessPoliciesResponseModel.cs (92%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/ProjectResponseModel.cs (87%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/SecretResponseModel.cs (91%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/SecretWithProjectsListResponseModel.cs (93%) rename src/Api/{SecretManagerFeatures => SecretsManager}/Models/Response/ServiceAccountResponseModel.cs (88%) rename src/Api/{Utilities => SecretsManager}/SecretsManagerAttribute.cs (95%) delete mode 100644 src/Core/SecretManagerFeatures/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs delete mode 100644 src/Core/SecretManagerFeatures/Projects/Interfaces/ICreateProjectCommand.cs delete mode 100644 src/Core/SecretManagerFeatures/Secrets/Interfaces/ICreateSecretCommand.cs delete mode 100644 src/Core/SecretManagerFeatures/Secrets/Interfaces/IUpdateSecretCommand.cs rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs (54%) rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs (52%) rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs (53%) create mode 100644 src/Core/SecretsManager/Commands/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs create mode 100644 src/Core/SecretsManager/Commands/Projects/Interfaces/ICreateProjectCommand.cs rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/Projects/Interfaces/IDeleteProjectCommand.cs (54%) rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/Projects/Interfaces/IUpdateProjectCommand.cs (51%) create mode 100644 src/Core/SecretsManager/Commands/Secrets/Interfaces/ICreateSecretCommand.cs rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/Secrets/Interfaces/IDeleteSecretCommand.cs (51%) create mode 100644 src/Core/SecretsManager/Commands/Secrets/Interfaces/IUpdateSecretCommand.cs rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs (51%) rename src/Core/{SecretManagerFeatures => SecretsManager/Commands}/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs (54%) rename src/Core/{ => SecretsManager}/Entities/AccessPolicy.cs (95%) rename src/Core/{ => SecretsManager}/Entities/ApiKey.cs (93%) rename src/Core/{ => SecretsManager}/Entities/Project.cs (89%) rename src/Core/{ => SecretsManager}/Entities/Secret.cs (90%) rename src/Core/{ => SecretsManager}/Entities/ServiceAccount.cs (87%) rename src/Core/{ => SecretsManager}/Models/Data/ApiKeyDetails.cs (90%) rename src/Core/{ => SecretsManager}/Repositories/IAccessPolicyRepository.cs (83%) rename src/Core/{ => SecretsManager}/Repositories/IApiKeyRepository.cs (54%) rename src/Core/{ => SecretsManager}/Repositories/IProjectRepository.cs (82%) rename src/Core/{ => SecretsManager}/Repositories/ISecretRepository.cs (83%) rename src/Core/{ => SecretsManager}/Repositories/IServiceAccountRepository.cs (81%) rename src/Infrastructure.Dapper/{ => SecretsManager}/Repositories/ApiKeyRepository.cs (86%) delete mode 100644 src/Infrastructure.EntityFramework/Models/ApiKey.cs rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Configurations/AccessPolicyEntityTypeConfiguration.cs (96%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Configurations/ApiKeyEntityTypeConfiguration.cs (79%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Configurations/ProjectEntityTypeConfiguration.cs (81%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Configurations/SecretEntityTypeConfiguration.cs (81%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Configurations/ServiceAccountEntityTypeConfiguration.cs (80%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Models/AccessPolicy.cs (69%) create mode 100644 src/Infrastructure.EntityFramework/SecretsManager/Models/ApiKey.cs rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Models/Project.cs (70%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Models/Secret.cs (56%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Models/ServiceAccount.cs (57%) rename src/Infrastructure.EntityFramework/{ => SecretsManager}/Repositories/ApiKeyRepository.cs (64%) rename src/Sql/{ => SecretsManager}/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/AccessPolicy.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/ApiKey.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/Project.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/ProjectSecret.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/Secret.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Tables/ServiceAccount.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Views/ApiKeyDetailsView.sql (100%) rename src/Sql/{ => SecretsManager}/dbo/Views/ApiKeyView.sql (100%) rename test/Api.IntegrationTest/{ => SecretsManager}/Controllers/AccessPoliciesControllerTest.cs (96%) rename test/Api.IntegrationTest/{ => SecretsManager}/Controllers/ProjectsControllerTest.cs (97%) rename test/Api.IntegrationTest/{ => SecretsManager}/Controllers/SecretsControllerTest.cs (97%) rename test/Api.IntegrationTest/{ => SecretsManager}/Controllers/ServiceAccountsControllerTests.cs (98%) rename test/Api.Test/{ => SecretsManager}/Controllers/AccessPoliciesControllerTests.cs (92%) rename test/Api.Test/{ => SecretsManager}/Controllers/ProjectsControllerTests.cs (86%) rename test/Api.Test/{ => SecretsManager}/Controllers/SecretsControllerTests.cs (92%) rename test/Api.Test/{ => SecretsManager}/Controllers/ServiceAccountsControllerTests.cs (96%) rename test/Core.Test/{ => SecretsManager}/AutoFixture/ProjectFixtures.cs (82%) rename test/Core.Test/{ => SecretsManager}/AutoFixture/SecretFixtures.cs (82%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..a4645cd12 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Please sort lines alphabetically, this will ensure we don't accidentally add duplicates. +# +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + +**/SecretsManager @bitwarden/pod-sm-dev diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/CreateAccessPoliciesCommand.cs similarity index 86% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/CreateAccessPoliciesCommand.cs index ea776bac7..05af497e6 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/CreateAccessPoliciesCommand.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +using Bit.Core.Exceptions; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; public class CreateAccessPoliciesCommand : ICreateAccessPoliciesCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/DeleteAccessPolicyCommand.cs similarity index 77% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/DeleteAccessPolicyCommand.cs index f84ca88bc..0795d6290 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/DeleteAccessPolicyCommand.cs @@ -1,8 +1,8 @@ using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; public class DeleteAccessPolicyCommand : IDeleteAccessPolicyCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/UpdateAccessPolicyCommand.cs similarity index 75% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/UpdateAccessPolicyCommand.cs index 6256b8b82..b7ebd1706 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/UpdateAccessPolicyCommand.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +using Bit.Core.Exceptions; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; public class UpdateAccessPolicyCommand : IUpdateAccessPolicyCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessTokens/CreateAccessTokenCommand.cs similarity index 89% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessTokens/CreateAccessTokenCommand.cs index 0208fca71..e8d179e79 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessTokens/CreateAccessTokenCommand.cs @@ -1,12 +1,12 @@ using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces; +using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Utilities; -namespace Bit.Commercial.Core.SecretManagerFeatures.AccessTokens; +namespace Bit.Commercial.Core.SecretsManager.Commands.AccessTokens; public class CreateAccessTokenCommand : ICreateAccessTokenCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/CreateProjectCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/CreateProjectCommand.cs similarity index 64% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/CreateProjectCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/CreateProjectCommand.cs index 2f703b2f9..6e86088dc 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/CreateProjectCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/CreateProjectCommand.cs @@ -1,8 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Projects; +namespace Bit.Commercial.Core.SecretsManager.Commands.Projects; public class CreateProjectCommand : ICreateProjectCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/DeleteProjectCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/DeleteProjectCommand.cs similarity index 91% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/DeleteProjectCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/DeleteProjectCommand.cs index cf1644c92..8451f1d40 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/DeleteProjectCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/DeleteProjectCommand.cs @@ -1,11 +1,11 @@ using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Projects; +namespace Bit.Commercial.Core.SecretsManager.Commands.Projects; public class DeleteProjectCommand : IDeleteProjectCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/UpdateProjectCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/UpdateProjectCommand.cs similarity index 87% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/UpdateProjectCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/UpdateProjectCommand.cs index 11cd04d85..74799547a 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Projects/UpdateProjectCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Projects/UpdateProjectCommand.cs @@ -1,11 +1,11 @@ using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Projects; +namespace Bit.Commercial.Core.SecretsManager.Commands.Projects; public class UpdateProjectCommand : IUpdateProjectCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/CreateSecretCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/CreateSecretCommand.cs similarity index 64% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/CreateSecretCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/CreateSecretCommand.cs index 17c812ca4..d224247c1 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/CreateSecretCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/CreateSecretCommand.cs @@ -1,8 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.SecretsManager.Commands.Secrets; public class CreateSecretCommand : ICreateSecretCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/DeleteSecretCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/DeleteSecretCommand.cs similarity index 81% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/DeleteSecretCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/DeleteSecretCommand.cs index 1a4d83c51..b04a8f911 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/DeleteSecretCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/DeleteSecretCommand.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; +using Bit.Core.Exceptions; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.SecretsManager.Commands.Secrets; public class DeleteSecretCommand : IDeleteSecretCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/UpdateSecretCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/UpdateSecretCommand.cs similarity index 77% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/UpdateSecretCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/UpdateSecretCommand.cs index 0f8030804..4bd0cf4f3 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/Secrets/UpdateSecretCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/Secrets/UpdateSecretCommand.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; +using Bit.Core.Exceptions; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.SecretsManager.Commands.Secrets; public class UpdateSecretCommand : IUpdateSecretCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/CreateServiceAccountCommand.cs similarity index 68% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/CreateServiceAccountCommand.cs index db49d3342..f3d379947 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/CreateServiceAccountCommand.cs @@ -1,8 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.ServiceAccounts; +namespace Bit.Commercial.Core.SecretsManager.Commands.ServiceAccounts; public class CreateServiceAccountCommand : ICreateServiceAccountCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommand.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/UpdateServiceAccountCommand.cs similarity index 87% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommand.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/UpdateServiceAccountCommand.cs index 895f0f500..efc77fc04 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommand.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/Commands/ServiceAccounts/UpdateServiceAccountCommand.cs @@ -1,11 +1,11 @@ using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; -namespace Bit.Commercial.Core.SecretManagerFeatures.ServiceAccounts; +namespace Bit.Commercial.Core.SecretsManager.Commands.ServiceAccounts; public class UpdateServiceAccountCommand : IUpdateServiceAccountCommand { diff --git a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/SecretManagerCollectionExtensions.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs similarity index 55% rename from bitwarden_license/src/Commercial.Core/SecretManagerFeatures/SecretManagerCollectionExtensions.cs rename to bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs index 5d3a871b5..dc645d1a1 100644 --- a/bitwarden_license/src/Commercial.Core/SecretManagerFeatures/SecretManagerCollectionExtensions.cs +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs @@ -1,20 +1,20 @@ -using Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; -using Bit.Commercial.Core.SecretManagerFeatures.AccessTokens; -using Bit.Commercial.Core.SecretManagerFeatures.Projects; -using Bit.Commercial.Core.SecretManagerFeatures.Secrets; -using Bit.Commercial.Core.SecretManagerFeatures.ServiceAccounts; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; -using Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; -using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +using Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; +using Bit.Commercial.Core.SecretsManager.Commands.AccessTokens; +using Bit.Commercial.Core.SecretsManager.Commands.Projects; +using Bit.Commercial.Core.SecretsManager.Commands.Secrets; +using Bit.Commercial.Core.SecretsManager.Commands.ServiceAccounts; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Core.SecretManagerFeatures; +namespace Bit.Commercial.Core.SecretsManager; -public static class SecretManagerCollectionExtensions +public static class SecretsManagerCollectionExtensions { - public static void AddSecretManagerServices(this IServiceCollection services) + public static void AddSecretsManagerServices(this IServiceCollection services) { services.AddScoped(); services.AddScoped(); diff --git a/bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerServiceCollectionExtensions.cs b/bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerServiceCollectionExtensions.cs new file mode 100644 index 000000000..e6c733164 --- /dev/null +++ b/bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerServiceCollectionExtensions.cs @@ -0,0 +1,11 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace Bit.Commercial.Core.SecretsManager; + +public static class SecretsManagerServiceCollectionExtensions +{ + public static void AddCommercialSecretsManagerServices(this IServiceCollection services) + { + services.AddSecretsManagerServices(); + } +} diff --git a/bitwarden_license/src/Commercial.Core/Utilities/ServiceCollectionExtensions.cs b/bitwarden_license/src/Commercial.Core/Utilities/ServiceCollectionExtensions.cs index 07881c4a3..6440f27ab 100644 --- a/bitwarden_license/src/Commercial.Core/Utilities/ServiceCollectionExtensions.cs +++ b/bitwarden_license/src/Commercial.Core/Utilities/ServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ -using Bit.Commercial.Core.SecretManagerFeatures; -using Bit.Commercial.Core.Services; +using Bit.Commercial.Core.Services; using Bit.Core.Services; using Microsoft.Extensions.DependencyInjection; @@ -11,9 +10,4 @@ public static class ServiceCollectionExtensions { services.AddScoped(); } - - public static void AddCommercialSecretsManagerServices(this IServiceCollection services) - { - services.AddSecretManagerServices(); - } } diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/AccessPolicyRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/AccessPolicyRepository.cs similarity index 76% rename from bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/AccessPolicyRepository.cs rename to bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/AccessPolicyRepository.cs index db6c008c7..dd56e08fc 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/AccessPolicyRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/AccessPolicyRepository.cs @@ -1,11 +1,11 @@ using AutoMapper; -using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Infrastructure.EntityFramework.Repositories; +namespace Bit.Commercial.Infrastructure.EntityFramework.SecretsManager.Repositories; public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPolicyRepository { @@ -14,7 +14,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli { } - public async Task> CreateManyAsync(List baseAccessPolicies) + public async Task> CreateManyAsync(List baseAccessPolicies) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -24,33 +24,33 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli baseAccessPolicy.SetNewId(); switch (baseAccessPolicy) { - case Core.Entities.UserProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.UserProjectAccessPolicy accessPolicy: { var entity = Mapper.Map(accessPolicy); await dbContext.AddAsync(entity); break; } - case Core.Entities.UserServiceAccountAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.UserServiceAccountAccessPolicy accessPolicy: { var entity = Mapper.Map(accessPolicy); await dbContext.AddAsync(entity); break; } - case Core.Entities.GroupProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.GroupProjectAccessPolicy accessPolicy: { var entity = Mapper.Map(accessPolicy); await dbContext.AddAsync(entity); break; } - case Core.Entities.GroupServiceAccountAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.GroupServiceAccountAccessPolicy accessPolicy: { var entity = Mapper.Map(accessPolicy); await dbContext.AddAsync(entity); break; } - case Core.Entities.ServiceAccountProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.ServiceAccountProjectAccessPolicy accessPolicy: { var entity = Mapper.Map(accessPolicy); await dbContext.AddAsync(entity); @@ -64,14 +64,14 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli } } - public async Task AccessPolicyExists(Core.Entities.BaseAccessPolicy baseAccessPolicy) + public async Task AccessPolicyExists(Core.SecretsManager.Entities.BaseAccessPolicy baseAccessPolicy) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); switch (baseAccessPolicy) { - case Core.Entities.UserProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.UserProjectAccessPolicy accessPolicy: { var policy = await dbContext.UserProjectAccessPolicy .Where(c => c.OrganizationUserId == accessPolicy.OrganizationUserId && @@ -79,7 +79,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli .FirstOrDefaultAsync(); return policy != null; } - case Core.Entities.GroupProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.GroupProjectAccessPolicy accessPolicy: { var policy = await dbContext.GroupProjectAccessPolicy .Where(c => c.GroupId == accessPolicy.GroupId && @@ -87,7 +87,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli .FirstOrDefaultAsync(); return policy != null; } - case Core.Entities.ServiceAccountProjectAccessPolicy accessPolicy: + case Core.SecretsManager.Entities.ServiceAccountProjectAccessPolicy accessPolicy: { var policy = await dbContext.ServiceAccountProjectAccessPolicy .Where(c => c.ServiceAccountId == accessPolicy.ServiceAccountId && @@ -101,7 +101,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli } } - public async Task GetByIdAsync(Guid id) + public async Task GetByIdAsync(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -121,7 +121,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli } } - public async Task ReplaceAsync(Core.Entities.BaseAccessPolicy baseAccessPolicy) + public async Task ReplaceAsync(Core.SecretsManager.Entities.BaseAccessPolicy baseAccessPolicy) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -138,7 +138,7 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli } } - public async Task?> GetManyByProjectId(Guid id) + public async Task?> GetManyByProjectId(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -171,13 +171,13 @@ public class AccessPolicyRepository : BaseEntityFrameworkRepository, IAccessPoli } } - private Core.Entities.BaseAccessPolicy MapToCore(BaseAccessPolicy baseAccessPolicyEntity) + private Core.SecretsManager.Entities.BaseAccessPolicy MapToCore(BaseAccessPolicy baseAccessPolicyEntity) { return baseAccessPolicyEntity switch { - UserProjectAccessPolicy ap => Mapper.Map(ap), - GroupProjectAccessPolicy ap => Mapper.Map(ap), - ServiceAccountProjectAccessPolicy ap => Mapper.Map(ap), + UserProjectAccessPolicy ap => Mapper.Map(ap), + GroupProjectAccessPolicy ap => Mapper.Map(ap), + ServiceAccountProjectAccessPolicy ap => Mapper.Map(ap), _ => throw new ArgumentException("Unsupported access policy type") }; } diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ProjectRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs similarity index 80% rename from bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ProjectRepository.cs rename to bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs index 4023d7319..bf35a47dc 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ProjectRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs @@ -1,21 +1,21 @@ using System.Linq.Expressions; using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Infrastructure.EntityFramework.Repositories; +namespace Bit.Commercial.Infrastructure.EntityFramework.SecretsManager.Repositories; -public class ProjectRepository : Repository, IProjectRepository +public class ProjectRepository : Repository, IProjectRepository { public ProjectRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, db => db.Project) { } - public override async Task GetByIdAsync(Guid id) + public override async Task GetByIdAsync(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -23,11 +23,11 @@ public class ProjectRepository : Repository c.Id == id && c.DeletedDate == null) .FirstOrDefaultAsync(); - return Mapper.Map(project); + return Mapper.Map(project); } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId, Guid userId, AccessClientType accessType) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId, Guid userId, AccessClientType accessType) { using var scope = ServiceScopeFactory.CreateScope(); var dbContext = GetDatabaseContext(scope); @@ -42,7 +42,7 @@ public class ProjectRepository : Repository p.RevisionDate).ToListAsync(); - return Mapper.Map>(projects); + return Mapper.Map>(projects); } private static Expression> UserHasReadAccessToProject(Guid userId) => p => @@ -70,7 +70,7 @@ public class ProjectRepository : Repository> GetManyByIds(IEnumerable ids) + public async Task> GetManyByIds(IEnumerable ids) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -78,7 +78,7 @@ public class ProjectRepository : Repository ids.Contains(c.Id) && c.DeletedDate == null) .ToListAsync(); - return Mapper.Map>(projects); + return Mapper.Map>(projects); } } diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/SecretRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs similarity index 76% rename from bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/SecretRepository.cs rename to bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs index 1a31bf36c..a17af71e6 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/SecretRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs @@ -1,20 +1,20 @@ using AutoMapper; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework; -using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Infrastructure.EntityFramework.Repositories; +namespace Bit.Commercial.Infrastructure.EntityFramework.SecretsManager.Repositories; -public class SecretRepository : Repository, ISecretRepository +public class SecretRepository : Repository, ISecretRepository { public SecretRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, db => db.Secret) { } - public override async Task GetByIdAsync(Guid id) + public override async Task GetByIdAsync(Guid id) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -23,11 +23,11 @@ public class SecretRepository : Repository, .Include("Projects") .Where(c => c.Id == id && c.DeletedDate == null) .FirstOrDefaultAsync(); - return Mapper.Map(secret); + return Mapper.Map(secret); } } - public async Task> GetManyByIds(IEnumerable ids) + public async Task> GetManyByIds(IEnumerable ids) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -35,11 +35,11 @@ public class SecretRepository : Repository, var secrets = await dbContext.Secret .Where(c => ids.Contains(c.Id) && c.DeletedDate == null) .ToListAsync(); - return Mapper.Map>(secrets); + return Mapper.Map>(secrets); } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -50,11 +50,11 @@ public class SecretRepository : Repository, .OrderBy(c => c.RevisionDate) .ToListAsync(); - return Mapper.Map>(secrets); + return Mapper.Map>(secrets); } } - public async Task> GetManyByProjectIdAsync(Guid projectId) + public async Task> GetManyByProjectIdAsync(Guid projectId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -63,11 +63,11 @@ public class SecretRepository : Repository, .Where(s => s.Projects.Any(p => p.Id == projectId) && s.DeletedDate == null).Include("Projects") .OrderBy(s => s.RevisionDate).ToListAsync(); - return Mapper.Map>(secrets); + return Mapper.Map>(secrets); } } - public override async Task CreateAsync(Core.Entities.Secret secret) + public override async Task CreateAsync(Core.SecretsManager.Entities.Secret secret) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -90,7 +90,7 @@ public class SecretRepository : Repository, } } - public async Task UpdateAsync(Core.Entities.Secret secret) + public async Task UpdateAsync(Core.SecretsManager.Entities.Secret secret) { using (var scope = ServiceScopeFactory.CreateScope()) diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ServiceAccountRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs similarity index 80% rename from bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ServiceAccountRepository.cs rename to bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs index 54640d65f..4632abc8f 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/Repositories/ServiceAccountRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs @@ -1,21 +1,21 @@ using System.Linq.Expressions; using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Infrastructure.EntityFramework.Repositories; +namespace Bit.Commercial.Infrastructure.EntityFramework.SecretsManager.Repositories; -public class ServiceAccountRepository : Repository, IServiceAccountRepository +public class ServiceAccountRepository : Repository, IServiceAccountRepository { public ServiceAccountRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, db => db.ServiceAccount) { } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId, Guid userId, AccessClientType accessType) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId, Guid userId, AccessClientType accessType) { using var scope = ServiceScopeFactory.CreateScope(); var dbContext = GetDatabaseContext(scope); @@ -29,7 +29,7 @@ public class ServiceAccountRepository : Repository c.RevisionDate).ToListAsync(); - return Mapper.Map>(serviceAccounts); + return Mapper.Map>(serviceAccounts); } public async Task UserHasReadAccessToServiceAccount(Guid id, Guid userId) diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/CommercialEFServiceCollectionExtensions.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/SecretsManagerEFServiceCollectionExtensions.cs similarity index 51% rename from bitwarden_license/src/Commercial.Infrastructure.EntityFramework/CommercialEFServiceCollectionExtensions.cs rename to bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/SecretsManagerEFServiceCollectionExtensions.cs index 05fee84fd..d6c884807 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/CommercialEFServiceCollectionExtensions.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/SecretsManagerEFServiceCollectionExtensions.cs @@ -1,12 +1,12 @@ -using Bit.Commercial.Infrastructure.EntityFramework.Repositories; -using Bit.Core.Repositories; +using Bit.Commercial.Infrastructure.EntityFramework.SecretsManager.Repositories; +using Bit.Core.SecretsManager.Repositories; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Commercial.Infrastructure.EntityFramework; +namespace Bit.Commercial.Infrastructure.EntityFramework.SecretsManager; -public static class CommercialEFServiceCollectionExtensions +public static class SecretsManagerEfServiceCollectionExtensions { - public static void AddCommercialEFRepositories(this IServiceCollection services) + public static void AddSecretsManagerEfRepositories(this IServiceCollection services) { services.AddSingleton(); services.AddSingleton(); diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/CreateAccessPoliciesCommandTests.cs similarity index 95% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/CreateAccessPoliciesCommandTests.cs index 3d78102a5..6005f1a9a 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/CreateAccessPoliciesCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/CreateAccessPoliciesCommandTests.cs @@ -1,14 +1,14 @@ -using Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; -using Bit.Core.Entities; +using Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.Test.SecretsManager.AccessPolicies; [SutProviderCustomize] public class CreateAccessPoliciesCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/DeleteAccessPolicyCommandTests.cs similarity index 84% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/DeleteAccessPolicyCommandTests.cs index e9f0875ce..dfb09eb44 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/DeleteAccessPolicyCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/DeleteAccessPolicyCommandTests.cs @@ -1,14 +1,14 @@ -using Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; -using Bit.Core.Entities; +using Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.Test.SecretsManager.AccessPolicies; [SutProviderCustomize] public class DeleteAccessPolicyCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/UpdateAccessPolicyCommandTests.cs similarity index 86% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/UpdateAccessPolicyCommandTests.cs index f769271a7..482be4839 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessPolicies/UpdateAccessPolicyCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/UpdateAccessPolicyCommandTests.cs @@ -1,14 +1,14 @@ -using Bit.Commercial.Core.SecretManagerFeatures.AccessPolicies; -using Bit.Core.Entities; +using Bit.Commercial.Core.SecretsManager.Commands.AccessPolicies; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.AccessPolicies; +namespace Bit.Commercial.Core.Test.SecretsManager.AccessPolicies; [SutProviderCustomize] public class UpdateAccessPolicyCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessTokens/CreateAccessTokenCommandTests.cs similarity index 92% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessTokens/CreateAccessTokenCommandTests.cs index 804b343fe..d9b2027c3 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/AccessTokens/CreateAccessTokenCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessTokens/CreateAccessTokenCommandTests.cs @@ -1,15 +1,15 @@ -using Bit.Commercial.Core.SecretManagerFeatures.AccessTokens; +using Bit.Commercial.Core.SecretsManager.Commands.AccessTokens; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.AccessTokens; +namespace Bit.Commercial.Core.Test.SecretsManager.AccessTokens; [SutProviderCustomize] public class CreateServiceAccountCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/DeleteProjectCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/DeleteProjectCommandTests.cs similarity index 95% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/DeleteProjectCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/DeleteProjectCommandTests.cs index 2652663fd..3d93d3979 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/DeleteProjectCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/DeleteProjectCommandTests.cs @@ -1,15 +1,15 @@ -using Bit.Commercial.Core.SecretManagerFeatures.Projects; +using Bit.Commercial.Core.SecretsManager.Commands.Projects; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Identity; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.Projects; +namespace Bit.Commercial.Core.Test.SecretsManager.Projects; [SutProviderCustomize] public class DeleteProjectCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/UpdateProjectCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/UpdateProjectCommandTests.cs similarity index 91% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/UpdateProjectCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/UpdateProjectCommandTests.cs index c85068d99..d85a44a91 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Projects/UpdateProjectCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Projects/UpdateProjectCommandTests.cs @@ -1,9 +1,9 @@ -using Bit.Commercial.Core.SecretManagerFeatures.Projects; +using Bit.Commercial.Core.SecretsManager.Commands.Projects; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.Test.AutoFixture.ProjectsFixture; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Test.SecretsManager.AutoFixture.ProjectsFixture; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; @@ -11,7 +11,7 @@ using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.Projects; +namespace Bit.Commercial.Core.Test.SecretsManager.Projects; [SutProviderCustomize] [ProjectCustomize] diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/CreateSecretCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/CreateSecretCommandTests.cs similarity index 65% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/CreateSecretCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/CreateSecretCommandTests.cs index 2dcca20b7..9accbc53f 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/CreateSecretCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/CreateSecretCommandTests.cs @@ -1,13 +1,13 @@ -using Bit.Commercial.Core.SecretManagerFeatures.Secrets; -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.Test.AutoFixture.SecretsFixture; +using Bit.Commercial.Core.SecretsManager.Commands.Secrets; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Test.SecretsManager.AutoFixture.SecretsFixture; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.Test.SecretsManager.Secrets; [SutProviderCustomize] [SecretCustomize] diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/DeleteSecretCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/DeleteSecretCommandTests.cs similarity index 91% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/DeleteSecretCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/DeleteSecretCommandTests.cs index 1561f0058..d5adec882 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/DeleteSecretCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/DeleteSecretCommandTests.cs @@ -1,13 +1,13 @@ -using Bit.Commercial.Core.SecretManagerFeatures.Secrets; -using Bit.Core.Entities; +using Bit.Commercial.Core.SecretsManager.Commands.Secrets; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.Test.SecretsManager.Secrets; [SutProviderCustomize] public class DeleteSecretCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/UpdateSecretCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/UpdateSecretCommandTests.cs similarity index 93% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/UpdateSecretCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/UpdateSecretCommandTests.cs index 64b52ce6f..683868d7e 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/Secrets/UpdateSecretCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/Secrets/UpdateSecretCommandTests.cs @@ -1,15 +1,15 @@ -using Bit.Commercial.Core.SecretManagerFeatures.Secrets; -using Bit.Core.Entities; +using Bit.Commercial.Core.SecretsManager.Commands.Secrets; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.Test.AutoFixture.SecretsFixture; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Test.SecretsManager.AutoFixture.SecretsFixture; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.Secrets; +namespace Bit.Commercial.Core.Test.SecretsManager.Secrets; [SutProviderCustomize] [SecretCustomize] diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/CreateServiceAccountCommandTests.cs similarity index 72% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/CreateServiceAccountCommandTests.cs index 209cea2cc..3c3e11a6a 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/CreateServiceAccountCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/CreateServiceAccountCommandTests.cs @@ -1,13 +1,13 @@ -using Bit.Commercial.Core.SecretManagerFeatures.ServiceAccounts; -using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Commercial.Core.SecretsManager.Commands.ServiceAccounts; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.ServiceAccounts; +namespace Bit.Commercial.Core.Test.SecretsManager.ServiceAccounts; [SutProviderCustomize] public class CreateServiceAccountCommandTests diff --git a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommandTests.cs b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/UpdateServiceAccountCommandTests.cs similarity index 96% rename from bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommandTests.cs rename to bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/UpdateServiceAccountCommandTests.cs index 8014a682e..0b75cb2a9 100644 --- a/bitwarden_license/test/Commercial.Core.Test/SecretManagerFeatures/ServiceAccounts/UpdateServiceAccountCommandTests.cs +++ b/bitwarden_license/test/Commercial.Core.Test/SecretsManager/ServiceAccounts/UpdateServiceAccountCommandTests.cs @@ -1,15 +1,15 @@ -using Bit.Commercial.Core.SecretManagerFeatures.ServiceAccounts; +using Bit.Commercial.Core.SecretsManager.Commands.ServiceAccounts; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Commercial.Core.Test.SecretManagerFeatures.ServiceAccounts; +namespace Bit.Commercial.Core.Test.SecretsManager.ServiceAccounts; [SutProviderCustomize] public class UpdateServiceAccountCommandTests diff --git a/src/Api/Controllers/AccessPoliciesController.cs b/src/Api/SecretsManager/Controllers/AccessPoliciesController.cs similarity index 90% rename from src/Api/Controllers/AccessPoliciesController.cs rename to src/Api/SecretsManager/Controllers/AccessPoliciesController.cs index ea9bd320a..493fbf560 100644 --- a/src/Api/Controllers/AccessPoliciesController.cs +++ b/src/Api/SecretsManager/Controllers/AccessPoliciesController.cs @@ -1,12 +1,11 @@ -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; -using Bit.Api.Utilities; -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.SecretsManager.Controllers; [SecretsManager] [Route("access-policies")] diff --git a/src/Api/Controllers/ProjectsController.cs b/src/Api/SecretsManager/Controllers/ProjectsController.cs similarity index 94% rename from src/Api/Controllers/ProjectsController.cs rename to src/Api/SecretsManager/Controllers/ProjectsController.cs index fa714da80..d8ef5a00f 100644 --- a/src/Api/Controllers/ProjectsController.cs +++ b/src/Api/SecretsManager/Controllers/ProjectsController.cs @@ -1,16 +1,15 @@ using Bit.Api.Models.Response; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; -using Bit.Api.Utilities; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.SecretsManager.Controllers; [SecretsManager] public class ProjectsController : Controller diff --git a/src/Api/Controllers/SecretsController.cs b/src/Api/SecretsManager/Controllers/SecretsController.cs similarity index 92% rename from src/Api/Controllers/SecretsController.cs rename to src/Api/SecretsManager/Controllers/SecretsController.cs index 95a694bed..a66680f63 100644 --- a/src/Api/Controllers/SecretsController.cs +++ b/src/Api/SecretsManager/Controllers/SecretsController.cs @@ -1,14 +1,13 @@ using Bit.Api.Models.Response; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; -using Bit.Api.Utilities; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.SecretsManager.Controllers; [SecretsManager] [Authorize("secrets")] diff --git a/src/Api/Controllers/ServiceAccountsController.cs b/src/Api/SecretsManager/Controllers/ServiceAccountsController.cs similarity index 93% rename from src/Api/Controllers/ServiceAccountsController.cs rename to src/Api/SecretsManager/Controllers/ServiceAccountsController.cs index 366802d23..6456fa21e 100644 --- a/src/Api/Controllers/ServiceAccountsController.cs +++ b/src/Api/SecretsManager/Controllers/ServiceAccountsController.cs @@ -1,18 +1,16 @@ using Bit.Api.Models.Response; -using Bit.Api.Models.Response.SecretsManager; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; -using Bit.Api.Utilities; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces; -using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces; +using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.SecretsManager.Controllers; [SecretsManager] [Route("service-accounts")] diff --git a/src/Api/SecretManagerFeatures/Models/Request/AccessPoliciesCreateRequest.cs b/src/Api/SecretsManager/Models/Request/AccessPoliciesCreateRequest.cs similarity index 96% rename from src/Api/SecretManagerFeatures/Models/Request/AccessPoliciesCreateRequest.cs rename to src/Api/SecretsManager/Models/Request/AccessPoliciesCreateRequest.cs index b6a0977c7..eab1c1dba 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/AccessPoliciesCreateRequest.cs +++ b/src/Api/SecretsManager/Models/Request/AccessPoliciesCreateRequest.cs @@ -1,9 +1,9 @@ #nullable enable using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; using Bit.Core.Exceptions; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class AccessPoliciesCreateRequest { diff --git a/src/Api/SecretManagerFeatures/Models/Request/AccessPolicyUpdateRequest.cs b/src/Api/SecretsManager/Models/Request/AccessPolicyUpdateRequest.cs similarity index 77% rename from src/Api/SecretManagerFeatures/Models/Request/AccessPolicyUpdateRequest.cs rename to src/Api/SecretsManager/Models/Request/AccessPolicyUpdateRequest.cs index d63331531..bb918a62d 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/AccessPolicyUpdateRequest.cs +++ b/src/Api/SecretsManager/Models/Request/AccessPolicyUpdateRequest.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class AccessPolicyUpdateRequest { diff --git a/src/Api/SecretManagerFeatures/Models/Request/AccessTokenCreateRequestModel.cs b/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs similarity index 90% rename from src/Api/SecretManagerFeatures/Models/Request/AccessTokenCreateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs index 8e71b2eab..efbf93ad9 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/AccessTokenCreateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/AccessTokenCreateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class AccessTokenCreateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/ProjectCreateRequestModel.cs b/src/Api/SecretsManager/Models/Request/ProjectCreateRequestModel.cs similarity index 80% rename from src/Api/SecretManagerFeatures/Models/Request/ProjectCreateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/ProjectCreateRequestModel.cs index f00e0d648..fcf64271f 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/ProjectCreateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/ProjectCreateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class ProjectCreateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/ProjectUpdateRequestModel.cs b/src/Api/SecretsManager/Models/Request/ProjectUpdateRequestModel.cs similarity index 79% rename from src/Api/SecretManagerFeatures/Models/Request/ProjectUpdateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/ProjectUpdateRequestModel.cs index e0ef727c7..e552a4d05 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/ProjectUpdateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/ProjectUpdateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class ProjectUpdateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/SecretCreateRequestModel.cs b/src/Api/SecretsManager/Models/Request/SecretCreateRequestModel.cs similarity index 89% rename from src/Api/SecretManagerFeatures/Models/Request/SecretCreateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/SecretCreateRequestModel.cs index 94dac2c21..1edc9f06e 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/SecretCreateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/SecretCreateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class SecretCreateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/SecretUpdateRequestModel.cs b/src/Api/SecretsManager/Models/Request/SecretUpdateRequestModel.cs similarity index 89% rename from src/Api/SecretManagerFeatures/Models/Request/SecretUpdateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/SecretUpdateRequestModel.cs index 5ef585f2a..0a3e651a8 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/SecretUpdateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/SecretUpdateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class SecretUpdateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/SerivceAccountUpdateRequestModel.cs b/src/Api/SecretsManager/Models/Request/SerivceAccountUpdateRequestModel.cs similarity index 80% rename from src/Api/SecretManagerFeatures/Models/Request/SerivceAccountUpdateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/SerivceAccountUpdateRequestModel.cs index a3fff7062..2a1885142 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/SerivceAccountUpdateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/SerivceAccountUpdateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class ServiceAccountUpdateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Request/ServiceAccountCreateRequestModel.cs b/src/Api/SecretsManager/Models/Request/ServiceAccountCreateRequestModel.cs similarity index 81% rename from src/Api/SecretManagerFeatures/Models/Request/ServiceAccountCreateRequestModel.cs rename to src/Api/SecretsManager/Models/Request/ServiceAccountCreateRequestModel.cs index 9b64def78..60ab75b68 100644 --- a/src/Api/SecretManagerFeatures/Models/Request/ServiceAccountCreateRequestModel.cs +++ b/src/Api/SecretsManager/Models/Request/ServiceAccountCreateRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Utilities; -namespace Bit.Api.SecretManagerFeatures.Models.Request; +namespace Bit.Api.SecretsManager.Models.Request; public class ServiceAccountCreateRequestModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/AccessPolicyResponseModel.cs b/src/Api/SecretsManager/Models/Response/AccessPolicyResponseModel.cs similarity index 98% rename from src/Api/SecretManagerFeatures/Models/Response/AccessPolicyResponseModel.cs rename to src/Api/SecretsManager/Models/Response/AccessPolicyResponseModel.cs index 399d15206..17337ab69 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/AccessPolicyResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/AccessPolicyResponseModel.cs @@ -1,8 +1,8 @@ #nullable enable -using Bit.Core.Entities; using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public abstract class BaseAccessPolicyResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/AccessTokenCreationResponseModel.cs b/src/Api/SecretsManager/Models/Response/AccessTokenCreationResponseModel.cs similarity index 90% rename from src/Api/SecretManagerFeatures/Models/Response/AccessTokenCreationResponseModel.cs rename to src/Api/SecretsManager/Models/Response/AccessTokenCreationResponseModel.cs index 45f36238a..874251504 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/AccessTokenCreationResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/AccessTokenCreationResponseModel.cs @@ -1,8 +1,8 @@ #nullable enable -using Bit.Core.Entities; using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class AccessTokenCreationResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/SecretsManager/AccessTokenResponseModel.cs b/src/Api/SecretsManager/Models/Response/AccessTokenResponseModel.cs similarity index 84% rename from src/Api/Models/Response/SecretsManager/AccessTokenResponseModel.cs rename to src/Api/SecretsManager/Models/Response/AccessTokenResponseModel.cs index 9c796f4d7..1b0658af9 100644 --- a/src/Api/Models/Response/SecretsManager/AccessTokenResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/AccessTokenResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.Models.Response.SecretsManager; +namespace Bit.Api.SecretsManager.Models.Response; public class AccessTokenResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/BulkDeleteResponseModel.cs b/src/Api/SecretsManager/Models/Response/BulkDeleteResponseModel.cs similarity index 91% rename from src/Api/SecretManagerFeatures/Models/Response/BulkDeleteResponseModel.cs rename to src/Api/SecretsManager/Models/Response/BulkDeleteResponseModel.cs index 7e89a7753..170e14e1d 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/BulkDeleteResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/BulkDeleteResponseModel.cs @@ -1,7 +1,7 @@ #nullable enable using Bit.Core.Models.Api; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class BulkDeleteResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/ProjectAccessPoliciesResponseModel.cs b/src/Api/SecretsManager/Models/Response/ProjectAccessPoliciesResponseModel.cs similarity index 92% rename from src/Api/SecretManagerFeatures/Models/Response/ProjectAccessPoliciesResponseModel.cs rename to src/Api/SecretsManager/Models/Response/ProjectAccessPoliciesResponseModel.cs index a4416b03a..c7170e136 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/ProjectAccessPoliciesResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/ProjectAccessPoliciesResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class ProjectAccessPoliciesResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/ProjectResponseModel.cs b/src/Api/SecretsManager/Models/Response/ProjectResponseModel.cs similarity index 87% rename from src/Api/SecretManagerFeatures/Models/Response/ProjectResponseModel.cs rename to src/Api/SecretsManager/Models/Response/ProjectResponseModel.cs index 4e916798c..25934a7e3 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/ProjectResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/ProjectResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class ProjectResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/SecretResponseModel.cs b/src/Api/SecretsManager/Models/Response/SecretResponseModel.cs similarity index 91% rename from src/Api/SecretManagerFeatures/Models/Response/SecretResponseModel.cs rename to src/Api/SecretsManager/Models/Response/SecretResponseModel.cs index 030308ae4..db2ee3729 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/SecretResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/SecretResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class SecretResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/SecretWithProjectsListResponseModel.cs b/src/Api/SecretsManager/Models/Response/SecretWithProjectsListResponseModel.cs similarity index 93% rename from src/Api/SecretManagerFeatures/Models/Response/SecretWithProjectsListResponseModel.cs rename to src/Api/SecretsManager/Models/Response/SecretWithProjectsListResponseModel.cs index 4daa78a9b..ec841b901 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/SecretWithProjectsListResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/SecretWithProjectsListResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class SecretWithProjectsListResponseModel : ResponseModel { diff --git a/src/Api/SecretManagerFeatures/Models/Response/ServiceAccountResponseModel.cs b/src/Api/SecretsManager/Models/Response/ServiceAccountResponseModel.cs similarity index 88% rename from src/Api/SecretManagerFeatures/Models/Response/ServiceAccountResponseModel.cs rename to src/Api/SecretsManager/Models/Response/ServiceAccountResponseModel.cs index 5c0c19b52..6bc45650e 100644 --- a/src/Api/SecretManagerFeatures/Models/Response/ServiceAccountResponseModel.cs +++ b/src/Api/SecretsManager/Models/Response/ServiceAccountResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Api.SecretManagerFeatures.Models.Response; +namespace Bit.Api.SecretsManager.Models.Response; public class ServiceAccountResponseModel : ResponseModel { diff --git a/src/Api/Utilities/SecretsManagerAttribute.cs b/src/Api/SecretsManager/SecretsManagerAttribute.cs similarity index 95% rename from src/Api/Utilities/SecretsManagerAttribute.cs rename to src/Api/SecretsManager/SecretsManagerAttribute.cs index 13b1b0291..780e79867 100644 --- a/src/Api/Utilities/SecretsManagerAttribute.cs +++ b/src/Api/SecretsManager/SecretsManagerAttribute.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; -namespace Bit.Api.Utilities; +namespace Bit.Api.SecretsManager; [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public class SecretsManagerAttribute : Attribute, IResourceFilter diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 9475d2f5e..648f31241 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -15,8 +15,9 @@ using Bit.SharedWeb.Utilities; using Microsoft.Extensions.DependencyInjection.Extensions; #if !OSS +using Bit.Commercial.Core.SecretsManager; using Bit.Commercial.Core.Utilities; -using Bit.Commercial.Infrastructure.EntityFramework; +using Bit.Commercial.Infrastructure.EntityFramework.SecretsManager; #endif namespace Bit.Api; @@ -137,7 +138,7 @@ public class Startup #else services.AddCommercialCoreServices(); services.AddCommercialSecretsManagerServices(); - services.AddCommercialEFRepositories(); + services.AddSecretsManagerEfRepositories(); #endif // MVC diff --git a/src/Core/SecretManagerFeatures/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs b/src/Core/SecretManagerFeatures/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs deleted file mode 100644 index b89fddc47..000000000 --- a/src/Core/SecretManagerFeatures/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Bit.Core.Entities; - -namespace Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces; - -public interface ICreateAccessTokenCommand -{ - Task CreateAsync(ApiKey apiKey, Guid userId); -} diff --git a/src/Core/SecretManagerFeatures/Projects/Interfaces/ICreateProjectCommand.cs b/src/Core/SecretManagerFeatures/Projects/Interfaces/ICreateProjectCommand.cs deleted file mode 100644 index 8b2cb705f..000000000 --- a/src/Core/SecretManagerFeatures/Projects/Interfaces/ICreateProjectCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Bit.Core.Entities; - -namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces; - -public interface ICreateProjectCommand -{ - Task CreateAsync(Project project); -} diff --git a/src/Core/SecretManagerFeatures/Secrets/Interfaces/ICreateSecretCommand.cs b/src/Core/SecretManagerFeatures/Secrets/Interfaces/ICreateSecretCommand.cs deleted file mode 100644 index c457cc149..000000000 --- a/src/Core/SecretManagerFeatures/Secrets/Interfaces/ICreateSecretCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Bit.Core.Entities; - -namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces; - -public interface ICreateSecretCommand -{ - Task CreateAsync(Secret secret); -} diff --git a/src/Core/SecretManagerFeatures/Secrets/Interfaces/IUpdateSecretCommand.cs b/src/Core/SecretManagerFeatures/Secrets/Interfaces/IUpdateSecretCommand.cs deleted file mode 100644 index 7b02fc4e4..000000000 --- a/src/Core/SecretManagerFeatures/Secrets/Interfaces/IUpdateSecretCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Bit.Core.Entities; - -namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces; - -public interface IUpdateSecretCommand -{ - Task UpdateAsync(Secret secret); -} diff --git a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs similarity index 54% rename from src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs rename to src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs index 50c77fb7f..9ec9ff0db 100644 --- a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs +++ b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; public interface ICreateAccessPoliciesCommand { diff --git a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs similarity index 52% rename from src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs rename to src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs index e0c91f7e0..de3215a02 100644 --- a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs +++ b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IDeleteAccessPolicyCommand.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; public interface IDeleteAccessPolicyCommand { diff --git a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs similarity index 53% rename from src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs rename to src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs index ae3a2e303..225f6a752 100644 --- a/src/Core/SecretManagerFeatures/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs +++ b/src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IUpdateAccessPolicyCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +namespace Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; public interface IUpdateAccessPolicyCommand { diff --git a/src/Core/SecretsManager/Commands/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs b/src/Core/SecretsManager/Commands/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs new file mode 100644 index 000000000..98101d499 --- /dev/null +++ b/src/Core/SecretsManager/Commands/AccessTokens/Interfaces/ICreateAccessTokenCommand.cs @@ -0,0 +1,8 @@ +using Bit.Core.SecretsManager.Entities; + +namespace Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces; + +public interface ICreateAccessTokenCommand +{ + Task CreateAsync(ApiKey apiKey, Guid userId); +} diff --git a/src/Core/SecretsManager/Commands/Projects/Interfaces/ICreateProjectCommand.cs b/src/Core/SecretsManager/Commands/Projects/Interfaces/ICreateProjectCommand.cs new file mode 100644 index 000000000..c5f43d360 --- /dev/null +++ b/src/Core/SecretsManager/Commands/Projects/Interfaces/ICreateProjectCommand.cs @@ -0,0 +1,8 @@ +using Bit.Core.SecretsManager.Entities; + +namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces; + +public interface ICreateProjectCommand +{ + Task CreateAsync(Project project); +} diff --git a/src/Core/SecretManagerFeatures/Projects/Interfaces/IDeleteProjectCommand.cs b/src/Core/SecretsManager/Commands/Projects/Interfaces/IDeleteProjectCommand.cs similarity index 54% rename from src/Core/SecretManagerFeatures/Projects/Interfaces/IDeleteProjectCommand.cs rename to src/Core/SecretsManager/Commands/Projects/Interfaces/IDeleteProjectCommand.cs index e03566e6f..64b537bed 100644 --- a/src/Core/SecretManagerFeatures/Projects/Interfaces/IDeleteProjectCommand.cs +++ b/src/Core/SecretsManager/Commands/Projects/Interfaces/IDeleteProjectCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces; +namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces; public interface IDeleteProjectCommand { diff --git a/src/Core/SecretManagerFeatures/Projects/Interfaces/IUpdateProjectCommand.cs b/src/Core/SecretsManager/Commands/Projects/Interfaces/IUpdateProjectCommand.cs similarity index 51% rename from src/Core/SecretManagerFeatures/Projects/Interfaces/IUpdateProjectCommand.cs rename to src/Core/SecretsManager/Commands/Projects/Interfaces/IUpdateProjectCommand.cs index 2032204b0..0268e43d2 100644 --- a/src/Core/SecretManagerFeatures/Projects/Interfaces/IUpdateProjectCommand.cs +++ b/src/Core/SecretsManager/Commands/Projects/Interfaces/IUpdateProjectCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.Projects.Interfaces; +namespace Bit.Core.SecretsManager.Commands.Projects.Interfaces; public interface IUpdateProjectCommand { diff --git a/src/Core/SecretsManager/Commands/Secrets/Interfaces/ICreateSecretCommand.cs b/src/Core/SecretsManager/Commands/Secrets/Interfaces/ICreateSecretCommand.cs new file mode 100644 index 000000000..975734617 --- /dev/null +++ b/src/Core/SecretsManager/Commands/Secrets/Interfaces/ICreateSecretCommand.cs @@ -0,0 +1,8 @@ +using Bit.Core.SecretsManager.Entities; + +namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces; + +public interface ICreateSecretCommand +{ + Task CreateAsync(Secret secret); +} diff --git a/src/Core/SecretManagerFeatures/Secrets/Interfaces/IDeleteSecretCommand.cs b/src/Core/SecretsManager/Commands/Secrets/Interfaces/IDeleteSecretCommand.cs similarity index 51% rename from src/Core/SecretManagerFeatures/Secrets/Interfaces/IDeleteSecretCommand.cs rename to src/Core/SecretsManager/Commands/Secrets/Interfaces/IDeleteSecretCommand.cs index ee7c12da3..493060e52 100644 --- a/src/Core/SecretManagerFeatures/Secrets/Interfaces/IDeleteSecretCommand.cs +++ b/src/Core/SecretsManager/Commands/Secrets/Interfaces/IDeleteSecretCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.Secrets.Interfaces; +namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces; public interface IDeleteSecretCommand { diff --git a/src/Core/SecretsManager/Commands/Secrets/Interfaces/IUpdateSecretCommand.cs b/src/Core/SecretsManager/Commands/Secrets/Interfaces/IUpdateSecretCommand.cs new file mode 100644 index 000000000..8c2f61abc --- /dev/null +++ b/src/Core/SecretsManager/Commands/Secrets/Interfaces/IUpdateSecretCommand.cs @@ -0,0 +1,8 @@ +using Bit.Core.SecretsManager.Entities; + +namespace Bit.Core.SecretsManager.Commands.Secrets.Interfaces; + +public interface IUpdateSecretCommand +{ + Task UpdateAsync(Secret secret); +} diff --git a/src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs b/src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs similarity index 51% rename from src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs rename to src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs index b236889ed..42eaf6824 100644 --- a/src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs +++ b/src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/ICreateServiceAccountCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +namespace Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; public interface ICreateServiceAccountCommand { diff --git a/src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs b/src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs similarity index 54% rename from src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs rename to src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs index 629b259e2..2844f2903 100644 --- a/src/Core/SecretManagerFeatures/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs +++ b/src/Core/SecretsManager/Commands/ServiceAccounts/Interfaces/IUpdateServiceAccountCommand.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +namespace Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; public interface IUpdateServiceAccountCommand { diff --git a/src/Core/Entities/AccessPolicy.cs b/src/Core/SecretsManager/Entities/AccessPolicy.cs similarity index 95% rename from src/Core/Entities/AccessPolicy.cs rename to src/Core/SecretsManager/Entities/AccessPolicy.cs index 4c95831fd..62e79d0f2 100644 --- a/src/Core/Entities/AccessPolicy.cs +++ b/src/Core/SecretsManager/Entities/AccessPolicy.cs @@ -1,7 +1,8 @@ #nullable enable +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.SecretsManager.Entities; public abstract class BaseAccessPolicy { diff --git a/src/Core/Entities/ApiKey.cs b/src/Core/SecretsManager/Entities/ApiKey.cs similarity index 93% rename from src/Core/Entities/ApiKey.cs rename to src/Core/SecretsManager/Entities/ApiKey.cs index e9c16da73..0e6d2a18e 100644 --- a/src/Core/Entities/ApiKey.cs +++ b/src/Core/SecretsManager/Entities/ApiKey.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.SecretsManager.Entities; public class ApiKey : ITableObject { diff --git a/src/Core/Entities/Project.cs b/src/Core/SecretsManager/Entities/Project.cs similarity index 89% rename from src/Core/Entities/Project.cs rename to src/Core/SecretsManager/Entities/Project.cs index 6c4c4c07f..f843ce62c 100644 --- a/src/Core/Entities/Project.cs +++ b/src/Core/SecretsManager/Entities/Project.cs @@ -1,7 +1,8 @@ #nullable enable +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.SecretsManager.Entities; public class Project : ITableObject { diff --git a/src/Core/Entities/Secret.cs b/src/Core/SecretsManager/Entities/Secret.cs similarity index 90% rename from src/Core/Entities/Secret.cs rename to src/Core/SecretsManager/Entities/Secret.cs index 4470f36b9..830f98bfa 100644 --- a/src/Core/Entities/Secret.cs +++ b/src/Core/SecretsManager/Entities/Secret.cs @@ -1,7 +1,8 @@ #nullable enable +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.SecretsManager.Entities; public class Secret : ITableObject { diff --git a/src/Core/Entities/ServiceAccount.cs b/src/Core/SecretsManager/Entities/ServiceAccount.cs similarity index 87% rename from src/Core/Entities/ServiceAccount.cs rename to src/Core/SecretsManager/Entities/ServiceAccount.cs index b835dbdb8..f52fb81c6 100644 --- a/src/Core/Entities/ServiceAccount.cs +++ b/src/Core/SecretsManager/Entities/ServiceAccount.cs @@ -1,7 +1,8 @@ #nullable enable +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.SecretsManager.Entities; public class ServiceAccount : ITableObject { diff --git a/src/Core/Models/Data/ApiKeyDetails.cs b/src/Core/SecretsManager/Models/Data/ApiKeyDetails.cs similarity index 90% rename from src/Core/Models/Data/ApiKeyDetails.cs rename to src/Core/SecretsManager/Models/Data/ApiKeyDetails.cs index 3e1546889..b09496eb1 100644 --- a/src/Core/Models/Data/ApiKeyDetails.cs +++ b/src/Core/SecretsManager/Models/Data/ApiKeyDetails.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.Models.Data; +namespace Bit.Core.SecretsManager.Models.Data; public class ApiKeyDetails : ApiKey { diff --git a/src/Core/Repositories/IAccessPolicyRepository.cs b/src/Core/SecretsManager/Repositories/IAccessPolicyRepository.cs similarity index 83% rename from src/Core/Repositories/IAccessPolicyRepository.cs rename to src/Core/SecretsManager/Repositories/IAccessPolicyRepository.cs index e231b4e7d..3450fdc80 100644 --- a/src/Core/Repositories/IAccessPolicyRepository.cs +++ b/src/Core/SecretsManager/Repositories/IAccessPolicyRepository.cs @@ -1,7 +1,7 @@ #nullable enable -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.SecretsManager.Repositories; public interface IAccessPolicyRepository { diff --git a/src/Core/Repositories/IApiKeyRepository.cs b/src/Core/SecretsManager/Repositories/IApiKeyRepository.cs similarity index 54% rename from src/Core/Repositories/IApiKeyRepository.cs rename to src/Core/SecretsManager/Repositories/IApiKeyRepository.cs index dd99c99a9..dc48b5295 100644 --- a/src/Core/Repositories/IApiKeyRepository.cs +++ b/src/Core/SecretsManager/Repositories/IApiKeyRepository.cs @@ -1,7 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Models.Data; -namespace Bit.Core.Repositories; +namespace Bit.Core.SecretsManager.Repositories; public interface IApiKeyRepository : IRepository { diff --git a/src/Core/Repositories/IProjectRepository.cs b/src/Core/SecretsManager/Repositories/IProjectRepository.cs similarity index 82% rename from src/Core/Repositories/IProjectRepository.cs rename to src/Core/SecretsManager/Repositories/IProjectRepository.cs index ef2491462..ee752f545 100644 --- a/src/Core/Repositories/IProjectRepository.cs +++ b/src/Core/SecretsManager/Repositories/IProjectRepository.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Enums; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.SecretsManager.Repositories; public interface IProjectRepository { diff --git a/src/Core/Repositories/ISecretRepository.cs b/src/Core/SecretsManager/Repositories/ISecretRepository.cs similarity index 83% rename from src/Core/Repositories/ISecretRepository.cs rename to src/Core/SecretsManager/Repositories/ISecretRepository.cs index d52e567a4..0b96def9f 100644 --- a/src/Core/Repositories/ISecretRepository.cs +++ b/src/Core/SecretsManager/Repositories/ISecretRepository.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.SecretsManager.Repositories; public interface ISecretRepository { diff --git a/src/Core/Repositories/IServiceAccountRepository.cs b/src/Core/SecretsManager/Repositories/IServiceAccountRepository.cs similarity index 81% rename from src/Core/Repositories/IServiceAccountRepository.cs rename to src/Core/SecretsManager/Repositories/IServiceAccountRepository.cs index cd611936f..924a18f0b 100644 --- a/src/Core/Repositories/IServiceAccountRepository.cs +++ b/src/Core/SecretsManager/Repositories/IServiceAccountRepository.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Enums; +using Bit.Core.SecretsManager.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.SecretsManager.Repositories; public interface IServiceAccountRepository { diff --git a/src/Identity/IdentityServer/ClientStore.cs b/src/Identity/IdentityServer/ClientStore.cs index 5400f3116..1ba8896d4 100644 --- a/src/Identity/IdentityServer/ClientStore.cs +++ b/src/Identity/IdentityServer/ClientStore.cs @@ -4,8 +4,9 @@ using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Identity; using Bit.Core.IdentityServer; -using Bit.Core.Models.Data; using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Models.Data; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; diff --git a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs index 044a03b8d..7d1231190 100644 --- a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs +++ b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs @@ -1,5 +1,7 @@ using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.Dapper.Repositories; +using Bit.Infrastructure.Dapper.SecretsManager.Repositories; using Microsoft.Extensions.DependencyInjection; namespace Bit.Infrastructure.Dapper; diff --git a/src/Infrastructure.Dapper/Repositories/ApiKeyRepository.cs b/src/Infrastructure.Dapper/SecretsManager/Repositories/ApiKeyRepository.cs similarity index 86% rename from src/Infrastructure.Dapper/Repositories/ApiKeyRepository.cs rename to src/Infrastructure.Dapper/SecretsManager/Repositories/ApiKeyRepository.cs index d50855c93..8a13eb52c 100644 --- a/src/Infrastructure.Dapper/Repositories/ApiKeyRepository.cs +++ b/src/Infrastructure.Dapper/SecretsManager/Repositories/ApiKeyRepository.cs @@ -1,12 +1,13 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Models.Data; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Models.Data; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Settings; +using Bit.Infrastructure.Dapper.Repositories; using Dapper; using Microsoft.Data.SqlClient; -namespace Bit.Infrastructure.Dapper.Repositories; +namespace Bit.Infrastructure.Dapper.SecretsManager.Repositories; public class ApiKeyRepository : Repository, IApiKeyRepository { diff --git a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs index d246ea9fc..d40c770da 100644 --- a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs +++ b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs @@ -1,6 +1,8 @@ using Bit.Core.Enums; using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Models/ApiKey.cs b/src/Infrastructure.EntityFramework/Models/ApiKey.cs deleted file mode 100644 index 0713bfb0d..000000000 --- a/src/Infrastructure.EntityFramework/Models/ApiKey.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; - -namespace Bit.Infrastructure.EntityFramework.Models; - -public class ApiKey : Core.Entities.ApiKey -{ - public virtual ServiceAccount ServiceAccount { get; set; } -} - -public class ApiKeyMapperProfile : Profile -{ - public ApiKeyMapperProfile() - { - CreateMap().ReverseMap(); - } -} diff --git a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs index e4cabaffa..4368c97b4 100644 --- a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs @@ -1,6 +1,7 @@ using Bit.Core; using Bit.Infrastructure.EntityFramework.Converters; using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/src/Infrastructure.EntityFramework/Configurations/AccessPolicyEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/AccessPolicyEntityTypeConfiguration.cs similarity index 96% rename from src/Infrastructure.EntityFramework/Configurations/AccessPolicyEntityTypeConfiguration.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Configurations/AccessPolicyEntityTypeConfiguration.cs index 0a815dda6..dd7f01f5d 100644 --- a/src/Infrastructure.EntityFramework/Configurations/AccessPolicyEntityTypeConfiguration.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/AccessPolicyEntityTypeConfiguration.cs @@ -1,8 +1,8 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace Bit.Infrastructure.EntityFramework.Configurations; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations; public class AccessPolicyEntityTypeConfiguration : IEntityTypeConfiguration { diff --git a/src/Infrastructure.EntityFramework/Configurations/ApiKeyEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ApiKeyEntityTypeConfiguration.cs similarity index 79% rename from src/Infrastructure.EntityFramework/Configurations/ApiKeyEntityTypeConfiguration.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Configurations/ApiKeyEntityTypeConfiguration.cs index c42e0d553..32a3299c7 100644 --- a/src/Infrastructure.EntityFramework/Configurations/ApiKeyEntityTypeConfiguration.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ApiKeyEntityTypeConfiguration.cs @@ -1,8 +1,8 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace Bit.Infrastructure.EntityFramework.Configurations; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations; public class ApiKeyEntityTypeConfiguration : IEntityTypeConfiguration { diff --git a/src/Infrastructure.EntityFramework/Configurations/ProjectEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ProjectEntityTypeConfiguration.cs similarity index 81% rename from src/Infrastructure.EntityFramework/Configurations/ProjectEntityTypeConfiguration.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Configurations/ProjectEntityTypeConfiguration.cs index d8ed63e46..69d44d1c1 100644 --- a/src/Infrastructure.EntityFramework/Configurations/ProjectEntityTypeConfiguration.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ProjectEntityTypeConfiguration.cs @@ -1,8 +1,8 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace Bit.Infrastructure.EntityFramework.Configurations; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations; public class ProjectEntityTypeConfiguration : IEntityTypeConfiguration { diff --git a/src/Infrastructure.EntityFramework/Configurations/SecretEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/SecretEntityTypeConfiguration.cs similarity index 81% rename from src/Infrastructure.EntityFramework/Configurations/SecretEntityTypeConfiguration.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Configurations/SecretEntityTypeConfiguration.cs index 6c10dfc45..63ebb119d 100644 --- a/src/Infrastructure.EntityFramework/Configurations/SecretEntityTypeConfiguration.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/SecretEntityTypeConfiguration.cs @@ -1,8 +1,8 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace Bit.Infrastructure.EntityFramework.Configurations; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations; public class SecretEntityTypeConfiguration : IEntityTypeConfiguration { diff --git a/src/Infrastructure.EntityFramework/Configurations/ServiceAccountEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ServiceAccountEntityTypeConfiguration.cs similarity index 80% rename from src/Infrastructure.EntityFramework/Configurations/ServiceAccountEntityTypeConfiguration.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Configurations/ServiceAccountEntityTypeConfiguration.cs index 11c3b8511..bb5b90b03 100644 --- a/src/Infrastructure.EntityFramework/Configurations/ServiceAccountEntityTypeConfiguration.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Configurations/ServiceAccountEntityTypeConfiguration.cs @@ -1,7 +1,9 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Configurations; + public class ServiceAccountEntityTypeConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/src/Infrastructure.EntityFramework/Models/AccessPolicy.cs b/src/Infrastructure.EntityFramework/SecretsManager/Models/AccessPolicy.cs similarity index 69% rename from src/Infrastructure.EntityFramework/Models/AccessPolicy.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Models/AccessPolicy.cs index 843965eb6..a30707018 100644 --- a/src/Infrastructure.EntityFramework/Models/AccessPolicy.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Models/AccessPolicy.cs @@ -1,8 +1,9 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models; -public class BaseAccessPolicy : Core.Entities.BaseAccessPolicy +public class BaseAccessPolicy : Core.SecretsManager.Entities.BaseAccessPolicy { public string Discriminator { get; set; } } @@ -11,13 +12,13 @@ public class AccessPolicyMapperProfile : Profile { public AccessPolicyMapperProfile() { - CreateMap().ReverseMap() + CreateMap().ReverseMap() .ForMember(dst => dst.User, opt => opt.MapFrom(src => src.OrganizationUser.User)); - CreateMap().ReverseMap() + CreateMap().ReverseMap() .ForMember(dst => dst.User, opt => opt.MapFrom(src => src.OrganizationUser.User)); - CreateMap().ReverseMap(); - CreateMap().ReverseMap(); - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/SecretsManager/Models/ApiKey.cs b/src/Infrastructure.EntityFramework/SecretsManager/Models/ApiKey.cs new file mode 100644 index 000000000..7d2c05f14 --- /dev/null +++ b/src/Infrastructure.EntityFramework/SecretsManager/Models/ApiKey.cs @@ -0,0 +1,16 @@ +using AutoMapper; + +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models; + +public class ApiKey : Core.SecretsManager.Entities.ApiKey +{ + public virtual ServiceAccount ServiceAccount { get; set; } +} + +public class ApiKeyMapperProfile : Profile +{ + public ApiKeyMapperProfile() + { + CreateMap().ReverseMap(); + } +} diff --git a/src/Infrastructure.EntityFramework/Models/Project.cs b/src/Infrastructure.EntityFramework/SecretsManager/Models/Project.cs similarity index 70% rename from src/Infrastructure.EntityFramework/Models/Project.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Models/Project.cs index 47fc51c94..8dde66942 100644 --- a/src/Infrastructure.EntityFramework/Models/Project.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Models/Project.cs @@ -1,8 +1,9 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models; -public class Project : Core.Entities.Project +public class Project : Core.SecretsManager.Entities.Project { public virtual new ICollection Secrets { get; set; } public virtual Organization Organization { get; set; } @@ -15,7 +16,7 @@ public class ProjectMapperProfile : Profile { public ProjectMapperProfile() { - CreateMap() + CreateMap() .PreserveReferences() .ReverseMap(); } diff --git a/src/Infrastructure.EntityFramework/Models/Secret.cs b/src/Infrastructure.EntityFramework/SecretsManager/Models/Secret.cs similarity index 56% rename from src/Infrastructure.EntityFramework/Models/Secret.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Models/Secret.cs index 7c6c6b697..abbc3620a 100644 --- a/src/Infrastructure.EntityFramework/Models/Secret.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Models/Secret.cs @@ -1,8 +1,9 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models; -public class Secret : Core.Entities.Secret +public class Secret : Core.SecretsManager.Entities.Secret { public virtual new ICollection Projects { get; set; } public virtual Organization Organization { get; set; } @@ -12,7 +13,7 @@ public class SecretMapperProfile : Profile { public SecretMapperProfile() { - CreateMap() + CreateMap() .PreserveReferences() .ReverseMap(); } diff --git a/src/Infrastructure.EntityFramework/Models/ServiceAccount.cs b/src/Infrastructure.EntityFramework/SecretsManager/Models/ServiceAccount.cs similarity index 57% rename from src/Infrastructure.EntityFramework/Models/ServiceAccount.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Models/ServiceAccount.cs index 5622cda8f..87e6892f3 100644 --- a/src/Infrastructure.EntityFramework/Models/ServiceAccount.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Models/ServiceAccount.cs @@ -1,8 +1,9 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Models; -public class ServiceAccount : Core.Entities.ServiceAccount +public class ServiceAccount : Core.SecretsManager.Entities.ServiceAccount { public virtual Organization Organization { get; set; } public virtual ICollection GroupAccessPolicies { get; set; } @@ -13,6 +14,6 @@ public class ServiceAccountMapperProfile : Profile { public ServiceAccountMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Repositories/ApiKeyRepository.cs b/src/Infrastructure.EntityFramework/SecretsManager/Repositories/ApiKeyRepository.cs similarity index 64% rename from src/Infrastructure.EntityFramework/Repositories/ApiKeyRepository.cs rename to src/Infrastructure.EntityFramework/SecretsManager/Repositories/ApiKeyRepository.cs index df569e124..364415e06 100644 --- a/src/Infrastructure.EntityFramework/Repositories/ApiKeyRepository.cs +++ b/src/Infrastructure.EntityFramework/SecretsManager/Repositories/ApiKeyRepository.cs @@ -1,13 +1,14 @@ using AutoMapper; -using Bit.Core.Models.Data; -using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Core.SecretsManager.Models.Data; +using Bit.Core.SecretsManager.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.SecretsManager.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Infrastructure.EntityFramework.Repositories; +namespace Bit.Infrastructure.EntityFramework.SecretsManager.Repositories; -public class ApiKeyRepository : Repository, IApiKeyRepository +public class ApiKeyRepository : Repository, IApiKeyRepository { public ApiKeyRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.ApiKeys) @@ -27,12 +28,12 @@ public class ApiKeyRepository : Repository, return Mapper.Map(entity); } - public async Task> GetManyByServiceAccountIdAsync(Guid id) + public async Task> GetManyByServiceAccountIdAsync(Guid id) { using var scope = ServiceScopeFactory.CreateScope(); var dbContext = GetDatabaseContext(scope); var apiKeys = await GetDbSet(dbContext).Where(e => e.ServiceAccountId == id).ToListAsync(); - return Mapper.Map>(apiKeys); + return Mapper.Map>(apiKeys); } } diff --git a/src/Sql/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql b/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql rename to src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql b/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql rename to src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql b/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql rename to src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql diff --git a/src/Sql/dbo/Tables/AccessPolicy.sql b/src/Sql/SecretsManager/dbo/Tables/AccessPolicy.sql similarity index 100% rename from src/Sql/dbo/Tables/AccessPolicy.sql rename to src/Sql/SecretsManager/dbo/Tables/AccessPolicy.sql diff --git a/src/Sql/dbo/Tables/ApiKey.sql b/src/Sql/SecretsManager/dbo/Tables/ApiKey.sql similarity index 100% rename from src/Sql/dbo/Tables/ApiKey.sql rename to src/Sql/SecretsManager/dbo/Tables/ApiKey.sql diff --git a/src/Sql/dbo/Tables/Project.sql b/src/Sql/SecretsManager/dbo/Tables/Project.sql similarity index 100% rename from src/Sql/dbo/Tables/Project.sql rename to src/Sql/SecretsManager/dbo/Tables/Project.sql diff --git a/src/Sql/dbo/Tables/ProjectSecret.sql b/src/Sql/SecretsManager/dbo/Tables/ProjectSecret.sql similarity index 100% rename from src/Sql/dbo/Tables/ProjectSecret.sql rename to src/Sql/SecretsManager/dbo/Tables/ProjectSecret.sql diff --git a/src/Sql/dbo/Tables/Secret.sql b/src/Sql/SecretsManager/dbo/Tables/Secret.sql similarity index 100% rename from src/Sql/dbo/Tables/Secret.sql rename to src/Sql/SecretsManager/dbo/Tables/Secret.sql diff --git a/src/Sql/dbo/Tables/ServiceAccount.sql b/src/Sql/SecretsManager/dbo/Tables/ServiceAccount.sql similarity index 100% rename from src/Sql/dbo/Tables/ServiceAccount.sql rename to src/Sql/SecretsManager/dbo/Tables/ServiceAccount.sql diff --git a/src/Sql/dbo/Views/ApiKeyDetailsView.sql b/src/Sql/SecretsManager/dbo/Views/ApiKeyDetailsView.sql similarity index 100% rename from src/Sql/dbo/Views/ApiKeyDetailsView.sql rename to src/Sql/SecretsManager/dbo/Views/ApiKeyDetailsView.sql diff --git a/src/Sql/dbo/Views/ApiKeyView.sql b/src/Sql/SecretsManager/dbo/Views/ApiKeyView.sql similarity index 100% rename from src/Sql/dbo/Views/ApiKeyView.sql rename to src/Sql/SecretsManager/dbo/Views/ApiKeyView.sql diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index 9495c56a9..9618c21cc 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -73,9 +73,6 @@ - - - @@ -363,8 +360,6 @@ - - @@ -385,14 +380,10 @@ - - - - @@ -404,8 +395,6 @@ - - @@ -436,5 +425,16 @@ + + + + + + + + + + + diff --git a/test/Api.IntegrationTest/Controllers/AccessPoliciesControllerTest.cs b/test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTest.cs similarity index 96% rename from test/Api.IntegrationTest/Controllers/AccessPoliciesControllerTest.cs rename to test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTest.cs index ecf1e5556..74b0e062b 100644 --- a/test/Api.IntegrationTest/Controllers/AccessPoliciesControllerTest.cs +++ b/test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTest.cs @@ -1,14 +1,15 @@ using System.Net.Http.Headers; using Bit.Api.IntegrationTest.Factories; using Bit.Api.IntegrationTest.Helpers; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.Helpers; using Xunit; -namespace Bit.Api.IntegrationTest.Controllers; +namespace Bit.Api.IntegrationTest.SecretsManager.Controllers; public class AccessPoliciesControllerTest : IClassFixture, IAsyncLifetime { diff --git a/test/Api.IntegrationTest/Controllers/ProjectsControllerTest.cs b/test/Api.IntegrationTest/SecretsManager/Controllers/ProjectsControllerTest.cs similarity index 97% rename from test/Api.IntegrationTest/Controllers/ProjectsControllerTest.cs rename to test/Api.IntegrationTest/SecretsManager/Controllers/ProjectsControllerTest.cs index c1c4e048b..02dce9629 100644 --- a/test/Api.IntegrationTest/Controllers/ProjectsControllerTest.cs +++ b/test/Api.IntegrationTest/SecretsManager/Controllers/ProjectsControllerTest.cs @@ -3,15 +3,16 @@ using System.Net.Http.Headers; using Bit.Api.IntegrationTest.Factories; using Bit.Api.IntegrationTest.Helpers; using Bit.Api.Models.Response; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.Helpers; using Xunit; -namespace Bit.Api.IntegrationTest.Controllers; +namespace Bit.Api.IntegrationTest.SecretsManager.Controllers; public class ProjectsControllerTest : IClassFixture, IAsyncLifetime { diff --git a/test/Api.IntegrationTest/Controllers/SecretsControllerTest.cs b/test/Api.IntegrationTest/SecretsManager/Controllers/SecretsControllerTest.cs similarity index 97% rename from test/Api.IntegrationTest/Controllers/SecretsControllerTest.cs rename to test/Api.IntegrationTest/SecretsManager/Controllers/SecretsControllerTest.cs index 21093d462..a93bd05fe 100644 --- a/test/Api.IntegrationTest/Controllers/SecretsControllerTest.cs +++ b/test/Api.IntegrationTest/SecretsManager/Controllers/SecretsControllerTest.cs @@ -2,14 +2,15 @@ using Bit.Api.IntegrationTest.Factories; using Bit.Api.IntegrationTest.Helpers; using Bit.Api.Models.Response; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.Helpers; using Xunit; -namespace Bit.Api.IntegrationTest.Controllers; +namespace Bit.Api.IntegrationTest.SecretsManager.Controllers; public class SecretsControllerTest : IClassFixture, IAsyncLifetime { diff --git a/test/Api.IntegrationTest/Controllers/ServiceAccountsControllerTests.cs b/test/Api.IntegrationTest/SecretsManager/Controllers/ServiceAccountsControllerTests.cs similarity index 98% rename from test/Api.IntegrationTest/Controllers/ServiceAccountsControllerTests.cs rename to test/Api.IntegrationTest/SecretsManager/Controllers/ServiceAccountsControllerTests.cs index 5909cca81..0de403137 100644 --- a/test/Api.IntegrationTest/Controllers/ServiceAccountsControllerTests.cs +++ b/test/Api.IntegrationTest/SecretsManager/Controllers/ServiceAccountsControllerTests.cs @@ -3,15 +3,16 @@ using System.Net.Http.Headers; using Bit.Api.IntegrationTest.Factories; using Bit.Api.IntegrationTest.Helpers; using Bit.Api.Models.Response; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Api.SecretManagerFeatures.Models.Response; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Api.SecretsManager.Models.Response; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Repositories; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.Helpers; using Xunit; -namespace Bit.Api.IntegrationTest.Controllers; +namespace Bit.Api.IntegrationTest.SecretsManager.Controllers; public class ServiceAccountsControllerTest : IClassFixture, IAsyncLifetime { diff --git a/test/Api.Test/Controllers/AccessPoliciesControllerTests.cs b/test/Api.Test/SecretsManager/Controllers/AccessPoliciesControllerTests.cs similarity index 92% rename from test/Api.Test/Controllers/AccessPoliciesControllerTests.cs rename to test/Api.Test/SecretsManager/Controllers/AccessPoliciesControllerTests.cs index 236889ba4..644f6a170 100644 --- a/test/Api.Test/Controllers/AccessPoliciesControllerTests.cs +++ b/test/Api.Test/SecretsManager/Controllers/AccessPoliciesControllerTests.cs @@ -1,8 +1,8 @@ -using Bit.Api.Controllers; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Core.Entities; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessPolicies.Interfaces; +using Bit.Api.SecretsManager.Controllers; +using Bit.Api.SecretsManager.Models.Request; +using Bit.Core.SecretsManager.Commands.AccessPolicies.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; @@ -10,7 +10,7 @@ using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; -namespace Bit.Api.Test.Controllers; +namespace Bit.Api.Test.SecretsManager.Controllers; [ControllerCustomize(typeof(AccessPoliciesController))] [SutProviderCustomize] diff --git a/test/Api.Test/Controllers/ProjectsControllerTests.cs b/test/Api.Test/SecretsManager/Controllers/ProjectsControllerTests.cs similarity index 86% rename from test/Api.Test/Controllers/ProjectsControllerTests.cs rename to test/Api.Test/SecretsManager/Controllers/ProjectsControllerTests.cs index 0ffefe7c5..1a83fd5c7 100644 --- a/test/Api.Test/Controllers/ProjectsControllerTests.cs +++ b/test/Api.Test/SecretsManager/Controllers/ProjectsControllerTests.cs @@ -1,14 +1,14 @@ -using Bit.Api.Controllers; -using Bit.Core.Entities; -using Bit.Core.SecretManagerFeatures.Projects.Interfaces; +using Bit.Api.SecretsManager.Controllers; +using Bit.Core.SecretsManager.Commands.Projects.Interfaces; +using Bit.Core.SecretsManager.Entities; using Bit.Core.Services; -using Bit.Core.Test.AutoFixture.ProjectsFixture; +using Bit.Core.Test.SecretsManager.AutoFixture.ProjectsFixture; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Api.Test.Controllers; +namespace Bit.Api.Test.SecretsManager.Controllers; [ControllerCustomize(typeof(ProjectsController))] [SutProviderCustomize] diff --git a/test/Api.Test/Controllers/SecretsControllerTests.cs b/test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs similarity index 92% rename from test/Api.Test/Controllers/SecretsControllerTests.cs rename to test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs index 49a4f937c..f8454dfa1 100644 --- a/test/Api.Test/Controllers/SecretsControllerTests.cs +++ b/test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs @@ -1,17 +1,17 @@ -using Bit.Api.Controllers; -using Bit.Api.SecretManagerFeatures.Models.Request; -using Bit.Core.Entities; +using Bit.Api.SecretsManager.Controllers; +using Bit.Api.SecretsManager.Models.Request; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.Secrets.Interfaces; -using Bit.Core.Test.AutoFixture.SecretsFixture; +using Bit.Core.SecretsManager.Commands.Secrets.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Test.SecretsManager.AutoFixture.SecretsFixture; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Bit.Test.Common.Helpers; using NSubstitute; using Xunit; -namespace Bit.Api.Test.Controllers; +namespace Bit.Api.Test.SecretsManager.Controllers; [ControllerCustomize(typeof(SecretsController))] [SutProviderCustomize] diff --git a/test/Api.Test/Controllers/ServiceAccountsControllerTests.cs b/test/Api.Test/SecretsManager/Controllers/ServiceAccountsControllerTests.cs similarity index 96% rename from test/Api.Test/Controllers/ServiceAccountsControllerTests.cs rename to test/Api.Test/SecretsManager/Controllers/ServiceAccountsControllerTests.cs index 3e0d8f851..2cbe18df7 100644 --- a/test/Api.Test/Controllers/ServiceAccountsControllerTests.cs +++ b/test/Api.Test/SecretsManager/Controllers/ServiceAccountsControllerTests.cs @@ -1,12 +1,12 @@ -using Bit.Api.Controllers; -using Bit.Api.SecretManagerFeatures.Models.Request; +using Bit.Api.SecretsManager.Controllers; +using Bit.Api.SecretsManager.Models.Request; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Repositories; -using Bit.Core.SecretManagerFeatures.AccessTokens.Interfaces; -using Bit.Core.SecretManagerFeatures.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Commands.AccessTokens.Interfaces; +using Bit.Core.SecretsManager.Commands.ServiceAccounts.Interfaces; +using Bit.Core.SecretsManager.Entities; +using Bit.Core.SecretsManager.Repositories; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; @@ -15,7 +15,7 @@ using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; -namespace Bit.Api.Test.Controllers; +namespace Bit.Api.Test.SecretsManager.Controllers; [ControllerCustomize(typeof(ServiceAccountsController))] [SutProviderCustomize] diff --git a/test/Core.Test/AutoFixture/ProjectFixtures.cs b/test/Core.Test/SecretsManager/AutoFixture/ProjectFixtures.cs similarity index 82% rename from test/Core.Test/AutoFixture/ProjectFixtures.cs rename to test/Core.Test/SecretsManager/AutoFixture/ProjectFixtures.cs index 7ab92fa47..448579593 100644 --- a/test/Core.Test/AutoFixture/ProjectFixtures.cs +++ b/test/Core.Test/SecretsManager/AutoFixture/ProjectFixtures.cs @@ -1,8 +1,8 @@ using AutoFixture; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Core.Test.AutoFixture.ProjectsFixture; +namespace Bit.Core.Test.SecretsManager.AutoFixture.ProjectsFixture; public class ProjectCustomization : ICustomization { diff --git a/test/Core.Test/AutoFixture/SecretFixtures.cs b/test/Core.Test/SecretsManager/AutoFixture/SecretFixtures.cs similarity index 82% rename from test/Core.Test/AutoFixture/SecretFixtures.cs rename to test/Core.Test/SecretsManager/AutoFixture/SecretFixtures.cs index 16838986b..b2f82e80c 100644 --- a/test/Core.Test/AutoFixture/SecretFixtures.cs +++ b/test/Core.Test/SecretsManager/AutoFixture/SecretFixtures.cs @@ -1,8 +1,8 @@ using AutoFixture; -using Bit.Core.Entities; +using Bit.Core.SecretsManager.Entities; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Core.Test.AutoFixture.SecretsFixture; +namespace Bit.Core.Test.SecretsManager.AutoFixture.SecretsFixture; public class SecretCustomization : ICustomization {