diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 84e2577046..80e09368a8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,5 +2,10 @@ # # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners +## Auth team files ## +**/Auth @bitwarden/team-auth-dev +bitwarden_license/src/Sso @bitwarden/team-auth-dev +src/Identity @bitwarden/team-auth-dev + **/SecretsManager @bitwarden/team-secrets-manager-dev **/Vault @bitwarden/team-vault-dev diff --git a/bitwarden_license/src/Sso/Controllers/AccountController.cs b/bitwarden_license/src/Sso/Controllers/AccountController.cs index 2f8e8e90f7..11399c7e34 100644 --- a/bitwarden_license/src/Sso/Controllers/AccountController.cs +++ b/bitwarden_license/src/Sso/Controllers/AccountController.cs @@ -1,11 +1,14 @@ using System.Security.Claims; using Bit.Core; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Models.Business.Tokenables; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Api; -using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/bitwarden_license/src/Sso/Controllers/MetadataController.cs b/bitwarden_license/src/Sso/Controllers/MetadataController.cs index 54f4f8cd44..ba9e350d17 100644 --- a/bitwarden_license/src/Sso/Controllers/MetadataController.cs +++ b/bitwarden_license/src/Sso/Controllers/MetadataController.cs @@ -1,4 +1,4 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Bit.Sso.Utilities; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Mvc; diff --git a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationScheme.cs b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationScheme.cs index 96a316bc62..fb3a273283 100644 --- a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationScheme.cs +++ b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationScheme.cs @@ -1,4 +1,4 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Sustainsys.Saml2.AspNetCore2; diff --git a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs index b02e83deda..aeef3f679b 100644 --- a/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs +++ b/bitwarden_license/src/Sso/Utilities/DynamicAuthenticationSchemeProvider.cs @@ -1,8 +1,8 @@ using System.Security.Cryptography.X509Certificates; -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; -using Bit.Core.Repositories; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; using Bit.Sso.Models; diff --git a/bitwarden_license/src/Sso/Utilities/IDynamicAuthenticationScheme.cs b/bitwarden_license/src/Sso/Utilities/IDynamicAuthenticationScheme.cs index 9ebd0f9cfc..cbe26cf040 100644 --- a/bitwarden_license/src/Sso/Utilities/IDynamicAuthenticationScheme.cs +++ b/bitwarden_license/src/Sso/Utilities/IDynamicAuthenticationScheme.cs @@ -1,4 +1,4 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Microsoft.AspNetCore.Authentication; namespace Bit.Sso.Utilities; diff --git a/bitwarden_license/src/Sso/Utilities/SsoAuthenticationMiddleware.cs b/bitwarden_license/src/Sso/Utilities/SsoAuthenticationMiddleware.cs index 9dca7a6909..d72b13110d 100644 --- a/bitwarden_license/src/Sso/Utilities/SsoAuthenticationMiddleware.cs +++ b/bitwarden_license/src/Sso/Utilities/SsoAuthenticationMiddleware.cs @@ -1,4 +1,4 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Sustainsys.Saml2.AspNetCore2; diff --git a/src/Admin/Controllers/LoginController.cs b/src/Admin/Auth/Controllers/LoginController.cs similarity index 95% rename from src/Admin/Controllers/LoginController.cs rename to src/Admin/Auth/Controllers/LoginController.cs index a6ee8e37f2..dbc04e96c0 100644 --- a/src/Admin/Controllers/LoginController.cs +++ b/src/Admin/Auth/Controllers/LoginController.cs @@ -1,9 +1,9 @@ -using Bit.Admin.IdentityServer; -using Bit.Admin.Models; +using Bit.Admin.Auth.IdentityServer; +using Bit.Admin.Auth.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -namespace Bit.Admin.Controllers; +namespace Bit.Admin.Auth.Controllers; public class LoginController : Controller { diff --git a/src/Admin/IdentityServer/PasswordlessSignInManager.cs b/src/Admin/Auth/IdentityServer/PasswordlessSignInManager.cs similarity index 98% rename from src/Admin/IdentityServer/PasswordlessSignInManager.cs rename to src/Admin/Auth/IdentityServer/PasswordlessSignInManager.cs index 6c346158ec..6c00e0c986 100644 --- a/src/Admin/IdentityServer/PasswordlessSignInManager.cs +++ b/src/Admin/Auth/IdentityServer/PasswordlessSignInManager.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; -namespace Bit.Admin.IdentityServer; +namespace Bit.Admin.Auth.IdentityServer; public class PasswordlessSignInManager : SignInManager where TUser : class { diff --git a/src/Admin/Jobs/DatabaseExpiredGrantsJob.cs b/src/Admin/Auth/Jobs/DatabaseExpiredGrantsJob.cs similarity index 96% rename from src/Admin/Jobs/DatabaseExpiredGrantsJob.cs rename to src/Admin/Auth/Jobs/DatabaseExpiredGrantsJob.cs index 626eb00d52..c0b0a86799 100644 --- a/src/Admin/Jobs/DatabaseExpiredGrantsJob.cs +++ b/src/Admin/Auth/Jobs/DatabaseExpiredGrantsJob.cs @@ -3,7 +3,7 @@ using Bit.Core.Jobs; using Bit.Core.Repositories; using Quartz; -namespace Bit.Admin.Jobs; +namespace Bit.Admin.Auth.Jobs; public class DatabaseExpiredGrantsJob : BaseJob { diff --git a/src/Admin/Jobs/DeleteAuthRequestsJob.cs b/src/Admin/Auth/Jobs/DeleteAuthRequestsJob.cs similarity index 96% rename from src/Admin/Jobs/DeleteAuthRequestsJob.cs rename to src/Admin/Auth/Jobs/DeleteAuthRequestsJob.cs index f0d26a33ac..e1366ec248 100644 --- a/src/Admin/Jobs/DeleteAuthRequestsJob.cs +++ b/src/Admin/Auth/Jobs/DeleteAuthRequestsJob.cs @@ -3,7 +3,7 @@ using Bit.Core.Jobs; using Bit.Core.Repositories; using Quartz; -namespace Bit.Admin.Jobs; +namespace Bit.Admin.Auth.Jobs; public class DeleteAuthRequestsJob : BaseJob { diff --git a/src/Admin/Models/LoginModel.cs b/src/Admin/Auth/Models/LoginModel.cs similarity index 89% rename from src/Admin/Models/LoginModel.cs rename to src/Admin/Auth/Models/LoginModel.cs index 7f147874bb..7dd8521a4f 100644 --- a/src/Admin/Models/LoginModel.cs +++ b/src/Admin/Auth/Models/LoginModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Admin.Models; +namespace Bit.Admin.Auth.Models; public class LoginModel { diff --git a/src/Admin/Views/Login/Index.cshtml b/src/Admin/Auth/Views/Login/Index.cshtml similarity index 100% rename from src/Admin/Views/Login/Index.cshtml rename to src/Admin/Auth/Views/Login/Index.cshtml diff --git a/src/Admin/Auth/Views/_ViewImports.cshtml b/src/Admin/Auth/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..65072b113c --- /dev/null +++ b/src/Admin/Auth/Views/_ViewImports.cshtml @@ -0,0 +1,5 @@ +@using Microsoft.AspNetCore.Identity +@using Bit.Admin.Auth +@using Bit.Admin.Auth.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper "*, Admin" diff --git a/src/Admin/Auth/Views/_ViewStart.cshtml b/src/Admin/Auth/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/src/Admin/Auth/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/Admin/IdentityServer/ServiceCollectionExtensions.cs b/src/Admin/IdentityServer/ServiceCollectionExtensions.cs index bf4ac66cc1..e8d20940d0 100644 --- a/src/Admin/IdentityServer/ServiceCollectionExtensions.cs +++ b/src/Admin/IdentityServer/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ -using Bit.Core.Entities; -using Bit.Core.Identity; +using Bit.Admin.Auth.IdentityServer; +using Bit.Core.Auth.Identity; +using Bit.Core.Entities; using Bit.Core.Settings; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/Admin/Jobs/DeleteSendsJob.cs b/src/Admin/Jobs/DeleteSendsJob.cs index 9f3ed96efa..f26657f201 100644 --- a/src/Admin/Jobs/DeleteSendsJob.cs +++ b/src/Admin/Jobs/DeleteSendsJob.cs @@ -1,4 +1,5 @@ -using Bit.Core; +using Bit.Admin.Auth.Jobs; +using Bit.Core; using Bit.Core.Jobs; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/src/Admin/Jobs/JobsHostedService.cs b/src/Admin/Jobs/JobsHostedService.cs index 5aa770befc..cc9aedc80a 100644 --- a/src/Admin/Jobs/JobsHostedService.cs +++ b/src/Admin/Jobs/JobsHostedService.cs @@ -1,4 +1,5 @@ using System.Runtime.InteropServices; +using Bit.Admin.Auth.Jobs; using Bit.Core.Jobs; using Bit.Core.Settings; using Quartz; diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index 55dfa99b30..37d8445d25 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -6,6 +6,7 @@ using Bit.Core.Utilities; using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Identity; using Stripe; +using Microsoft.AspNetCore.Mvc.Razor; #if !OSS using Bit.Commercial.Core.Utilities; @@ -95,6 +96,11 @@ public class Startup }); services.Configure(options => options.LowercaseUrls = true); + services.Configure(o => + { + o.ViewLocationFormats.Add("/Auth/Views/{1}/{0}.cshtml"); + }); + // Jobs service Jobs.JobsHostedService.AddJobsServices(services, globalSettings.SelfHosted); services.AddHostedService(); diff --git a/src/Api/Controllers/AuthRequestsController.cs b/src/Api/Auth/Controllers/AuthRequestsController.cs similarity index 97% rename from src/Api/Controllers/AuthRequestsController.cs rename to src/Api/Auth/Controllers/AuthRequestsController.cs index ee5515fbbe..98f92cb682 100644 --- a/src/Api/Controllers/AuthRequestsController.cs +++ b/src/Api/Auth/Controllers/AuthRequestsController.cs @@ -1,7 +1,9 @@ -using Bit.Api.Models.Request; +using Bit.Api.Auth.Models.Request; +using Bit.Api.Auth.Models.Response; using Bit.Api.Models.Response; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Exceptions; using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Repositories; using Bit.Core.Services; @@ -10,7 +12,7 @@ using Bit.Core.Utilities; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Auth.Controllers; [Route("auth-requests")] [Authorize("Application")] diff --git a/src/Api/Controllers/EmergencyAccessController.cs b/src/Api/Auth/Controllers/EmergencyAccessController.cs similarity index 97% rename from src/Api/Controllers/EmergencyAccessController.cs rename to src/Api/Auth/Controllers/EmergencyAccessController.cs index 466f80cafd..5b9460c5ed 100644 --- a/src/Api/Controllers/EmergencyAccessController.cs +++ b/src/Api/Auth/Controllers/EmergencyAccessController.cs @@ -1,7 +1,9 @@ -using Bit.Api.Models.Request; +using Bit.Api.Auth.Models.Request; +using Bit.Api.Auth.Models.Response; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; using Bit.Api.Vault.Models.Response; +using Bit.Core.Auth.Services; using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Repositories; @@ -10,7 +12,7 @@ using Bit.Core.Settings; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Auth.Controllers; [Route("emergency-access")] [Authorize("Application")] diff --git a/src/Api/Controllers/TwoFactorController.cs b/src/Api/Auth/Controllers/TwoFactorController.cs similarity index 98% rename from src/Api/Controllers/TwoFactorController.cs rename to src/Api/Auth/Controllers/TwoFactorController.cs index 244d3c7387..c927138daf 100644 --- a/src/Api/Controllers/TwoFactorController.cs +++ b/src/Api/Auth/Controllers/TwoFactorController.cs @@ -1,12 +1,14 @@ -using Bit.Api.Models.Request; -using Bit.Api.Models.Request.Accounts; +using Bit.Api.Auth.Models.Request; +using Bit.Api.Auth.Models.Request.Accounts; +using Bit.Api.Auth.Models.Response.TwoFactor; +using Bit.Api.Models.Request; using Bit.Api.Models.Response; -using Bit.Api.Models.Response.TwoFactor; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.LoginFeatures.PasswordlessLogin.Interfaces; +using Bit.Core.Auth.Utilities; using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.LoginFeatures.PasswordlessLogin.Interfaces; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; @@ -16,7 +18,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Auth.Controllers; [Route("two-factor")] [Authorize("Web")] diff --git a/src/Api/Jobs/EmergencyAccessNotificationJob.cs b/src/Api/Auth/Jobs/EmergencyAccessNotificationJob.cs similarity index 89% rename from src/Api/Jobs/EmergencyAccessNotificationJob.cs rename to src/Api/Auth/Jobs/EmergencyAccessNotificationJob.cs index 6520de3522..4ab1f24287 100644 --- a/src/Api/Jobs/EmergencyAccessNotificationJob.cs +++ b/src/Api/Auth/Jobs/EmergencyAccessNotificationJob.cs @@ -1,8 +1,8 @@ -using Bit.Core.Jobs; -using Bit.Core.Services; +using Bit.Core.Auth.Services; +using Bit.Core.Jobs; using Quartz; -namespace Bit.Api.Jobs; +namespace Bit.Api.Auth.Jobs; public class EmergencyAccessNotificationJob : BaseJob { diff --git a/src/Api/Jobs/EmergencyAccessTimeoutJob.cs b/src/Api/Auth/Jobs/EmergencyAccessTimeoutJob.cs similarity index 89% rename from src/Api/Jobs/EmergencyAccessTimeoutJob.cs rename to src/Api/Auth/Jobs/EmergencyAccessTimeoutJob.cs index 642f4173c3..b125e4f057 100644 --- a/src/Api/Jobs/EmergencyAccessTimeoutJob.cs +++ b/src/Api/Auth/Jobs/EmergencyAccessTimeoutJob.cs @@ -1,8 +1,8 @@ -using Bit.Core.Jobs; -using Bit.Core.Services; +using Bit.Core.Auth.Services; +using Bit.Core.Jobs; using Quartz; -namespace Bit.Api.Jobs; +namespace Bit.Api.Auth.Jobs; public class EmergencyAccessTimeoutJob : BaseJob { diff --git a/src/Api/Models/Public/AssociationWithPermissionsBaseModel.cs b/src/Api/Auth/Models/Public/AssociationWithPermissionsBaseModel.cs similarity index 93% rename from src/Api/Models/Public/AssociationWithPermissionsBaseModel.cs rename to src/Api/Auth/Models/Public/AssociationWithPermissionsBaseModel.cs index 014f67a04b..18f12fb6f9 100644 --- a/src/Api/Models/Public/AssociationWithPermissionsBaseModel.cs +++ b/src/Api/Auth/Models/Public/AssociationWithPermissionsBaseModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Public; +namespace Bit.Api.Auth.Models.Public; public abstract class AssociationWithPermissionsBaseModel { diff --git a/src/Api/Models/Public/Request/AssociationWithPermissionsRequestModel.cs b/src/Api/Auth/Models/Public/Request/AssociationWithPermissionsRequestModel.cs similarity index 87% rename from src/Api/Models/Public/Request/AssociationWithPermissionsRequestModel.cs rename to src/Api/Auth/Models/Public/Request/AssociationWithPermissionsRequestModel.cs index f518eb9e53..cac9894b29 100644 --- a/src/Api/Models/Public/Request/AssociationWithPermissionsRequestModel.cs +++ b/src/Api/Auth/Models/Public/Request/AssociationWithPermissionsRequestModel.cs @@ -1,6 +1,6 @@ using Bit.Core.Models.Data; -namespace Bit.Api.Models.Public.Request; +namespace Bit.Api.Auth.Models.Public.Request; public class AssociationWithPermissionsRequestModel : AssociationWithPermissionsBaseModel { diff --git a/src/Api/Models/Public/Response/AssociationWithPermissionsResponseModel.cs b/src/Api/Auth/Models/Public/Response/AssociationWithPermissionsResponseModel.cs similarity index 89% rename from src/Api/Models/Public/Response/AssociationWithPermissionsResponseModel.cs rename to src/Api/Auth/Models/Public/Response/AssociationWithPermissionsResponseModel.cs index 608a668cfd..757eb7ab18 100644 --- a/src/Api/Models/Public/Response/AssociationWithPermissionsResponseModel.cs +++ b/src/Api/Auth/Models/Public/Response/AssociationWithPermissionsResponseModel.cs @@ -1,6 +1,6 @@ using Bit.Core.Models.Data; -namespace Bit.Api.Models.Public.Response; +namespace Bit.Api.Auth.Models.Public.Response; public class AssociationWithPermissionsResponseModel : AssociationWithPermissionsBaseModel { diff --git a/src/Api/Models/Request/Accounts/DeleteRecoverRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/DeleteRecoverRequestModel.cs similarity index 79% rename from src/Api/Models/Request/Accounts/DeleteRecoverRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/DeleteRecoverRequestModel.cs index 541df9a810..f4326ee6b6 100644 --- a/src/Api/Models/Request/Accounts/DeleteRecoverRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/DeleteRecoverRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class DeleteRecoverRequestModel { diff --git a/src/Api/Models/Request/Accounts/EmailRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/EmailRequestModel.cs similarity index 90% rename from src/Api/Models/Request/Accounts/EmailRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/EmailRequestModel.cs index 54e8bfbcc0..8d45ec41b3 100644 --- a/src/Api/Models/Request/Accounts/EmailRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/EmailRequestModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class EmailRequestModel : SecretVerificationRequestModel { diff --git a/src/Api/Models/Request/Accounts/EmailTokenRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/EmailTokenRequestModel.cs similarity index 84% rename from src/Api/Models/Request/Accounts/EmailTokenRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/EmailTokenRequestModel.cs index c4c4f7814a..bd75b65a5e 100644 --- a/src/Api/Models/Request/Accounts/EmailTokenRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/EmailTokenRequestModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class EmailTokenRequestModel : SecretVerificationRequestModel { diff --git a/src/Api/Models/Request/Accounts/KdfRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/KdfRequestModel.cs similarity index 93% rename from src/Api/Models/Request/Accounts/KdfRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/KdfRequestModel.cs index 888bfa52aa..fc62f22bab 100644 --- a/src/Api/Models/Request/Accounts/KdfRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/KdfRequestModel.cs @@ -2,7 +2,7 @@ using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class KdfRequestModel : PasswordRequestModel, IValidatableObject { diff --git a/src/Api/Models/Request/Accounts/PasswordHintRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/PasswordHintRequestModel.cs similarity index 79% rename from src/Api/Models/Request/Accounts/PasswordHintRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/PasswordHintRequestModel.cs index 340a89be26..a52b7b5163 100644 --- a/src/Api/Models/Request/Accounts/PasswordHintRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/PasswordHintRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class PasswordHintRequestModel { diff --git a/src/Api/Models/Request/Accounts/PasswordRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/PasswordRequestModel.cs similarity index 87% rename from src/Api/Models/Request/Accounts/PasswordRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/PasswordRequestModel.cs index d7c22da4b5..ce197c4aad 100644 --- a/src/Api/Models/Request/Accounts/PasswordRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/PasswordRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class PasswordRequestModel : SecretVerificationRequestModel { diff --git a/src/Api/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs similarity index 83% rename from src/Api/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs index 329b3a0c34..dbbcdf7331 100644 --- a/src/Api/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/RegenerateTwoFactorRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class RegenerateTwoFactorRequestModel { diff --git a/src/Api/Models/Request/Accounts/SecretVerificationRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/SecretVerificationRequestModel.cs similarity index 93% rename from src/Api/Models/Request/Accounts/SecretVerificationRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/SecretVerificationRequestModel.cs index 886ad16cd3..ee69301281 100644 --- a/src/Api/Models/Request/Accounts/SecretVerificationRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/SecretVerificationRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class SecretVerificationRequestModel : IValidatableObject { diff --git a/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs similarity index 91% rename from src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs index 054c14eb3e..68cc15d422 100644 --- a/src/Api/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/SetKeyConnectorKeyRequestModel.cs @@ -1,10 +1,10 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class SetKeyConnectorKeyRequestModel : IValidatableObject { diff --git a/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/SetPasswordRequestModel.cs similarity index 93% rename from src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/SetPasswordRequestModel.cs index f854ae06c2..9c078d7b28 100644 --- a/src/Api/Models/Request/Accounts/SetPasswordRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/SetPasswordRequestModel.cs @@ -1,10 +1,10 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class SetPasswordRequestModel : IValidatableObject { diff --git a/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/UpdateKeyRequestModel.cs similarity index 87% rename from src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/UpdateKeyRequestModel.cs index 7ebc195551..102b018fc8 100644 --- a/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/UpdateKeyRequestModel.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; +using Bit.Api.Models.Request; using Bit.Api.Vault.Models.Request; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class UpdateKeyRequestModel { diff --git a/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/UpdateProfileRequestModel.cs similarity index 92% rename from src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/UpdateProfileRequestModel.cs index fd625fe9de..a4d266eaa8 100644 --- a/src/Api/Models/Request/Accounts/UpdateProfileRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/UpdateProfileRequestModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Entities; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class UpdateProfileRequestModel { diff --git a/src/Api/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs similarity index 84% rename from src/Api/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs index 94bfabeeed..d2b8dce727 100644 --- a/src/Api/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/UpdateTempPasswordRequestModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Api.Models.Request.Organizations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class UpdateTempPasswordRequestModel : OrganizationUserResetPasswordRequestModel { diff --git a/src/Api/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs similarity index 81% rename from src/Api/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs index 1faaade2b2..495cd0bdb5 100644 --- a/src/Api/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/VerifyDeleteRecoverRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class VerifyDeleteRecoverRequestModel { diff --git a/src/Api/Models/Request/Accounts/VerifyEmailRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/VerifyEmailRequestModel.cs similarity index 80% rename from src/Api/Models/Request/Accounts/VerifyEmailRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/VerifyEmailRequestModel.cs index 2e8820e1d0..730e3ee3be 100644 --- a/src/Api/Models/Request/Accounts/VerifyEmailRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/VerifyEmailRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class VerifyEmailRequestModel { diff --git a/src/Api/Models/Request/Accounts/VerifyOTPRequestModel.cs b/src/Api/Auth/Models/Request/Accounts/VerifyOTPRequestModel.cs similarity index 74% rename from src/Api/Models/Request/Accounts/VerifyOTPRequestModel.cs rename to src/Api/Auth/Models/Request/Accounts/VerifyOTPRequestModel.cs index 63e37cdf16..1db68acc99 100644 --- a/src/Api/Models/Request/Accounts/VerifyOTPRequestModel.cs +++ b/src/Api/Auth/Models/Request/Accounts/VerifyOTPRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request.Accounts; +namespace Bit.Api.Auth.Models.Request.Accounts; public class VerifyOTPRequestModel { diff --git a/src/Api/Models/Request/AuthRequestRequestModel.cs b/src/Api/Auth/Models/Request/AuthRequestRequestModel.cs similarity index 91% rename from src/Api/Models/Request/AuthRequestRequestModel.cs rename to src/Api/Auth/Models/Request/AuthRequestRequestModel.cs index d3f85a2570..3403fd276e 100644 --- a/src/Api/Models/Request/AuthRequestRequestModel.cs +++ b/src/Api/Auth/Models/Request/AuthRequestRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Newtonsoft.Json; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Auth.Models.Request; public class AuthRequestCreateRequestModel { diff --git a/src/Api/Models/Request/EmergencyAccessRequstModels.cs b/src/Api/Auth/Models/Request/EmergencyAccessRequstModels.cs similarity index 93% rename from src/Api/Models/Request/EmergencyAccessRequstModels.cs rename to src/Api/Auth/Models/Request/EmergencyAccessRequstModels.cs index 040316c50b..b6862151a5 100644 --- a/src/Api/Models/Request/EmergencyAccessRequstModels.cs +++ b/src/Api/Auth/Models/Request/EmergencyAccessRequstModels.cs @@ -1,9 +1,9 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; using Bit.Core.Utilities; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Auth.Models.Request; public class EmergencyAccessInviteRequestModel { diff --git a/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs b/src/Api/Auth/Models/Request/OrganizationSsoRequestModel.cs similarity index 98% rename from src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs rename to src/Api/Auth/Models/Request/OrganizationSsoRequestModel.cs index 6dd23aa7c6..c5b57eb381 100644 --- a/src/Api/Models/Request/Organizations/OrganizationSsoRequestModel.cs +++ b/src/Api/Auth/Models/Request/OrganizationSsoRequestModel.cs @@ -2,15 +2,15 @@ using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text.RegularExpressions; -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Data; using Bit.Core.Services; using Bit.Core.Sso; using Bit.Core.Utilities; using Microsoft.AspNetCore.Authentication.OpenIdConnect; -namespace Bit.Api.Models.Request.Organizations; +namespace Bit.Api.Auth.Models.Request.Organizations; public class OrganizationSsoRequestModel { diff --git a/src/Api/Models/Request/TwoFactorRequestModels.cs b/src/Api/Auth/Models/Request/TwoFactorRequestModels.cs similarity index 98% rename from src/Api/Models/Request/TwoFactorRequestModels.cs rename to src/Api/Auth/Models/Request/TwoFactorRequestModels.cs index a2b236edfa..9759fb70b4 100644 --- a/src/Api/Models/Request/TwoFactorRequestModels.cs +++ b/src/Api/Auth/Models/Request/TwoFactorRequestModels.cs @@ -1,12 +1,12 @@ using System.ComponentModel.DataAnnotations; -using Bit.Api.Models.Request.Accounts; +using Bit.Api.Auth.Models.Request.Accounts; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Utilities; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; -using Bit.Core.Utilities; using Fido2NetLib; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Auth.Models.Request; public class UpdateTwoFactorAuthenticatorRequestModel : SecretVerificationRequestModel { diff --git a/src/Api/Models/Response/AuthRequestResponseModel.cs b/src/Api/Auth/Models/Response/AuthRequestResponseModel.cs similarity index 95% rename from src/Api/Models/Response/AuthRequestResponseModel.cs rename to src/Api/Auth/Models/Response/AuthRequestResponseModel.cs index 1fa118f91b..b186938167 100644 --- a/src/Api/Models/Response/AuthRequestResponseModel.cs +++ b/src/Api/Auth/Models/Response/AuthRequestResponseModel.cs @@ -1,9 +1,9 @@ using System.ComponentModel.DataAnnotations; using System.Reflection; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Auth.Models.Response; public class AuthRequestResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/EmergencyAccessResponseModel.cs b/src/Api/Auth/Models/Response/EmergencyAccessResponseModel.cs similarity index 97% rename from src/Api/Models/Response/EmergencyAccessResponseModel.cs rename to src/Api/Auth/Models/Response/EmergencyAccessResponseModel.cs index 6edb025025..39a8c36b1f 100644 --- a/src/Api/Models/Response/EmergencyAccessResponseModel.cs +++ b/src/Api/Auth/Models/Response/EmergencyAccessResponseModel.cs @@ -1,12 +1,14 @@ using Bit.Api.Vault.Models.Response; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Data; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Data; using Bit.Core.Settings; using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Auth.Models.Response; public class EmergencyAccessResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/Organizations/OrganizationSsoResponseModel.cs b/src/Api/Auth/Models/Response/OrganizationSsoResponseModel.cs similarity index 91% rename from src/Api/Models/Response/Organizations/OrganizationSsoResponseModel.cs rename to src/Api/Auth/Models/Response/OrganizationSsoResponseModel.cs index 897eaa54cc..b2643a2f5f 100644 --- a/src/Api/Models/Response/Organizations/OrganizationSsoResponseModel.cs +++ b/src/Api/Auth/Models/Response/OrganizationSsoResponseModel.cs @@ -1,9 +1,10 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Data; using Bit.Core.Settings; -namespace Bit.Api.Models.Response.Organizations; +namespace Bit.Api.Auth.Models.Response.Organizations; public class OrganizationSsoResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs similarity index 88% rename from src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs index 0a283b7e60..a3fa1a8d20 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorAuthenticatorResponseModel.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Models.Api; using OtpNet; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorAuthenticatorResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs similarity index 92% rename from src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs index 3331a8d766..775c367a28 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorDuoResponseModel.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorDuoResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs similarity index 86% rename from src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs index f2be91f9d9..ee1797f83e 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorEmailResponseModel.cs @@ -1,8 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorEmailResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs similarity index 90% rename from src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs index 0e8522104a..66e41e80e1 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorProviderResponseModel.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorProviderResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs similarity index 89% rename from src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs index 26324de7cf..0022633973 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorRecoverResponseModel.cs @@ -1,7 +1,7 @@ using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorRecoverResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs similarity index 89% rename from src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs index 3e2ab2bc64..2e1d1aa050 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorWebAuthnResponseModel.cs @@ -1,9 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorWebAuthnResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs similarity index 94% rename from src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs rename to src/Api/Auth/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs index 48c7670c32..014863497d 100644 --- a/src/Api/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs +++ b/src/Api/Auth/Models/Response/TwoFactor/TwoFactorYubiKeyResponseModel.cs @@ -1,8 +1,8 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response.TwoFactor; +namespace Bit.Api.Auth.Models.Response.TwoFactor; public class TwoFactorYubiKeyResponseModel : ResponseModel { diff --git a/src/Api/Controllers/AccountsController.cs b/src/Api/Controllers/AccountsController.cs index 793413e6ac..2210d79ef4 100644 --- a/src/Api/Controllers/AccountsController.cs +++ b/src/Api/Controllers/AccountsController.cs @@ -1,14 +1,17 @@ -using Bit.Api.Models.Request; +using Bit.Api.Auth.Models.Request.Accounts; +using Bit.Api.Models.Request; using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Response; using Bit.Api.Utilities; using Bit.Core; +using Bit.Core.Auth.Models.Api.Request.Accounts; +using Bit.Core.Auth.Models.Api.Response.Accounts; +using Bit.Core.Auth.Services; +using Bit.Core.Auth.Utilities; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Exceptions; -using Bit.Core.Models.Api.Request.Accounts; -using Bit.Core.Models.Api.Response.Accounts; using Bit.Core.Models.Business; using Bit.Core.Models.Data; using Bit.Core.Repositories; diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index ea7330b756..7a59ceef1c 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -1,10 +1,15 @@ using System.Text.Json; +using Bit.Api.Auth.Models.Request.Accounts; +using Bit.Api.Auth.Models.Request.Organizations; +using Bit.Api.Auth.Models.Response.Organizations; using Bit.Api.Models.Request; using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; using Bit.Api.Models.Response.Organizations; using Bit.Api.SecretsManager; +using Bit.Core.Auth.Repositories; +using Bit.Core.Auth.Services; using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; diff --git a/src/Api/Jobs/JobsHostedService.cs b/src/Api/Jobs/JobsHostedService.cs index eb35556ab2..29cd4842da 100644 --- a/src/Api/Jobs/JobsHostedService.cs +++ b/src/Api/Jobs/JobsHostedService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Jobs; +using Bit.Api.Auth.Jobs; +using Bit.Core.Jobs; using Bit.Core.Settings; using Quartz; diff --git a/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs b/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs index f38d1fec7d..8e62c61568 100644 --- a/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/CollectionUpdateRequestModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Api.Auth.Models.Public.Request; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request; diff --git a/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs b/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs index 9b8193b07e..aa100b6a7f 100644 --- a/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/GroupCreateUpdateRequestModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Api.Auth.Models.Public.Request; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request; diff --git a/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs b/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs index 6ec89e0456..733e1285e6 100644 --- a/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs +++ b/src/Api/Models/Public/Request/MemberUpdateRequestModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Api.Auth.Models.Public.Request; +using Bit.Core.Entities; namespace Bit.Api.Models.Public.Request; diff --git a/src/Api/Models/Public/Response/CollectionResponseModel.cs b/src/Api/Models/Public/Response/CollectionResponseModel.cs index 91b1b7dbfc..4ea747eac0 100644 --- a/src/Api/Models/Public/Response/CollectionResponseModel.cs +++ b/src/Api/Models/Public/Response/CollectionResponseModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Bit.Api.Auth.Models.Public.Response; using Bit.Core.Entities; using Bit.Core.Models.Data; diff --git a/src/Api/Models/Public/Response/GroupResponseModel.cs b/src/Api/Models/Public/Response/GroupResponseModel.cs index 13b4993395..82c053c665 100644 --- a/src/Api/Models/Public/Response/GroupResponseModel.cs +++ b/src/Api/Models/Public/Response/GroupResponseModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Bit.Api.Auth.Models.Public.Response; using Bit.Core.Entities; using Bit.Core.Models.Data; diff --git a/src/Api/Models/Public/Response/MemberResponseModel.cs b/src/Api/Models/Public/Response/MemberResponseModel.cs index b37605323b..b2e094cfa6 100644 --- a/src/Api/Models/Public/Response/MemberResponseModel.cs +++ b/src/Api/Models/Public/Response/MemberResponseModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Bit.Api.Auth.Models.Public.Response; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; diff --git a/src/Api/Models/Request/Accounts/OrganizationApiKeyRequestModel.cs b/src/Api/Models/Request/Accounts/OrganizationApiKeyRequestModel.cs index c7e8408187..5e4dff2ef6 100644 --- a/src/Api/Models/Request/Accounts/OrganizationApiKeyRequestModel.cs +++ b/src/Api/Models/Request/Accounts/OrganizationApiKeyRequestModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Enums; +using Bit.Api.Auth.Models.Request.Accounts; +using Bit.Core.Enums; namespace Bit.Api.Models.Request.Accounts; diff --git a/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs b/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs index a702ee7c94..cef7721b1f 100644 --- a/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs +++ b/src/Api/Models/Request/Organizations/OrganizationUserRequestModels.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json; -using Bit.Api.Models.Request.Accounts; +using Bit.Api.Auth.Models.Request.Accounts; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; diff --git a/src/Api/Models/Response/ProfileOrganizationResponseModel.cs b/src/Api/Models/Response/ProfileOrganizationResponseModel.cs index 871e48d0a1..20737bb67b 100644 --- a/src/Api/Models/Response/ProfileOrganizationResponseModel.cs +++ b/src/Api/Models/Response/ProfileOrganizationResponseModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Core.Models.Api; using Bit.Core.Models.Data; diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 648f312418..c114a96819 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -1,7 +1,6 @@ using Bit.Api.Utilities; using Bit.Core; using Bit.Core.Context; -using Bit.Core.Identity; using Bit.Core.Settings; using AspNetCoreRateLimit; using Stripe; @@ -13,6 +12,7 @@ using Microsoft.IdentityModel.Logging; using Microsoft.OpenApi.Models; using Bit.SharedWeb.Utilities; using Microsoft.Extensions.DependencyInjection.Extensions; +using Bit.Core.Auth.Identity; #if !OSS using Bit.Commercial.Core.SecretsManager; diff --git a/src/Api/Vault/Controllers/CiphersController.cs b/src/Api/Vault/Controllers/CiphersController.cs index aa8aaf587c..6dd20dc6d9 100644 --- a/src/Api/Vault/Controllers/CiphersController.cs +++ b/src/Api/Vault/Controllers/CiphersController.cs @@ -1,5 +1,6 @@ using System.Text.Json; using Azure.Messaging.EventGrid; +using Bit.Api.Auth.Models.Request.Accounts; using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; diff --git a/src/Core/Entities/AuthRequest.cs b/src/Core/Auth/Entities/AuthRequest.cs similarity index 89% rename from src/Core/Entities/AuthRequest.cs rename to src/Core/Auth/Entities/AuthRequest.cs index 42da4e6dff..4e18586a33 100644 --- a/src/Core/Entities/AuthRequest.cs +++ b/src/Core/Auth/Entities/AuthRequest.cs @@ -1,7 +1,9 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; +using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.Auth.Entities; public class AuthRequest : ITableObject { @@ -10,7 +12,7 @@ public class AuthRequest : ITableObject public Enums.AuthRequestType Type { get; set; } [MaxLength(50)] public string RequestDeviceIdentifier { get; set; } - public Enums.DeviceType RequestDeviceType { get; set; } + public DeviceType RequestDeviceType { get; set; } [MaxLength(50)] public string RequestIpAddress { get; set; } public Guid? ResponseDeviceId { get; set; } diff --git a/src/Core/Entities/EmergencyAccess.cs b/src/Core/Auth/Entities/EmergencyAccess.cs similarity index 94% rename from src/Core/Entities/EmergencyAccess.cs rename to src/Core/Auth/Entities/EmergencyAccess.cs index e78f90e662..f295f25604 100644 --- a/src/Core/Entities/EmergencyAccess.cs +++ b/src/Core/Auth/Entities/EmergencyAccess.cs @@ -1,8 +1,9 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.Auth.Entities; public class EmergencyAccess : ITableObject { diff --git a/src/Core/Entities/Grant.cs b/src/Core/Auth/Entities/Grant.cs similarity index 94% rename from src/Core/Entities/Grant.cs rename to src/Core/Auth/Entities/Grant.cs index f66ff11345..96b2e9e656 100644 --- a/src/Core/Entities/Grant.cs +++ b/src/Core/Auth/Entities/Grant.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Entities; +namespace Bit.Core.Auth.Entities; public class Grant { diff --git a/src/Core/Entities/SsoConfig.cs b/src/Core/Auth/Entities/SsoConfig.cs similarity index 87% rename from src/Core/Entities/SsoConfig.cs rename to src/Core/Auth/Entities/SsoConfig.cs index 09f3697b7e..c872928031 100644 --- a/src/Core/Entities/SsoConfig.cs +++ b/src/Core/Auth/Entities/SsoConfig.cs @@ -1,6 +1,7 @@ -using Bit.Core.Models.Data; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Entities; -namespace Bit.Core.Entities; +namespace Bit.Core.Auth.Entities; public class SsoConfig : ITableObject { diff --git a/src/Core/Entities/SsoUser.cs b/src/Core/Auth/Entities/SsoUser.cs similarity index 88% rename from src/Core/Entities/SsoUser.cs rename to src/Core/Auth/Entities/SsoUser.cs index 6bc32c20d5..3199f00221 100644 --- a/src/Core/Entities/SsoUser.cs +++ b/src/Core/Auth/Entities/SsoUser.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; +using Bit.Core.Entities; -namespace Bit.Core.Entities; +namespace Bit.Core.Auth.Entities; public class SsoUser : ITableObject { diff --git a/src/Core/Enums/AuthRequestType.cs b/src/Core/Auth/Enums/AuthRequestType.cs similarity index 71% rename from src/Core/Enums/AuthRequestType.cs rename to src/Core/Auth/Enums/AuthRequestType.cs index e8e88465c3..8e6cb525e4 100644 --- a/src/Core/Enums/AuthRequestType.cs +++ b/src/Core/Auth/Enums/AuthRequestType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum AuthRequestType : byte { diff --git a/src/Core/Enums/EmergencyAccessStatusType.cs b/src/Core/Auth/Enums/EmergencyAccessStatusType.cs similarity index 82% rename from src/Core/Enums/EmergencyAccessStatusType.cs rename to src/Core/Auth/Enums/EmergencyAccessStatusType.cs index 79fca334e6..7faaa11752 100644 --- a/src/Core/Enums/EmergencyAccessStatusType.cs +++ b/src/Core/Auth/Enums/EmergencyAccessStatusType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum EmergencyAccessStatusType : byte { diff --git a/src/Core/Enums/EmergencyAccessType.cs b/src/Core/Auth/Enums/EmergencyAccessType.cs similarity index 69% rename from src/Core/Enums/EmergencyAccessType.cs rename to src/Core/Auth/Enums/EmergencyAccessType.cs index 5742bb5314..a3497cc287 100644 --- a/src/Core/Enums/EmergencyAccessType.cs +++ b/src/Core/Auth/Enums/EmergencyAccessType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum EmergencyAccessType : byte { diff --git a/src/Core/Enums/Saml2BindingType.cs b/src/Core/Auth/Enums/Saml2BindingType.cs similarity index 70% rename from src/Core/Enums/Saml2BindingType.cs rename to src/Core/Auth/Enums/Saml2BindingType.cs index c02a5d7ccb..aae665fed1 100644 --- a/src/Core/Enums/Saml2BindingType.cs +++ b/src/Core/Auth/Enums/Saml2BindingType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum Saml2BindingType : byte { diff --git a/src/Core/Enums/Saml2NameIdFormat.cs b/src/Core/Auth/Enums/Saml2NameIdFormat.cs similarity index 88% rename from src/Core/Enums/Saml2NameIdFormat.cs rename to src/Core/Auth/Enums/Saml2NameIdFormat.cs index f90426e5c2..2c500fbf6e 100644 --- a/src/Core/Enums/Saml2NameIdFormat.cs +++ b/src/Core/Auth/Enums/Saml2NameIdFormat.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum Saml2NameIdFormat : byte { diff --git a/src/Core/Enums/Saml2SigningBehavior.cs b/src/Core/Auth/Enums/Saml2SigningBehavior.cs similarity index 76% rename from src/Core/Enums/Saml2SigningBehavior.cs rename to src/Core/Auth/Enums/Saml2SigningBehavior.cs index 25344dbc86..2b9e1565b9 100644 --- a/src/Core/Enums/Saml2SigningBehavior.cs +++ b/src/Core/Auth/Enums/Saml2SigningBehavior.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum Saml2SigningBehavior : byte { diff --git a/src/Core/Enums/SsoType.cs b/src/Core/Auth/Enums/SsoType.cs similarity index 67% rename from src/Core/Enums/SsoType.cs rename to src/Core/Auth/Enums/SsoType.cs index 3e890817f7..e9d056c778 100644 --- a/src/Core/Enums/SsoType.cs +++ b/src/Core/Auth/Enums/SsoType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum SsoType : byte { diff --git a/src/Core/Enums/TwoFactorProviderType.cs b/src/Core/Auth/Enums/TwoFactorProviderType.cs similarity index 85% rename from src/Core/Enums/TwoFactorProviderType.cs rename to src/Core/Auth/Enums/TwoFactorProviderType.cs index 31d6269910..a17b61c3cd 100644 --- a/src/Core/Enums/TwoFactorProviderType.cs +++ b/src/Core/Auth/Enums/TwoFactorProviderType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Auth.Enums; public enum TwoFactorProviderType : byte { diff --git a/src/Core/Exceptions/DuplicateAuthRequestException.cs b/src/Core/Auth/Exceptions/DuplicateAuthRequestException.cs similarity index 83% rename from src/Core/Exceptions/DuplicateAuthRequestException.cs rename to src/Core/Auth/Exceptions/DuplicateAuthRequestException.cs index 962dd705e4..c3c674e023 100644 --- a/src/Core/Exceptions/DuplicateAuthRequestException.cs +++ b/src/Core/Auth/Exceptions/DuplicateAuthRequestException.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Exceptions; +namespace Bit.Core.Auth.Exceptions; public class DuplicateAuthRequestException : Exception { diff --git a/src/Core/Identity/AuthenticatorTokenProvider.cs b/src/Core/Auth/Identity/AuthenticatorTokenProvider.cs similarity index 94% rename from src/Core/Identity/AuthenticatorTokenProvider.cs rename to src/Core/Auth/Identity/AuthenticatorTokenProvider.cs index 8bda023e52..d6b3d1526f 100644 --- a/src/Core/Identity/AuthenticatorTokenProvider.cs +++ b/src/Core/Auth/Identity/AuthenticatorTokenProvider.cs @@ -1,11 +1,11 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Services; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using OtpNet; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class AuthenticatorTokenProvider : IUserTwoFactorTokenProvider { diff --git a/src/Core/Identity/DuoWebTokenProvider.cs b/src/Core/Auth/Identity/DuoWebTokenProvider.cs similarity index 94% rename from src/Core/Identity/DuoWebTokenProvider.cs rename to src/Core/Auth/Identity/DuoWebTokenProvider.cs index 396f3b4005..6ab0203262 100644 --- a/src/Core/Identity/DuoWebTokenProvider.cs +++ b/src/Core/Auth/Identity/DuoWebTokenProvider.cs @@ -1,13 +1,13 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Utilities.Duo; +using Bit.Core.Entities; using Bit.Core.Services; using Bit.Core.Settings; -using Bit.Core.Utilities.Duo; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class DuoWebTokenProvider : IUserTwoFactorTokenProvider { diff --git a/src/Core/Identity/EmailTokenProvider.cs b/src/Core/Auth/Identity/EmailTokenProvider.cs similarity index 95% rename from src/Core/Identity/EmailTokenProvider.cs rename to src/Core/Auth/Identity/EmailTokenProvider.cs index 71987fa86d..e8961c0638 100644 --- a/src/Core/Identity/EmailTokenProvider.cs +++ b/src/Core/Auth/Identity/EmailTokenProvider.cs @@ -1,11 +1,11 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Entities; using Bit.Core.Services; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class EmailTokenProvider : IUserTwoFactorTokenProvider { diff --git a/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs b/src/Core/Auth/Identity/IOrganizationTwoFactorTokenProvider.cs similarity index 90% rename from src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs rename to src/Core/Auth/Identity/IOrganizationTwoFactorTokenProvider.cs index 0046add96d..81ce2adae9 100644 --- a/src/Core/Identity/IOrganizationTwoFactorTokenProvider.cs +++ b/src/Core/Auth/Identity/IOrganizationTwoFactorTokenProvider.cs @@ -1,6 +1,6 @@ using Bit.Core.Entities; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public interface IOrganizationTwoFactorTokenProvider { diff --git a/src/Core/Identity/LowerInvariantLookupNormalizer.cs b/src/Core/Auth/Identity/LowerInvariantLookupNormalizer.cs similarity index 92% rename from src/Core/Identity/LowerInvariantLookupNormalizer.cs rename to src/Core/Auth/Identity/LowerInvariantLookupNormalizer.cs index 880a2bbfbf..1318d94760 100644 --- a/src/Core/Identity/LowerInvariantLookupNormalizer.cs +++ b/src/Core/Auth/Identity/LowerInvariantLookupNormalizer.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Identity; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class LowerInvariantLookupNormalizer : ILookupNormalizer { diff --git a/src/Core/Identity/OrganizationDuoWebTokenProvider.cs b/src/Core/Auth/Identity/OrganizationDuoWebTokenProvider.cs similarity index 94% rename from src/Core/Identity/OrganizationDuoWebTokenProvider.cs rename to src/Core/Auth/Identity/OrganizationDuoWebTokenProvider.cs index 53d979d907..2b66e550c7 100644 --- a/src/Core/Identity/OrganizationDuoWebTokenProvider.cs +++ b/src/Core/Auth/Identity/OrganizationDuoWebTokenProvider.cs @@ -1,10 +1,10 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Utilities.Duo; +using Bit.Core.Entities; using Bit.Core.Settings; -using Bit.Core.Utilities.Duo; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public interface IOrganizationDuoWebTokenProvider : IOrganizationTwoFactorTokenProvider { } diff --git a/src/Core/Identity/RoleStore.cs b/src/Core/Auth/Identity/RoleStore.cs similarity index 98% rename from src/Core/Identity/RoleStore.cs rename to src/Core/Auth/Identity/RoleStore.cs index d6fe3f42f0..3ea530dd04 100644 --- a/src/Core/Identity/RoleStore.cs +++ b/src/Core/Auth/Identity/RoleStore.cs @@ -1,7 +1,7 @@ using Bit.Core.Entities; using Microsoft.AspNetCore.Identity; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class RoleStore : IRoleStore { diff --git a/src/Core/Identity/TwoFactorRememberTokenProvider.cs b/src/Core/Auth/Identity/TwoFactorRememberTokenProvider.cs similarity index 94% rename from src/Core/Identity/TwoFactorRememberTokenProvider.cs rename to src/Core/Auth/Identity/TwoFactorRememberTokenProvider.cs index 711c8c9331..cf35eb2eb8 100644 --- a/src/Core/Identity/TwoFactorRememberTokenProvider.cs +++ b/src/Core/Auth/Identity/TwoFactorRememberTokenProvider.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class TwoFactorRememberTokenProvider : DataProtectorTokenProvider { diff --git a/src/Core/Identity/UserStore.cs b/src/Core/Auth/Identity/UserStore.cs similarity index 99% rename from src/Core/Identity/UserStore.cs rename to src/Core/Auth/Identity/UserStore.cs index afa0656c11..3716d75b6a 100644 --- a/src/Core/Identity/UserStore.cs +++ b/src/Core/Auth/Identity/UserStore.cs @@ -5,7 +5,7 @@ using Bit.Core.Services; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class UserStore : IUserStore, diff --git a/src/Core/Identity/WebAuthnTokenProvider.cs b/src/Core/Auth/Identity/WebAuthnTokenProvider.cs similarity index 98% rename from src/Core/Identity/WebAuthnTokenProvider.cs rename to src/Core/Auth/Identity/WebAuthnTokenProvider.cs index 6612ea2087..8ada74b697 100644 --- a/src/Core/Identity/WebAuthnTokenProvider.cs +++ b/src/Core/Auth/Identity/WebAuthnTokenProvider.cs @@ -1,7 +1,7 @@ using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; @@ -10,7 +10,7 @@ using Fido2NetLib.Objects; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class WebAuthnTokenProvider : IUserTwoFactorTokenProvider { diff --git a/src/Core/Identity/YubicoOtpTokenProvider.cs b/src/Core/Auth/Identity/YubicoOtpTokenProvider.cs similarity index 96% rename from src/Core/Identity/YubicoOtpTokenProvider.cs rename to src/Core/Auth/Identity/YubicoOtpTokenProvider.cs index 3d7bb9fe71..75785118b8 100644 --- a/src/Core/Identity/YubicoOtpTokenProvider.cs +++ b/src/Core/Auth/Identity/YubicoOtpTokenProvider.cs @@ -1,12 +1,12 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Services; using Bit.Core.Settings; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using YubicoDotNetClient; -namespace Bit.Core.Identity; +namespace Bit.Core.Auth.Identity; public class YubicoOtpTokenProvider : IUserTwoFactorTokenProvider { diff --git a/src/Core/IdentityServer/TokenRetrieval.cs b/src/Core/Auth/IdentityServer/TokenRetrieval.cs similarity index 95% rename from src/Core/IdentityServer/TokenRetrieval.cs rename to src/Core/Auth/IdentityServer/TokenRetrieval.cs index 8c8ecfbc45..c00ff4b279 100644 --- a/src/Core/IdentityServer/TokenRetrieval.cs +++ b/src/Core/Auth/IdentityServer/TokenRetrieval.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Http; -namespace Bit.Core.IdentityServer; +namespace Bit.Core.Auth.IdentityServer; public static class TokenRetrieval { diff --git a/src/Core/LoginFeatures/LoginServiceCollectionExtensions.cs b/src/Core/Auth/LoginFeatures/LoginServiceCollectionExtensions.cs similarity index 63% rename from src/Core/LoginFeatures/LoginServiceCollectionExtensions.cs rename to src/Core/Auth/LoginFeatures/LoginServiceCollectionExtensions.cs index 13cf4e3be5..f8caad448b 100644 --- a/src/Core/LoginFeatures/LoginServiceCollectionExtensions.cs +++ b/src/Core/Auth/LoginFeatures/LoginServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ -using Bit.Core.LoginFeatures.PasswordlessLogin; -using Bit.Core.LoginFeatures.PasswordlessLogin.Interfaces; +using Bit.Core.Auth.LoginFeatures.PasswordlessLogin; +using Bit.Core.Auth.LoginFeatures.PasswordlessLogin.Interfaces; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.LoginFeatures; +namespace Bit.Core.Auth.LoginFeatures; public static class LoginServiceCollectionExtensions { diff --git a/src/Core/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs b/src/Core/Auth/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs similarity index 63% rename from src/Core/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs rename to src/Core/Auth/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs index 36809e7c3a..e5da1b06d8 100644 --- a/src/Core/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs +++ b/src/Core/Auth/LoginFeatures/PasswordlessLogin/Interfaces/IVerifyAuthRequest.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.LoginFeatures.PasswordlessLogin.Interfaces; +namespace Bit.Core.Auth.LoginFeatures.PasswordlessLogin.Interfaces; public interface IVerifyAuthRequestCommand { diff --git a/src/Core/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs b/src/Core/Auth/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs similarity index 84% rename from src/Core/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs rename to src/Core/Auth/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs index 827a904485..7def7fea76 100644 --- a/src/Core/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs +++ b/src/Core/Auth/LoginFeatures/PasswordlessLogin/VerifyAuthRequest.cs @@ -1,8 +1,8 @@ -using Bit.Core.LoginFeatures.PasswordlessLogin.Interfaces; +using Bit.Core.Auth.LoginFeatures.PasswordlessLogin.Interfaces; using Bit.Core.Repositories; using Bit.Core.Utilities; -namespace Bit.Core.LoginFeatures.PasswordlessLogin; +namespace Bit.Core.Auth.LoginFeatures.PasswordlessLogin; public class VerifyAuthRequestCommand : IVerifyAuthRequestCommand { diff --git a/src/Core/Models/Api/Request/Accounts/KeysRequestModel.cs b/src/Core/Auth/Models/Api/Request/Accounts/KeysRequestModel.cs similarity index 92% rename from src/Core/Models/Api/Request/Accounts/KeysRequestModel.cs rename to src/Core/Auth/Models/Api/Request/Accounts/KeysRequestModel.cs index 18e6c1f5e7..93832542de 100644 --- a/src/Core/Models/Api/Request/Accounts/KeysRequestModel.cs +++ b/src/Core/Auth/Models/Api/Request/Accounts/KeysRequestModel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Bit.Core.Entities; -namespace Bit.Core.Models.Api.Request.Accounts; +namespace Bit.Core.Auth.Models.Api.Request.Accounts; public class KeysRequestModel { diff --git a/src/Core/Models/Api/Request/Accounts/PreloginRequestModel.cs b/src/Core/Auth/Models/Api/Request/Accounts/PreloginRequestModel.cs similarity index 77% rename from src/Core/Models/Api/Request/Accounts/PreloginRequestModel.cs rename to src/Core/Auth/Models/Api/Request/Accounts/PreloginRequestModel.cs index 43a391ab94..be2e68a128 100644 --- a/src/Core/Models/Api/Request/Accounts/PreloginRequestModel.cs +++ b/src/Core/Auth/Models/Api/Request/Accounts/PreloginRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Core.Models.Api.Request.Accounts; +namespace Bit.Core.Auth.Models.Api.Request.Accounts; public class PreloginRequestModel { diff --git a/src/Core/Models/Api/Request/Accounts/RegisterRequestModel.cs b/src/Core/Auth/Models/Api/Request/Accounts/RegisterRequestModel.cs similarity index 97% rename from src/Core/Models/Api/Request/Accounts/RegisterRequestModel.cs rename to src/Core/Auth/Models/Api/Request/Accounts/RegisterRequestModel.cs index a567889560..f023b488ce 100644 --- a/src/Core/Models/Api/Request/Accounts/RegisterRequestModel.cs +++ b/src/Core/Auth/Models/Api/Request/Accounts/RegisterRequestModel.cs @@ -4,7 +4,7 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Utilities; -namespace Bit.Core.Models.Api.Request.Accounts; +namespace Bit.Core.Auth.Models.Api.Request.Accounts; public class RegisterRequestModel : IValidatableObject, ICaptchaProtectedModel { diff --git a/src/Core/Models/Api/Request/ICaptchaProtectedModel.cs b/src/Core/Auth/Models/Api/Request/ICaptchaProtectedModel.cs similarity index 68% rename from src/Core/Models/Api/Request/ICaptchaProtectedModel.cs rename to src/Core/Auth/Models/Api/Request/ICaptchaProtectedModel.cs index f1c9771d15..6968a904b0 100644 --- a/src/Core/Models/Api/Request/ICaptchaProtectedModel.cs +++ b/src/Core/Auth/Models/Api/Request/ICaptchaProtectedModel.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Api; +namespace Bit.Core.Auth.Models.Api; public interface ICaptchaProtectedModel { diff --git a/src/Core/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs b/src/Core/Auth/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs similarity index 64% rename from src/Core/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs rename to src/Core/Auth/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs index 863480b27c..44c8898a0c 100644 --- a/src/Core/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs +++ b/src/Core/Auth/Models/Api/Response/Accounts/ICaptchaProtectedResponseModel.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Api.Response.Accounts; +namespace Bit.Core.Auth.Models.Api.Response.Accounts; public interface ICaptchaProtectedResponseModel { diff --git a/src/Core/Models/Api/Response/Accounts/PreloginResponseModel.cs b/src/Core/Auth/Models/Api/Response/Accounts/PreloginResponseModel.cs similarity index 90% rename from src/Core/Models/Api/Response/Accounts/PreloginResponseModel.cs rename to src/Core/Auth/Models/Api/Response/Accounts/PreloginResponseModel.cs index e544c34cc4..0052ac18a6 100644 --- a/src/Core/Models/Api/Response/Accounts/PreloginResponseModel.cs +++ b/src/Core/Auth/Models/Api/Response/Accounts/PreloginResponseModel.cs @@ -1,7 +1,7 @@ using Bit.Core.Enums; using Bit.Core.Models.Data; -namespace Bit.Core.Models.Api.Response.Accounts; +namespace Bit.Core.Auth.Models.Api.Response.Accounts; public class PreloginResponseModel { diff --git a/src/Core/Models/Api/Response/Accounts/RegisterResponseModel.cs b/src/Core/Auth/Models/Api/Response/Accounts/RegisterResponseModel.cs similarity index 77% rename from src/Core/Models/Api/Response/Accounts/RegisterResponseModel.cs rename to src/Core/Auth/Models/Api/Response/Accounts/RegisterResponseModel.cs index 857fc8a875..ef560ee41b 100644 --- a/src/Core/Models/Api/Response/Accounts/RegisterResponseModel.cs +++ b/src/Core/Auth/Models/Api/Response/Accounts/RegisterResponseModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Api.Response.Accounts; +using Bit.Core.Models.Api; + +namespace Bit.Core.Auth.Models.Api.Response.Accounts; public class RegisterResponseModel : ResponseModel, ICaptchaProtectedResponseModel { diff --git a/src/Core/Models/Business/CaptchaResponse.cs b/src/Core/Auth/Models/Business/CaptchaResponse.cs similarity index 80% rename from src/Core/Models/Business/CaptchaResponse.cs rename to src/Core/Auth/Models/Business/CaptchaResponse.cs index aaafc8e7d3..1a4b039ec0 100644 --- a/src/Core/Models/Business/CaptchaResponse.cs +++ b/src/Core/Auth/Models/Business/CaptchaResponse.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Business; +namespace Bit.Core.Auth.Models.Business; public class CaptchaResponse { diff --git a/src/Core/Models/Business/ExpiringToken.cs b/src/Core/Auth/Models/Business/ExpiringToken.cs similarity index 85% rename from src/Core/Models/Business/ExpiringToken.cs rename to src/Core/Auth/Models/Business/ExpiringToken.cs index db09a540ff..9e785165fc 100644 --- a/src/Core/Models/Business/ExpiringToken.cs +++ b/src/Core/Auth/Models/Business/ExpiringToken.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Business; +namespace Bit.Core.Auth.Models.Business; public class ExpiringToken { diff --git a/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs b/src/Core/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs similarity index 93% rename from src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs rename to src/Core/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs index 9d0e6cafa6..a29afdf1fb 100644 --- a/src/Core/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs +++ b/src/Core/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenable.cs @@ -1,7 +1,7 @@ using System.Text.Json.Serialization; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Core.Models.Business.Tokenables; +namespace Bit.Core.Auth.Models.Business.Tokenables; public class EmergencyAccessInviteTokenable : Tokens.ExpiringTokenable { diff --git a/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs b/src/Core/Auth/Models/Business/Tokenables/HCaptchaTokenable.cs similarity index 96% rename from src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs rename to src/Core/Auth/Models/Business/Tokenables/HCaptchaTokenable.cs index c62c7189a6..72994563c1 100644 --- a/src/Core/Models/Business/Tokenables/HCaptchaTokenable.cs +++ b/src/Core/Auth/Models/Business/Tokenables/HCaptchaTokenable.cs @@ -2,7 +2,7 @@ using Bit.Core.Entities; using Bit.Core.Tokens; -namespace Bit.Core.Models.Business.Tokenables; +namespace Bit.Core.Auth.Models.Business.Tokenables; public class HCaptchaTokenable : ExpiringTokenable { diff --git a/src/Core/Models/Business/Tokenables/SsoTokenable.cs b/src/Core/Auth/Models/Business/Tokenables/SsoTokenable.cs similarity index 96% rename from src/Core/Models/Business/Tokenables/SsoTokenable.cs rename to src/Core/Auth/Models/Business/Tokenables/SsoTokenable.cs index f6524d2c7f..1f7bdfbc0f 100644 --- a/src/Core/Models/Business/Tokenables/SsoTokenable.cs +++ b/src/Core/Auth/Models/Business/Tokenables/SsoTokenable.cs @@ -2,7 +2,7 @@ using Bit.Core.Entities; using Bit.Core.Tokens; -namespace Bit.Core.Models.Business.Tokenables; +namespace Bit.Core.Auth.Models.Business.Tokenables; public class SsoTokenable : ExpiringTokenable { diff --git a/src/Core/Models/Data/EmergencyAccessDetails.cs b/src/Core/Auth/Models/Data/EmergencyAccessDetails.cs similarity index 82% rename from src/Core/Models/Data/EmergencyAccessDetails.cs rename to src/Core/Auth/Models/Data/EmergencyAccessDetails.cs index e8ba6bcb28..3c925d1a80 100644 --- a/src/Core/Models/Data/EmergencyAccessDetails.cs +++ b/src/Core/Auth/Models/Data/EmergencyAccessDetails.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; + +using Bit.Core.Auth.Entities; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Auth.Models.Data; public class EmergencyAccessDetails : EmergencyAccess { diff --git a/src/Core/Models/Data/EmergencyAccessNotify.cs b/src/Core/Auth/Models/Data/EmergencyAccessNotify.cs similarity index 73% rename from src/Core/Models/Data/EmergencyAccessNotify.cs rename to src/Core/Auth/Models/Data/EmergencyAccessNotify.cs index 6eaccd272d..f3f1347338 100644 --- a/src/Core/Models/Data/EmergencyAccessNotify.cs +++ b/src/Core/Auth/Models/Data/EmergencyAccessNotify.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; + +using Bit.Core.Auth.Entities; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Auth.Models.Data; public class EmergencyAccessNotify : EmergencyAccess { diff --git a/src/Core/Models/Data/EmergencyAccessViewData.cs b/src/Core/Auth/Models/Data/EmergencyAccessViewData.cs similarity index 73% rename from src/Core/Models/Data/EmergencyAccessViewData.cs rename to src/Core/Auth/Models/Data/EmergencyAccessViewData.cs index 9e87e14533..70130e0fcf 100644 --- a/src/Core/Models/Data/EmergencyAccessViewData.cs +++ b/src/Core/Auth/Models/Data/EmergencyAccessViewData.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Auth.Models.Data; public class EmergencyAccessViewData { diff --git a/src/Core/Models/Data/SsoConfigurationData.cs b/src/Core/Auth/Models/Data/SsoConfigurationData.cs similarity index 98% rename from src/Core/Models/Data/SsoConfigurationData.cs rename to src/Core/Auth/Models/Data/SsoConfigurationData.cs index 844c52146a..ad51896324 100644 --- a/src/Core/Models/Data/SsoConfigurationData.cs +++ b/src/Core/Auth/Models/Data/SsoConfigurationData.cs @@ -1,8 +1,8 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Bit.Core.Utilities; using Microsoft.AspNetCore.Authentication.OpenIdConnect; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Auth.Models.Data; public class SsoConfigurationData { diff --git a/src/Core/Models/ITwoFactorProvidersUser.cs b/src/Core/Auth/Models/ITwoFactorProvidersUser.cs similarity index 77% rename from src/Core/Models/ITwoFactorProvidersUser.cs rename to src/Core/Auth/Models/ITwoFactorProvidersUser.cs index b056ba31ca..5d9ae4b362 100644 --- a/src/Core/Models/ITwoFactorProvidersUser.cs +++ b/src/Core/Auth/Models/ITwoFactorProvidersUser.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; -namespace Bit.Core.Models; +namespace Bit.Core.Auth.Models; public interface ITwoFactorProvidersUser { diff --git a/src/Core/Models/Mail/EmergencyAccessAcceptedViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessAcceptedViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessAcceptedViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessAcceptedViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessApprovedViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessApprovedViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessApprovedViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessApprovedViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessConfirmedViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessConfirmedViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessConfirmedViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessConfirmedViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessInvitedViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessInvitedViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessInvitedViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessInvitedViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessRecoveryTimedOutViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessRecoveryTimedOutViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessRecoveryTimedOutViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessRecoveryTimedOutViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessRecoveryViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessRecoveryViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessRecoveryViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessRecoveryViewModel.cs diff --git a/src/Core/Models/Mail/EmergencyAccessRejectedViewModel.cs b/src/Core/Auth/Models/Mail/EmergencyAccessRejectedViewModel.cs similarity index 100% rename from src/Core/Models/Mail/EmergencyAccessRejectedViewModel.cs rename to src/Core/Auth/Models/Mail/EmergencyAccessRejectedViewModel.cs diff --git a/src/Core/Models/Mail/FailedAuthAttemptsModel.cs b/src/Core/Auth/Models/Mail/FailedAuthAttemptsModel.cs similarity index 62% rename from src/Core/Models/Mail/FailedAuthAttemptsModel.cs rename to src/Core/Auth/Models/Mail/FailedAuthAttemptsModel.cs index 8ef66061d8..2d5bc7eb15 100644 --- a/src/Core/Models/Mail/FailedAuthAttemptsModel.cs +++ b/src/Core/Auth/Models/Mail/FailedAuthAttemptsModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Mail; +using Bit.Core.Models.Mail; + +namespace Bit.Core.Auth.Models.Mail; public class FailedAuthAttemptsModel : NewDeviceLoggedInModel { diff --git a/src/Core/Models/Mail/MasterPasswordHintViewModel.cs b/src/Core/Auth/Models/Mail/MasterPasswordHintViewModel.cs similarity index 58% rename from src/Core/Models/Mail/MasterPasswordHintViewModel.cs rename to src/Core/Auth/Models/Mail/MasterPasswordHintViewModel.cs index 01eb883a28..e8ee28fc11 100644 --- a/src/Core/Models/Mail/MasterPasswordHintViewModel.cs +++ b/src/Core/Auth/Models/Mail/MasterPasswordHintViewModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Mail; +using Bit.Core.Models.Mail; + +namespace Bit.Core.Auth.Models.Mail; public class MasterPasswordHintViewModel : BaseMailModel { diff --git a/src/Core/Models/Mail/PasswordlessSignInModel.cs b/src/Core/Auth/Models/Mail/PasswordlessSignInModel.cs similarity index 66% rename from src/Core/Models/Mail/PasswordlessSignInModel.cs rename to src/Core/Auth/Models/Mail/PasswordlessSignInModel.cs index 07754cf804..4b195b54a8 100644 --- a/src/Core/Models/Mail/PasswordlessSignInModel.cs +++ b/src/Core/Auth/Models/Mail/PasswordlessSignInModel.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Mail; +namespace Bit.Core.Auth.Models.Mail; public class PasswordlessSignInModel { diff --git a/src/Core/Models/Mail/RecoverTwoFactorModel.cs b/src/Core/Auth/Models/Mail/RecoverTwoFactorModel.cs similarity index 76% rename from src/Core/Models/Mail/RecoverTwoFactorModel.cs rename to src/Core/Auth/Models/Mail/RecoverTwoFactorModel.cs index b62f076711..82c2bc5303 100644 --- a/src/Core/Models/Mail/RecoverTwoFactorModel.cs +++ b/src/Core/Auth/Models/Mail/RecoverTwoFactorModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Mail; +using Bit.Core.Models.Mail; + +namespace Bit.Core.Auth.Models.Mail; public class RecoverTwoFactorModel : BaseMailModel { diff --git a/src/Core/Models/Mail/VerifyDeleteModel.cs b/src/Core/Auth/Models/Mail/VerifyDeleteModel.cs similarity index 84% rename from src/Core/Models/Mail/VerifyDeleteModel.cs rename to src/Core/Auth/Models/Mail/VerifyDeleteModel.cs index 22775aae15..d6b7b3a445 100644 --- a/src/Core/Models/Mail/VerifyDeleteModel.cs +++ b/src/Core/Auth/Models/Mail/VerifyDeleteModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Mail; +using Bit.Core.Models.Mail; + +namespace Bit.Core.Auth.Models.Mail; public class VerifyDeleteModel : BaseMailModel { diff --git a/src/Core/Models/Mail/VerifyEmailModel.cs b/src/Core/Auth/Models/Mail/VerifyEmailModel.cs similarity index 79% rename from src/Core/Models/Mail/VerifyEmailModel.cs rename to src/Core/Auth/Models/Mail/VerifyEmailModel.cs index 17b2eba864..703de7e045 100644 --- a/src/Core/Models/Mail/VerifyEmailModel.cs +++ b/src/Core/Auth/Models/Mail/VerifyEmailModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Models.Mail; +using Bit.Core.Models.Mail; + +namespace Bit.Core.Auth.Models.Mail; public class VerifyEmailModel : BaseMailModel { diff --git a/src/Core/Models/TwoFactorProvider.cs b/src/Core/Auth/Models/TwoFactorProvider.cs similarity index 97% rename from src/Core/Models/TwoFactorProvider.cs rename to src/Core/Auth/Models/TwoFactorProvider.cs index 0ff791ff8d..9cd7a98b07 100644 --- a/src/Core/Models/TwoFactorProvider.cs +++ b/src/Core/Auth/Models/TwoFactorProvider.cs @@ -1,8 +1,8 @@ using System.Text.Json; -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; using Fido2NetLib.Objects; -namespace Bit.Core.Models; +namespace Bit.Core.Auth.Models; public class TwoFactorProvider { diff --git a/src/Core/Repositories/IAuthRequestRepository.cs b/src/Core/Auth/Repositories/IAuthRequestRepository.cs similarity index 86% rename from src/Core/Repositories/IAuthRequestRepository.cs rename to src/Core/Auth/Repositories/IAuthRequestRepository.cs index b8bf0625d2..d0b29d518d 100644 --- a/src/Core/Repositories/IAuthRequestRepository.cs +++ b/src/Core/Auth/Repositories/IAuthRequestRepository.cs @@ -1,4 +1,4 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; namespace Bit.Core.Repositories; diff --git a/src/Core/Repositories/IEmergencyAccessRepository.cs b/src/Core/Auth/Repositories/IEmergencyAccessRepository.cs similarity index 90% rename from src/Core/Repositories/IEmergencyAccessRepository.cs rename to src/Core/Auth/Repositories/IEmergencyAccessRepository.cs index 790f7191c5..64e7cd872c 100644 --- a/src/Core/Repositories/IEmergencyAccessRepository.cs +++ b/src/Core/Auth/Repositories/IEmergencyAccessRepository.cs @@ -1,5 +1,5 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; namespace Bit.Core.Repositories; diff --git a/src/Core/Repositories/IGrantRepository.cs b/src/Core/Auth/Repositories/IGrantRepository.cs similarity index 83% rename from src/Core/Repositories/IGrantRepository.cs rename to src/Core/Auth/Repositories/IGrantRepository.cs index 14f4fcb03b..feb29681f5 100644 --- a/src/Core/Repositories/IGrantRepository.cs +++ b/src/Core/Auth/Repositories/IGrantRepository.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.Auth.Repositories; public interface IGrantRepository { diff --git a/src/Core/Repositories/ISsoConfigRepository.cs b/src/Core/Auth/Repositories/ISsoConfigRepository.cs similarity index 74% rename from src/Core/Repositories/ISsoConfigRepository.cs rename to src/Core/Auth/Repositories/ISsoConfigRepository.cs index 8f65618190..2ed1a15ea4 100644 --- a/src/Core/Repositories/ISsoConfigRepository.cs +++ b/src/Core/Auth/Repositories/ISsoConfigRepository.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Repositories; -namespace Bit.Core.Repositories; +namespace Bit.Core.Auth.Repositories; public interface ISsoConfigRepository : IRepository { diff --git a/src/Core/Repositories/ISsoUserRepository.cs b/src/Core/Auth/Repositories/ISsoUserRepository.cs similarity index 67% rename from src/Core/Repositories/ISsoUserRepository.cs rename to src/Core/Auth/Repositories/ISsoUserRepository.cs index 653734450a..9c97cfc94c 100644 --- a/src/Core/Repositories/ISsoUserRepository.cs +++ b/src/Core/Auth/Repositories/ISsoUserRepository.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Repositories; -namespace Bit.Core.Repositories; +namespace Bit.Core.Auth.Repositories; public interface ISsoUserRepository : IRepository { diff --git a/src/Core/Services/ICaptchaValidationService.cs b/src/Core/Auth/Services/ICaptchaValidationService.cs similarity index 80% rename from src/Core/Services/ICaptchaValidationService.cs rename to src/Core/Auth/Services/ICaptchaValidationService.cs index 50faad31f8..8547c68f7a 100644 --- a/src/Core/Services/ICaptchaValidationService.cs +++ b/src/Core/Auth/Services/ICaptchaValidationService.cs @@ -1,8 +1,8 @@ -using Bit.Core.Context; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Models.Business; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public interface ICaptchaValidationService { diff --git a/src/Core/Services/IEmergencyAccessService.cs b/src/Core/Auth/Services/IEmergencyAccessService.cs similarity index 88% rename from src/Core/Services/IEmergencyAccessService.cs rename to src/Core/Auth/Services/IEmergencyAccessService.cs index 4b6d68d7c0..d8abedb37f 100644 --- a/src/Core/Services/IEmergencyAccessService.cs +++ b/src/Core/Auth/Services/IEmergencyAccessService.cs @@ -1,9 +1,11 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Entities; +using Bit.Core.Services; using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public interface IEmergencyAccessService { diff --git a/src/Core/Services/ISsoConfigService.cs b/src/Core/Auth/Services/ISsoConfigService.cs similarity index 53% rename from src/Core/Services/ISsoConfigService.cs rename to src/Core/Auth/Services/ISsoConfigService.cs index c25127d956..1f1ec55fda 100644 --- a/src/Core/Services/ISsoConfigService.cs +++ b/src/Core/Auth/Services/ISsoConfigService.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public interface ISsoConfigService { diff --git a/src/Core/Services/Implementations/EmergencyAccessService.cs b/src/Core/Auth/Services/Implementations/EmergencyAccessService.cs similarity index 98% rename from src/Core/Services/Implementations/EmergencyAccessService.cs rename to src/Core/Auth/Services/Implementations/EmergencyAccessService.cs index feda05d038..2d40dace7a 100644 --- a/src/Core/Services/Implementations/EmergencyAccessService.cs +++ b/src/Core/Auth/Services/Implementations/EmergencyAccessService.cs @@ -1,10 +1,13 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Models.Business.Tokenables; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models; -using Bit.Core.Models.Business.Tokenables; -using Bit.Core.Models.Data; using Bit.Core.Repositories; +using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Tokens; using Bit.Core.Vault.Models.Data; @@ -12,7 +15,7 @@ using Bit.Core.Vault.Repositories; using Bit.Core.Vault.Services; using Microsoft.AspNetCore.Identity; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public class EmergencyAccessService : IEmergencyAccessService { diff --git a/src/Core/Services/Implementations/HCaptchaValidationService.cs b/src/Core/Auth/Services/Implementations/HCaptchaValidationService.cs similarity index 97% rename from src/Core/Services/Implementations/HCaptchaValidationService.cs rename to src/Core/Auth/Services/Implementations/HCaptchaValidationService.cs index b8a63c642c..0c3ad1a51d 100644 --- a/src/Core/Services/Implementations/HCaptchaValidationService.cs +++ b/src/Core/Auth/Services/Implementations/HCaptchaValidationService.cs @@ -1,14 +1,14 @@ using System.Net.Http.Json; using System.Text.Json.Serialization; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Models.Business; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.Settings; using Bit.Core.Tokens; using Microsoft.Extensions.Logging; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public class HCaptchaValidationService : ICaptchaValidationService { diff --git a/src/Core/Services/Implementations/SsoConfigService.cs b/src/Core/Auth/Services/Implementations/SsoConfigService.cs similarity index 96% rename from src/Core/Services/Implementations/SsoConfigService.cs rename to src/Core/Auth/Services/Implementations/SsoConfigService.cs index 5f44cb9310..9bb05d2415 100644 --- a/src/Core/Services/Implementations/SsoConfigService.cs +++ b/src/Core/Auth/Services/Implementations/SsoConfigService.cs @@ -1,9 +1,12 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Repositories; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Repositories; +using Bit.Core.Services; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public class SsoConfigService : ISsoConfigService { diff --git a/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs b/src/Core/Auth/Services/NoopImplementations/NoopCaptchaValidationService.cs similarity index 85% rename from src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs rename to src/Core/Auth/Services/NoopImplementations/NoopCaptchaValidationService.cs index ef5e3366da..47e1a38567 100644 --- a/src/Core/Services/NoopImplementations/NoopCaptchaValidationService.cs +++ b/src/Core/Auth/Services/NoopImplementations/NoopCaptchaValidationService.cs @@ -1,8 +1,8 @@ -using Bit.Core.Context; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Models.Business; -namespace Bit.Core.Services; +namespace Bit.Core.Auth.Services; public class NoopCaptchaValidationService : ICaptchaValidationService { diff --git a/src/Core/Settings/IPasswordlessAuthSettings.cs b/src/Core/Auth/Settings/IPasswordlessAuthSettings.cs similarity index 70% rename from src/Core/Settings/IPasswordlessAuthSettings.cs rename to src/Core/Auth/Settings/IPasswordlessAuthSettings.cs index 98bd8112d7..c1437a5c9d 100644 --- a/src/Core/Settings/IPasswordlessAuthSettings.cs +++ b/src/Core/Auth/Settings/IPasswordlessAuthSettings.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Settings; +namespace Bit.Core.Auth.Settings; public interface IPasswordlessAuthSettings { diff --git a/src/Core/Settings/ISsoSettings.cs b/src/Core/Auth/Settings/ISsoSettings.cs similarity index 100% rename from src/Core/Settings/ISsoSettings.cs rename to src/Core/Auth/Settings/ISsoSettings.cs diff --git a/src/Core/Sso/SamlSigningAlgorithms.cs b/src/Core/Auth/Sso/SamlSigningAlgorithms.cs similarity index 100% rename from src/Core/Sso/SamlSigningAlgorithms.cs rename to src/Core/Auth/Sso/SamlSigningAlgorithms.cs diff --git a/src/Core/Utilities/CaptchaProtectedAttribute.cs b/src/Core/Auth/Utilities/CaptchaProtectedAttribute.cs similarity index 91% rename from src/Core/Utilities/CaptchaProtectedAttribute.cs rename to src/Core/Auth/Utilities/CaptchaProtectedAttribute.cs index 6a5de6a9df..052f178165 100644 --- a/src/Core/Utilities/CaptchaProtectedAttribute.cs +++ b/src/Core/Auth/Utilities/CaptchaProtectedAttribute.cs @@ -1,11 +1,11 @@ -using Bit.Core.Context; +using Bit.Core.Auth.Models.Api; +using Bit.Core.Auth.Services; +using Bit.Core.Context; using Bit.Core.Exceptions; -using Bit.Core.Models.Api; -using Bit.Core.Services; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Core.Utilities; +namespace Bit.Core.Auth.Utilities; public class CaptchaProtectedAttribute : ActionFilterAttribute { diff --git a/src/Core/Utilities/DuoApi.cs b/src/Core/Auth/Utilities/DuoApi.cs similarity index 99% rename from src/Core/Utilities/DuoApi.cs rename to src/Core/Auth/Utilities/DuoApi.cs index 662ca643d7..8bf5f16a91 100644 --- a/src/Core/Utilities/DuoApi.cs +++ b/src/Core/Auth/Utilities/DuoApi.cs @@ -17,7 +17,7 @@ using System.Text.RegularExpressions; using System.Web; using Bit.Core.Models.Api.Response.Duo; -namespace Bit.Core.Utilities; +namespace Bit.Core.Auth.Utilities; public class DuoApi { diff --git a/src/Core/Utilities/DuoWeb.cs b/src/Core/Auth/Utilities/DuoWeb.cs similarity index 99% rename from src/Core/Utilities/DuoWeb.cs rename to src/Core/Auth/Utilities/DuoWeb.cs index 151f71a15f..98fa974ab2 100644 --- a/src/Core/Utilities/DuoWeb.cs +++ b/src/Core/Auth/Utilities/DuoWeb.cs @@ -36,7 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System.Security.Cryptography; using System.Text; -namespace Bit.Core.Utilities.Duo; +namespace Bit.Core.Auth.Utilities.Duo; public static class DuoWeb { diff --git a/src/Core/Entities/Organization.cs b/src/Core/Entities/Organization.cs index be07467ff5..8f1ad49ca0 100644 --- a/src/Core/Entities/Organization.cs +++ b/src/Core/Entities/Organization.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Utilities; diff --git a/src/Core/Entities/User.cs b/src/Core/Entities/User.cs index 962d94bd80..b850616a67 100644 --- a/src/Core/Entities/User.cs +++ b/src/Core/Entities/User.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Utilities; using Microsoft.AspNetCore.Identity; diff --git a/src/Core/Identity/CustomIdentityServiceCollectionExtensions.cs b/src/Core/Identity/CustomIdentityServiceCollectionExtensions.cs index a63bde8793..01914540ac 100644 --- a/src/Core/Identity/CustomIdentityServiceCollectionExtensions.cs +++ b/src/Core/Identity/CustomIdentityServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using Bit.Core.Identity; +using Bit.Core.Auth.Identity; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessAccepted.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessAccepted.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessAccepted.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessAccepted.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessAccepted.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessAccepted.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessAccepted.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessAccepted.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessApproved.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessApproved.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessApproved.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessApproved.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessApproved.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessConfirmed.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessConfirmed.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessConfirmed.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessConfirmed.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessConfirmed.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessConfirmed.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessConfirmed.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessConfirmed.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessInvited.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessInvited.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessInvited.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessInvited.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessInvited.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecovery.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecovery.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecovery.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecovery.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecovery.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryReminder.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryReminder.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryReminder.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryReminder.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryReminder.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryTimedOut.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryTimedOut.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryTimedOut.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRecoveryTimedOut.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRecoveryTimedOut.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRejected.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRejected.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRejected.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/EmergencyAccessRejected.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/EmergencyAccessRejected.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/FailedLoginAttempts.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/FailedLoginAttempts.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/FailedLoginAttempts.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/FailedLoginAttempts.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/FailedLoginAttempts.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/FailedLoginAttempts.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/FailedLoginAttempts.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/FailedLoginAttempts.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/FailedTwoFactorAttempts.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/FailedTwoFactorAttempts.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/FailedTwoFactorAttempts.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/FailedTwoFactorAttempts.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/FailedTwoFactorAttempts.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/FailedTwoFactorAttempts.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/FailedTwoFactorAttempts.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/FailedTwoFactorAttempts.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/MasterPasswordHint.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/MasterPasswordHint.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/MasterPasswordHint.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/MasterPasswordHint.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/MasterPasswordHint.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/MasterPasswordHint.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/MasterPasswordHint.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/MasterPasswordHint.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/NoMasterPasswordHint.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/NoMasterPasswordHint.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/NoMasterPasswordHint.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/NoMasterPasswordHint.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/NoMasterPasswordHint.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/NoMasterPasswordHint.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/NoMasterPasswordHint.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/NoMasterPasswordHint.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/OTPEmail.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/OTPEmail.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/OTPEmail.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/OTPEmail.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/OTPEmail.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/OTPEmail.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/OTPEmail.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/OTPEmail.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/PasswordlessSignIn.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/PasswordlessSignIn.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/PasswordlessSignIn.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/PasswordlessSignIn.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/PasswordlessSignIn.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/PasswordlessSignIn.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/RecoverTwoFactor.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/RecoverTwoFactor.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/RecoverTwoFactor.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/RecoverTwoFactor.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/RecoverTwoFactor.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/RecoverTwoFactor.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/RecoverTwoFactor.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/RecoverTwoFactor.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/TwoFactorEmail.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/TwoFactorEmail.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/TwoFactorEmail.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/TwoFactorEmail.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/TwoFactorEmail.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/TwoFactorEmail.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/TwoFactorEmail.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/TwoFactorEmail.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/VerifyDelete.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/VerifyDelete.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/VerifyDelete.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/VerifyDelete.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/VerifyDelete.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/VerifyDelete.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs b/src/Core/MailTemplates/Handlebars/Auth/VerifyEmail.html.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/VerifyEmail.html.hbs rename to src/Core/MailTemplates/Handlebars/Auth/VerifyEmail.html.hbs diff --git a/src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs b/src/Core/MailTemplates/Handlebars/Auth/VerifyEmail.text.hbs similarity index 100% rename from src/Core/MailTemplates/Handlebars/VerifyEmail.text.hbs rename to src/Core/MailTemplates/Handlebars/Auth/VerifyEmail.text.hbs diff --git a/src/Core/Models/Data/Organizations/OrganizationUsers/OrganizationUserUserDetails.cs b/src/Core/Models/Data/Organizations/OrganizationUsers/OrganizationUserUserDetails.cs index 98bad1ccb6..1dbd0972a9 100644 --- a/src/Core/Models/Data/Organizations/OrganizationUsers/OrganizationUserUserDetails.cs +++ b/src/Core/Models/Data/Organizations/OrganizationUsers/OrganizationUserUserDetails.cs @@ -1,4 +1,6 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Enums; using Bit.Core.Utilities; namespace Bit.Core.Models.Data.Organizations.OrganizationUsers; diff --git a/src/Core/Models/Data/Organizations/SelfHostedOrganizationDetails.cs b/src/Core/Models/Data/Organizations/SelfHostedOrganizationDetails.cs index a2c0811762..70727772b9 100644 --- a/src/Core/Models/Data/Organizations/SelfHostedOrganizationDetails.cs +++ b/src/Core/Models/Data/Organizations/SelfHostedOrganizationDetails.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; using Bit.Core.Models.OrganizationConnectionConfigs; diff --git a/src/Core/Services/IMailService.cs b/src/Core/Services/IMailService.cs index d873ea5729..933127367c 100644 --- a/src/Core/Services/IMailService.cs +++ b/src/Core/Services/IMailService.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Entities; using Bit.Core.Entities.Provider; -using Bit.Core.Models.Business; using Bit.Core.Models.Mail; namespace Bit.Core.Services; diff --git a/src/Core/Services/IOrganizationService.cs b/src/Core/Services/IOrganizationService.cs index 81afdde47b..b912bd9214 100644 --- a/src/Core/Services/IOrganizationService.cs +++ b/src/Core/Services/IOrganizationService.cs @@ -1,4 +1,5 @@ using System.Security.Claims; +using Bit.Core.Auth.Enums; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; diff --git a/src/Core/Services/IPushNotificationService.cs b/src/Core/Services/IPushNotificationService.cs index 46475bd79e..f85c34884f 100644 --- a/src/Core/Services/IPushNotificationService.cs +++ b/src/Core/Services/IPushNotificationService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Vault.Entities; diff --git a/src/Core/Services/IUserService.cs b/src/Core/Services/IUserService.cs index 849be5c88c..09113e7927 100644 --- a/src/Core/Services/IUserService.cs +++ b/src/Core/Services/IUserService.cs @@ -1,7 +1,8 @@ using System.Security.Claims; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Vault.Entities; using Fido2NetLib; diff --git a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs index f7b8905767..a6833b7237 100644 --- a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs +++ b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs @@ -1,5 +1,6 @@ using System.Text.Json; using Azure.Storage.Queues; +using Bit.Core.Auth.Entities; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; diff --git a/src/Core/Services/Implementations/HandlebarsMailService.cs b/src/Core/Services/Implementations/HandlebarsMailService.cs index ac8537aef4..68a3e23fa6 100644 --- a/src/Core/Services/Implementations/HandlebarsMailService.cs +++ b/src/Core/Services/Implementations/HandlebarsMailService.cs @@ -1,8 +1,10 @@ using System.Net; using System.Reflection; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Auth.Models.Mail; using Bit.Core.Entities; using Bit.Core.Entities.Provider; -using Bit.Core.Models.Business; using Bit.Core.Models.Mail; using Bit.Core.Models.Mail.FamiliesForEnterprise; using Bit.Core.Models.Mail.Provider; @@ -44,7 +46,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "VerifyEmail", model); + await AddMessageContentAsync(message, "Auth.VerifyEmail", model); message.MetaData.Add("SendGridBypassListManagement", true); message.Category = "VerifyEmail"; await _mailDeliveryService.SendEmailAsync(message); @@ -62,7 +64,7 @@ public class HandlebarsMailService : IMailService Email = email, EmailEncoded = WebUtility.UrlEncode(email) }; - await AddMessageContentAsync(message, "VerifyDelete", model); + await AddMessageContentAsync(message, "Auth.VerifyDelete", model); message.MetaData.Add("SendGridBypassListManagement", true); message.Category = "VerifyDelete"; await _mailDeliveryService.SendEmailAsync(message); @@ -107,7 +109,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "TwoFactorEmail", model); + await AddMessageContentAsync(message, "Auth.TwoFactorEmail", model); message.MetaData.Add("SendGridBypassListManagement", true); message.Category = "TwoFactorEmail"; await _mailDeliveryService.SendEmailAsync(message); @@ -122,7 +124,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "MasterPasswordHint", model); + await AddMessageContentAsync(message, "Auth.MasterPasswordHint", model); message.Category = "MasterPasswordHint"; await _mailDeliveryService.SendEmailAsync(message); } @@ -135,7 +137,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "NoMasterPasswordHint", model); + await AddMessageContentAsync(message, "Auth.NoMasterPasswordHint", model); message.Category = "NoMasterPasswordHint"; await _mailDeliveryService.SendEmailAsync(message); } @@ -277,7 +279,7 @@ public class HandlebarsMailService : IMailService { Url = url.ToString() }; - await AddMessageContentAsync(message, "PasswordlessSignIn", model); + await AddMessageContentAsync(message, "Auth.PasswordlessSignIn", model); message.Category = "PasswordlessSignIn"; await _mailDeliveryService.SendEmailAsync(message); } @@ -371,7 +373,7 @@ public class HandlebarsMailService : IMailService TimeZone = "UTC", IpAddress = ip }; - await AddMessageContentAsync(message, "RecoverTwoFactor", model); + await AddMessageContentAsync(message, "Auth.RecoverTwoFactor", model); message.Category = "RecoverTwoFactor"; await _mailDeliveryService.SendEmailAsync(message); } @@ -588,7 +590,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "EmergencyAccessInvited", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessInvited", model); message.Category = "EmergencyAccessInvited"; await _mailDeliveryService.SendEmailAsync(message); } @@ -602,7 +604,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "EmergencyAccessAccepted", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessAccepted", model); message.Category = "EmergencyAccessAccepted"; await _mailDeliveryService.SendEmailAsync(message); } @@ -616,7 +618,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; - await AddMessageContentAsync(message, "EmergencyAccessConfirmed", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessConfirmed", model); message.Category = "EmergencyAccessConfirmed"; await _mailDeliveryService.SendEmailAsync(message); } @@ -633,7 +635,7 @@ public class HandlebarsMailService : IMailService Action = emergencyAccess.Type.ToString(), DaysLeft = emergencyAccess.WaitTimeDays - Convert.ToInt32((remainingTime).TotalDays), }; - await AddMessageContentAsync(message, "EmergencyAccessRecovery", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessRecovery", model); message.Category = "EmergencyAccessRecovery"; await _mailDeliveryService.SendEmailAsync(message); } @@ -645,7 +647,7 @@ public class HandlebarsMailService : IMailService { Name = CoreHelpers.SanitizeForEmail(approvingName), }; - await AddMessageContentAsync(message, "EmergencyAccessApproved", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessApproved", model); message.Category = "EmergencyAccessApproved"; await _mailDeliveryService.SendEmailAsync(message); } @@ -657,7 +659,7 @@ public class HandlebarsMailService : IMailService { Name = CoreHelpers.SanitizeForEmail(rejectingName), }; - await AddMessageContentAsync(message, "EmergencyAccessRejected", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessRejected", model); message.Category = "EmergencyAccessRejected"; await _mailDeliveryService.SendEmailAsync(message); } @@ -674,7 +676,7 @@ public class HandlebarsMailService : IMailService Action = emergencyAccess.Type.ToString(), DaysLeft = emergencyAccess.WaitTimeDays - Convert.ToInt32((remainingTime).TotalDays), }; - await AddMessageContentAsync(message, "EmergencyAccessRecoveryReminder", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessRecoveryReminder", model); message.Category = "EmergencyAccessRecoveryReminder"; await _mailDeliveryService.SendEmailAsync(message); } @@ -687,7 +689,7 @@ public class HandlebarsMailService : IMailService Name = CoreHelpers.SanitizeForEmail(initiatingName), Action = emergencyAccess.Type.ToString(), }; - await AddMessageContentAsync(message, "EmergencyAccessRecoveryTimedOut", model); + await AddMessageContentAsync(message, "Auth.EmergencyAccessRecoveryTimedOut", model); message.Category = "EmergencyAccessRecoveryTimedOut"; await _mailDeliveryService.SendEmailAsync(message); } @@ -841,7 +843,7 @@ public class HandlebarsMailService : IMailService WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName, }; - await AddMessageContentAsync(message, "OTPEmail", model); + await AddMessageContentAsync(message, "Auth.OTPEmail", model); message.MetaData.Add("SendGridBypassListManagement", true); message.Category = "OTP"; await _mailDeliveryService.SendEmailAsync(message); @@ -859,7 +861,7 @@ public class HandlebarsMailService : IMailService AffectedEmail = email }; - await AddMessageContentAsync(message, "FailedLoginAttempts", model); + await AddMessageContentAsync(message, "Auth.FailedLoginAttempts", model); message.Category = "FailedLoginAttempts"; await _mailDeliveryService.SendEmailAsync(message); } @@ -876,7 +878,7 @@ public class HandlebarsMailService : IMailService AffectedEmail = email }; - await AddMessageContentAsync(message, "FailedTwoFactorAttempts", model); + await AddMessageContentAsync(message, "Auth.FailedTwoFactorAttempts", model); message.Category = "FailedTwoFactorAttempts"; await _mailDeliveryService.SendEmailAsync(message); } diff --git a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs index 53aa2601bc..99a0b557a4 100644 --- a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs +++ b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.Settings; diff --git a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs index ed61d11c4d..b5acd66532 100644 --- a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs @@ -1,5 +1,6 @@ using System.Text.Json; using System.Text.RegularExpressions; +using Bit.Core.Auth.Entities; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; diff --git a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs index 7c8a3eb309..3aaa15a27a 100644 --- a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Context; +using Bit.Core.Auth.Entities; +using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 3399e3a30b..621142558a 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -1,5 +1,8 @@ using System.Security.Claims; using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Auth.Repositories; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; diff --git a/src/Core/Services/Implementations/PolicyService.cs b/src/Core/Services/Implementations/PolicyService.cs index f7ba081b4b..b46d75d47c 100644 --- a/src/Core/Services/Implementations/PolicyService.cs +++ b/src/Core/Services/Implementations/PolicyService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Repositories; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Repositories; diff --git a/src/Core/Services/Implementations/RelayPushNotificationService.cs b/src/Core/Services/Implementations/RelayPushNotificationService.cs index 18a158e804..690d572829 100644 --- a/src/Core/Services/Implementations/RelayPushNotificationService.cs +++ b/src/Core/Services/Implementations/RelayPushNotificationService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Context; +using Bit.Core.Auth.Entities; +using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.IdentityServer; diff --git a/src/Core/Services/Implementations/UserService.cs b/src/Core/Services/Implementations/UserService.cs index ffc32ecaa6..add11bc0fb 100644 --- a/src/Core/Services/Implementations/UserService.cs +++ b/src/Core/Services/Implementations/UserService.cs @@ -1,10 +1,11 @@ using System.Security.Claims; using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Repositories; using Bit.Core.Settings; diff --git a/src/Core/Services/NoopImplementations/NoopMailService.cs b/src/Core/Services/NoopImplementations/NoopMailService.cs index 8f0cc2eb27..808489efbe 100644 --- a/src/Core/Services/NoopImplementations/NoopMailService.cs +++ b/src/Core/Services/NoopImplementations/NoopMailService.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Entities; using Bit.Core.Entities.Provider; -using Bit.Core.Models.Business; using Bit.Core.Models.Mail; namespace Bit.Core.Services; diff --git a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs index 4f9056835c..08aea98587 100644 --- a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs +++ b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs @@ -1,4 +1,5 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Vault.Entities; diff --git a/src/Core/Settings/GlobalSettings.cs b/src/Core/Settings/GlobalSettings.cs index 975a7f56ff..d7ef4aaa0c 100644 --- a/src/Core/Settings/GlobalSettings.cs +++ b/src/Core/Settings/GlobalSettings.cs @@ -1,4 +1,5 @@ -using Bit.Core.Settings.LoggingSettings; +using Bit.Core.Auth.Settings; +using Bit.Core.Settings.LoggingSettings; namespace Bit.Core.Settings; diff --git a/src/Core/Settings/IGlobalSettings.cs b/src/Core/Settings/IGlobalSettings.cs index 4ee2fe305e..99860c340a 100644 --- a/src/Core/Settings/IGlobalSettings.cs +++ b/src/Core/Settings/IGlobalSettings.cs @@ -1,4 +1,6 @@ -namespace Bit.Core.Settings; +using Bit.Core.Auth.Settings; + +namespace Bit.Core.Settings; public interface IGlobalSettings { diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs index b97a2f9bea..b41f36bfb9 100644 --- a/src/Core/Utilities/CoreHelpers.cs +++ b/src/Core/Utilities/CoreHelpers.cs @@ -10,6 +10,7 @@ using Azure; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using Azure.Storage.Queues.Models; +using Bit.Core.Auth.Enums; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; diff --git a/src/Identity/Controllers/AccountsController.cs b/src/Identity/Controllers/AccountsController.cs index e5c3c5eadc..4045172744 100644 --- a/src/Identity/Controllers/AccountsController.cs +++ b/src/Identity/Controllers/AccountsController.cs @@ -1,11 +1,12 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Models.Api.Request.Accounts; +using Bit.Core.Auth.Models.Api.Response.Accounts; +using Bit.Core.Auth.Services; +using Bit.Core.Auth.Utilities; +using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Api.Request.Accounts; -using Bit.Core.Models.Api.Response.Accounts; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; -using Bit.Core.Utilities; using Bit.SharedWeb.Utilities; using Microsoft.AspNetCore.Mvc; diff --git a/src/Identity/Controllers/SsoController.cs b/src/Identity/Controllers/SsoController.cs index b61d89b86c..f3a9afb17c 100644 --- a/src/Identity/Controllers/SsoController.cs +++ b/src/Identity/Controllers/SsoController.cs @@ -1,7 +1,8 @@ using System.Security.Claims; +using Bit.Core.Auth.Models.Business.Tokenables; +using Bit.Core.Auth.Repositories; using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.Repositories; using Bit.Identity.Models; using IdentityModel; diff --git a/src/Identity/IdentityServer/BaseRequestValidator.cs b/src/Identity/IdentityServer/BaseRequestValidator.cs index ccec87fdb6..0683ac3f6e 100644 --- a/src/Identity/IdentityServer/BaseRequestValidator.cs +++ b/src/Identity/IdentityServer/BaseRequestValidator.cs @@ -3,11 +3,13 @@ using System.Reflection; using System.Security.Claims; using System.Text.Json; using Bit.Core; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Identity; +using Bit.Core.Auth.Models; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Identity; -using Bit.Core.Models; using Bit.Core.Models.Api; using Bit.Core.Models.Data.Organizations; using Bit.Core.Repositories; diff --git a/src/Identity/IdentityServer/CustomTokenRequestValidator.cs b/src/Identity/IdentityServer/CustomTokenRequestValidator.cs index 05db3314c4..160edec83a 100644 --- a/src/Identity/IdentityServer/CustomTokenRequestValidator.cs +++ b/src/Identity/IdentityServer/CustomTokenRequestValidator.cs @@ -1,7 +1,8 @@ using System.Security.Claims; +using Bit.Core.Auth.Identity; +using Bit.Core.Auth.Repositories; using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Identity; using Bit.Core.IdentityServer; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/src/Identity/IdentityServer/CustomValidatorRequestContext.cs b/src/Identity/IdentityServer/CustomValidatorRequestContext.cs index faf40b7c43..a3485bfb13 100644 --- a/src/Identity/IdentityServer/CustomValidatorRequestContext.cs +++ b/src/Identity/IdentityServer/CustomValidatorRequestContext.cs @@ -1,5 +1,5 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Business; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Entities; namespace Bit.Identity.IdentityServer; diff --git a/src/Identity/IdentityServer/PersistedGrantStore.cs b/src/Identity/IdentityServer/PersistedGrantStore.cs index 9671cba446..5a3b15f627 100644 --- a/src/Identity/IdentityServer/PersistedGrantStore.cs +++ b/src/Identity/IdentityServer/PersistedGrantStore.cs @@ -1,7 +1,7 @@ -using Bit.Core.Repositories; +using Bit.Core.Auth.Repositories; using IdentityServer4.Models; using IdentityServer4.Stores; -using Grant = Bit.Core.Entities.Grant; +using Grant = Bit.Core.Auth.Entities.Grant; namespace Bit.Identity.IdentityServer; diff --git a/src/Identity/IdentityServer/ResourceOwnerPasswordValidator.cs b/src/Identity/IdentityServer/ResourceOwnerPasswordValidator.cs index 40a3de3d9b..da471627ee 100644 --- a/src/Identity/IdentityServer/ResourceOwnerPasswordValidator.cs +++ b/src/Identity/IdentityServer/ResourceOwnerPasswordValidator.cs @@ -1,7 +1,8 @@ using System.Security.Claims; +using Bit.Core.Auth.Identity; +using Bit.Core.Auth.Services; using Bit.Core.Context; using Bit.Core.Entities; -using Bit.Core.Identity; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; diff --git a/src/Identity/Startup.cs b/src/Identity/Startup.cs index 0dcec6ad4e..6a0f274ce8 100644 --- a/src/Identity/Startup.cs +++ b/src/Identity/Startup.cs @@ -2,8 +2,8 @@ using System.IdentityModel.Tokens.Jwt; using AspNetCoreRateLimit; using Bit.Core; +using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Context; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.Settings; using Bit.Core.Utilities; using Bit.Identity.Utilities; diff --git a/src/Infrastructure.Dapper/Repositories/AuthRequestRepository.cs b/src/Infrastructure.Dapper/Auth/Repositories/AuthRequestRepository.cs similarity index 91% rename from src/Infrastructure.Dapper/Repositories/AuthRequestRepository.cs rename to src/Infrastructure.Dapper/Auth/Repositories/AuthRequestRepository.cs index 69301d0665..ecfc3418eb 100644 --- a/src/Infrastructure.Dapper/Repositories/AuthRequestRepository.cs +++ b/src/Infrastructure.Dapper/Auth/Repositories/AuthRequestRepository.cs @@ -1,11 +1,12 @@ using System.Data; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.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.Auth.Repositories; public class AuthRequestRepository : Repository, IAuthRequestRepository { diff --git a/src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs b/src/Infrastructure.Dapper/Auth/Repositories/EmergencyAccessRepository.cs similarity index 95% rename from src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs rename to src/Infrastructure.Dapper/Auth/Repositories/EmergencyAccessRepository.cs index 1f0bd4fef0..00c9cf67ff 100644 --- a/src/Infrastructure.Dapper/Repositories/EmergencyAccessRepository.cs +++ b/src/Infrastructure.Dapper/Auth/Repositories/EmergencyAccessRepository.cs @@ -1,12 +1,13 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; using Bit.Core.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.Auth.Repositories; public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository { diff --git a/src/Infrastructure.Dapper/Repositories/GrantRepository.cs b/src/Infrastructure.Dapper/Auth/Repositories/GrantRepository.cs similarity index 93% rename from src/Infrastructure.Dapper/Repositories/GrantRepository.cs rename to src/Infrastructure.Dapper/Auth/Repositories/GrantRepository.cs index e938842652..46a1e3d925 100644 --- a/src/Infrastructure.Dapper/Repositories/GrantRepository.cs +++ b/src/Infrastructure.Dapper/Auth/Repositories/GrantRepository.cs @@ -1,11 +1,12 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.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.Auth.Repositories; public class GrantRepository : BaseRepository, IGrantRepository { diff --git a/src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs b/src/Infrastructure.Dapper/Auth/Repositories/SsoConfigRepository.cs similarity index 92% rename from src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs rename to src/Infrastructure.Dapper/Auth/Repositories/SsoConfigRepository.cs index 5868c23f34..0922b3a739 100644 --- a/src/Infrastructure.Dapper/Repositories/SsoConfigRepository.cs +++ b/src/Infrastructure.Dapper/Auth/Repositories/SsoConfigRepository.cs @@ -1,11 +1,12 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.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.Auth.Repositories; public class SsoConfigRepository : Repository, ISsoConfigRepository { diff --git a/src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs b/src/Infrastructure.Dapper/Auth/Repositories/SsoUserRepository.cs similarity index 89% rename from src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs rename to src/Infrastructure.Dapper/Auth/Repositories/SsoUserRepository.cs index d463ac022f..a25708f7ea 100644 --- a/src/Infrastructure.Dapper/Repositories/SsoUserRepository.cs +++ b/src/Infrastructure.Dapper/Auth/Repositories/SsoUserRepository.cs @@ -1,11 +1,12 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Repositories; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.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.Auth.Repositories; public class SsoUserRepository : Repository, ISsoUserRepository { diff --git a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs index 5a1b552e4e..bd2b817698 100644 --- a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs +++ b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs @@ -1,6 +1,8 @@ -using Bit.Core.Repositories; +using Bit.Core.Auth.Repositories; +using Bit.Core.Repositories; using Bit.Core.SecretsManager.Repositories; using Bit.Core.Vault.Repositories; +using Bit.Infrastructure.Dapper.Auth.Repositories; using Bit.Infrastructure.Dapper.Repositories; using Bit.Infrastructure.Dapper.SecretsManager.Repositories; using Bit.Infrastructure.Dapper.Vault.Repositories; diff --git a/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs b/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs index 8a3f30448a..9d8cad0f9c 100644 --- a/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/OrganizationRepository.cs @@ -1,4 +1,5 @@ using System.Data; +using Bit.Core.Auth.Entities; using Bit.Core.Entities; using Bit.Core.Models.Data.Organizations; using Bit.Core.Repositories; diff --git a/src/Infrastructure.EntityFramework/Repositories/AuthRequestRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs similarity index 72% rename from src/Infrastructure.EntityFramework/Repositories/AuthRequestRepository.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs index 2f5f7aa8ec..4ed2d069cf 100644 --- a/src/Infrastructure.EntityFramework/Repositories/AuthRequestRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs @@ -1,12 +1,13 @@ using AutoMapper; using Bit.Core.Repositories; using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Infrastructure.EntityFramework.Repositories; +namespace Bit.Infrastructure.EntityFramework.Auth.Repositories; -public class AuthRequestRepository : Repository, IAuthRequestRepository +public class AuthRequestRepository : Repository, IAuthRequestRepository { public AuthRequestRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.AuthRequests) @@ -23,13 +24,13 @@ public class AuthRequestRepository : Repository> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var userAuthRequests = await dbContext.AuthRequests.Where(a => a.UserId.Equals(userId)).ToListAsync(); - return Mapper.Map>(userAuthRequests); + return Mapper.Map>(userAuthRequests); } } } diff --git a/src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs similarity index 89% rename from src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs index 77b141ad2b..10b7ac0b7f 100644 --- a/src/Infrastructure.EntityFramework/Repositories/EmergencyAccessRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs @@ -1,15 +1,16 @@ using AutoMapper; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models.Data; using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Auth.Repositories.Queries; using Bit.Infrastructure.EntityFramework.Models; -using Bit.Infrastructure.EntityFramework.Repositories.Queries; +using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Infrastructure.EntityFramework.Repositories; +namespace Bit.Infrastructure.EntityFramework.Auth.Repositories; -public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository +public class EmergencyAccessRepository : Repository, IEmergencyAccessRepository { public EmergencyAccessRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.EmergencyAccesses) @@ -21,7 +22,7 @@ public class EmergencyAccessRepository : Repository GetByKeyAsync(string key) + public async Task GetByKeyAsync(string key) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -54,7 +55,7 @@ public class GrantRepository : BaseEntityFrameworkRepository, IGrantRepository } } - public async Task> GetManyAsync(string subjectId, string sessionId, string clientId, string type) + public async Task> GetManyAsync(string subjectId, string sessionId, string clientId, string type) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -66,11 +67,11 @@ public class GrantRepository : BaseEntityFrameworkRepository, IGrantRepository g.Type == type select g; var grants = await query.ToListAsync(); - return (ICollection)grants; + return (ICollection)grants; } } - public async Task SaveAsync(Core.Entities.Grant obj) + public async Task SaveAsync(Core.Auth.Entities.Grant obj) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs similarity index 86% rename from src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs index e57089fcaa..7ddbcc346a 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessDetailsViewQuery.cs @@ -1,6 +1,8 @@ -using Bit.Core.Models.Data; +using Bit.Core.Auth.Models.Data; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Auth.Repositories.Queries; public class EmergencyAccessDetailsViewQuery : IQuery { diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs similarity index 84% rename from src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs index 3a09fa8577..6c967b860a 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs @@ -1,6 +1,8 @@ using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Auth.Repositories.Queries; public class EmergencyAccessReadCountByGrantorIdEmailQuery : IQuery { diff --git a/src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs similarity index 64% rename from src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs index c9a772e9a7..bf5b460647 100644 --- a/src/Infrastructure.EntityFramework/Repositories/SsoConfigRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs @@ -1,45 +1,45 @@ using AutoMapper; -using Bit.Core.Repositories; +using Bit.Core.Auth.Repositories; using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace Bit.Infrastructure.EntityFramework.Repositories; -public class SsoConfigRepository : Repository, ISsoConfigRepository +public class SsoConfigRepository : Repository, ISsoConfigRepository { public SsoConfigRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.SsoConfigs) { } - public async Task GetByOrganizationIdAsync(Guid organizationId) + public async Task GetByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfig = await GetDbSet(dbContext).SingleOrDefaultAsync(sc => sc.OrganizationId == organizationId); - return Mapper.Map(ssoConfig); + return Mapper.Map(ssoConfig); } } - public async Task GetByIdentifierAsync(string identifier) + public async Task GetByIdentifierAsync(string identifier) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfig = await GetDbSet(dbContext).SingleOrDefaultAsync(sc => sc.Organization.Identifier == identifier); - return Mapper.Map(ssoConfig); + return Mapper.Map(ssoConfig); } } - public async Task> GetManyByRevisionNotBeforeDate(DateTime? notBefore) + public async Task> GetManyByRevisionNotBeforeDate(DateTime? notBefore) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var ssoConfigs = await GetDbSet(dbContext).Where(sc => sc.Enabled && sc.RevisionDate >= notBefore).ToListAsync(); - return Mapper.Map>(ssoConfigs); + return Mapper.Map>(ssoConfigs); } } } diff --git a/src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs similarity index 82% rename from src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs rename to src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs index f41f0d540e..be705d04f5 100644 --- a/src/Infrastructure.EntityFramework/Repositories/SsoUserRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs @@ -1,12 +1,12 @@ using AutoMapper; -using Bit.Core.Repositories; +using Bit.Core.Auth.Repositories; using Bit.Infrastructure.EntityFramework.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace Bit.Infrastructure.EntityFramework.Repositories; -public class SsoUserRepository : Repository, ISsoUserRepository +public class SsoUserRepository : Repository, ISsoUserRepository { public SsoUserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.SsoUsers) @@ -23,7 +23,7 @@ public class SsoUserRepository : Repository GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId) + public async Task GetByUserIdOrganizationIdAsync(Guid organizationId, Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs index 008766cbc4..b21bb5eca6 100644 --- a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs +++ b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs @@ -1,7 +1,9 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Repositories; +using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.SecretsManager.Repositories; using Bit.Core.Vault.Repositories; +using Bit.Infrastructure.EntityFramework.Auth.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories; using Bit.Infrastructure.EntityFramework.Vault.Repositories; diff --git a/src/Infrastructure.EntityFramework/Models/AuthRequest.cs b/src/Infrastructure.EntityFramework/Models/AuthRequest.cs index 2e5420d908..f02e81a98e 100644 --- a/src/Infrastructure.EntityFramework/Models/AuthRequest.cs +++ b/src/Infrastructure.EntityFramework/Models/AuthRequest.cs @@ -2,7 +2,7 @@ namespace Bit.Infrastructure.EntityFramework.Models; -public class AuthRequest : Core.Entities.AuthRequest +public class AuthRequest : Core.Auth.Entities.AuthRequest { public virtual User User { get; set; } public virtual Device ResponseDevice { get; set; } @@ -12,6 +12,6 @@ public class AuthRequestMapperProfile : Profile { public AuthRequestMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs b/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs index 867912c5e3..3c74490e5c 100644 --- a/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs +++ b/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs @@ -2,7 +2,7 @@ namespace Bit.Infrastructure.EntityFramework.Models; -public class EmergencyAccess : Core.Entities.EmergencyAccess +public class EmergencyAccess : Core.Auth.Entities.EmergencyAccess { public virtual User Grantee { get; set; } public virtual User Grantor { get; set; } @@ -12,6 +12,6 @@ public class EmergencyAccessMapperProfile : Profile { public EmergencyAccessMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Models/Grant.cs b/src/Infrastructure.EntityFramework/Models/Grant.cs index 78b4b4582f..6e3569fd9b 100644 --- a/src/Infrastructure.EntityFramework/Models/Grant.cs +++ b/src/Infrastructure.EntityFramework/Models/Grant.cs @@ -2,7 +2,7 @@ namespace Bit.Infrastructure.EntityFramework.Models; -public class Grant : Core.Entities.Grant +public class Grant : Core.Auth.Entities.Grant { } @@ -10,6 +10,6 @@ public class GrantMapperProfile : Profile { public GrantMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Models/SsoConfig.cs b/src/Infrastructure.EntityFramework/Models/SsoConfig.cs index 70e007b992..43897678a4 100644 --- a/src/Infrastructure.EntityFramework/Models/SsoConfig.cs +++ b/src/Infrastructure.EntityFramework/Models/SsoConfig.cs @@ -2,7 +2,7 @@ namespace Bit.Infrastructure.EntityFramework.Models; -public class SsoConfig : Core.Entities.SsoConfig +public class SsoConfig : Core.Auth.Entities.SsoConfig { public virtual Organization Organization { get; set; } } @@ -11,6 +11,6 @@ public class SsoConfigMapperProfile : Profile { public SsoConfigMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Models/SsoUser.cs b/src/Infrastructure.EntityFramework/Models/SsoUser.cs index 01333dbcae..31d751e4a1 100644 --- a/src/Infrastructure.EntityFramework/Models/SsoUser.cs +++ b/src/Infrastructure.EntityFramework/Models/SsoUser.cs @@ -2,7 +2,7 @@ namespace Bit.Infrastructure.EntityFramework.Models; -public class SsoUser : Core.Entities.SsoUser +public class SsoUser : Core.Auth.Entities.SsoUser { public virtual Organization Organization { get; set; } public virtual User User { get; set; } @@ -12,6 +12,6 @@ public class SsoUserMapperProfile : Profile { public SsoUserMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Repositories/DatabaseContextExtensions.cs b/src/Infrastructure.EntityFramework/Repositories/DatabaseContextExtensions.cs index 0535c0265e..353a889183 100644 --- a/src/Infrastructure.EntityFramework/Repositories/DatabaseContextExtensions.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContextExtensions.cs @@ -1,4 +1,5 @@ -using Bit.Core.Enums; +using Bit.Core.Auth.Enums; +using Bit.Core.Enums; using Bit.Core.Enums.Provider; using Bit.Infrastructure.EntityFramework.Repositories.Queries; using Microsoft.EntityFrameworkCore; diff --git a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs index dc38579607..a24703fd9b 100644 --- a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs +++ b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs @@ -2,13 +2,17 @@ using System.Security.Claims; using System.Security.Cryptography.X509Certificates; using AspNetCoreRateLimit; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Identity; +using Bit.Core.Auth.IdentityServer; +using Bit.Core.Auth.LoginFeatures; +using Bit.Core.Auth.Models.Business.Tokenables; +using Bit.Core.Auth.Services; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.HostedServices; using Bit.Core.Identity; using Bit.Core.IdentityServer; -using Bit.Core.LoginFeatures; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.OrganizationFeatures; using Bit.Core.Repositories; using Bit.Core.Resources; diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_Create.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_Create.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_DeleteById.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_DeleteById.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_ReadById.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_ReadById.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/AuthRequest_Update.sql b/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/AuthRequest_Update.sql rename to src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_Create.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_Create.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadById.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadById.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql diff --git a/src/Sql/dbo/Stored Procedures/EmergencyAccess_Update.sql b/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/EmergencyAccess_Update.sql rename to src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_Delete.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_Delete.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_Delete.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_Delete.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_DeleteByKey.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteByKey.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_DeleteByKey.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteByKey.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_DeleteExpired.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteExpired.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_DeleteExpired.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteExpired.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_Read.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_Read.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_Read.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_Read.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_ReadByKey.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_ReadByKey.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_ReadByKey.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_ReadByKey.sql diff --git a/src/Sql/dbo/Stored Procedures/Grant_Save.sql b/src/Sql/Auth/dbo/Stored Procedures/Grant_Save.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Grant_Save.sql rename to src/Sql/Auth/dbo/Stored Procedures/Grant_Save.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_Create.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_Create.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_DeleteById.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_DeleteById.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_ReadById.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_ReadById.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoConfig_Update.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoConfig_Update.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_Create.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_Create.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_Delete.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Delete.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_Delete.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_Delete.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_DeleteById.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_DeleteById.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_DeleteMany.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteMany.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_DeleteMany.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteMany.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_ReadById.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_ReadById.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/SsoUser_Update.sql b/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/SsoUser_Update.sql rename to src/Sql/Auth/dbo/Stored Procedures/SsoUser_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql b/src/Sql/Auth/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql rename to src/Sql/Auth/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql diff --git a/src/Sql/dbo/Tables/AuthRequest.sql b/src/Sql/Auth/dbo/Tables/AuthRequest.sql similarity index 100% rename from src/Sql/dbo/Tables/AuthRequest.sql rename to src/Sql/Auth/dbo/Tables/AuthRequest.sql diff --git a/src/Sql/dbo/Tables/EmergencyAccess.sql b/src/Sql/Auth/dbo/Tables/EmergencyAccess.sql similarity index 100% rename from src/Sql/dbo/Tables/EmergencyAccess.sql rename to src/Sql/Auth/dbo/Tables/EmergencyAccess.sql diff --git a/src/Sql/dbo/Tables/Grant.sql b/src/Sql/Auth/dbo/Tables/Grant.sql similarity index 100% rename from src/Sql/dbo/Tables/Grant.sql rename to src/Sql/Auth/dbo/Tables/Grant.sql diff --git a/src/Sql/dbo/Tables/SsoConfig.sql b/src/Sql/Auth/dbo/Tables/SsoConfig.sql similarity index 100% rename from src/Sql/dbo/Tables/SsoConfig.sql rename to src/Sql/Auth/dbo/Tables/SsoConfig.sql diff --git a/src/Sql/dbo/Tables/SsoUser.sql b/src/Sql/Auth/dbo/Tables/SsoUser.sql similarity index 100% rename from src/Sql/dbo/Tables/SsoUser.sql rename to src/Sql/Auth/dbo/Tables/SsoUser.sql diff --git a/src/Sql/dbo/Views/AuthRequestView.sql b/src/Sql/Auth/dbo/Views/AuthRequestView.sql similarity index 100% rename from src/Sql/dbo/Views/AuthRequestView.sql rename to src/Sql/Auth/dbo/Views/AuthRequestView.sql diff --git a/src/Sql/dbo/Views/EmergencyAccessDetailsView.sql b/src/Sql/Auth/dbo/Views/EmergencyAccessDetailsView.sql similarity index 100% rename from src/Sql/dbo/Views/EmergencyAccessDetailsView.sql rename to src/Sql/Auth/dbo/Views/EmergencyAccessDetailsView.sql diff --git a/src/Sql/dbo/Views/GrantView.sql b/src/Sql/Auth/dbo/Views/GrantView.sql similarity index 100% rename from src/Sql/dbo/Views/GrantView.sql rename to src/Sql/Auth/dbo/Views/GrantView.sql diff --git a/src/Sql/dbo/Views/SsoConfigView.sql b/src/Sql/Auth/dbo/Views/SsoConfigView.sql similarity index 100% rename from src/Sql/dbo/Views/SsoConfigView.sql rename to src/Sql/Auth/dbo/Views/SsoConfigView.sql diff --git a/src/Sql/dbo/Views/SsoUserView.sql b/src/Sql/Auth/dbo/Views/SsoUserView.sql similarity index 100% rename from src/Sql/dbo/Views/SsoUserView.sql rename to src/Sql/Auth/dbo/Views/SsoUserView.sql diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index e90d236a81..19f7ef3ae6 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -60,6 +60,11 @@ + + + + + @@ -83,14 +88,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - @@ -135,16 +181,6 @@ - - - - - - - - - - @@ -153,12 +189,6 @@ - - - - - - @@ -298,20 +328,6 @@ - - - - - - - - - - - - - - @@ -328,7 +344,6 @@ - @@ -354,15 +369,12 @@ - - - @@ -376,8 +388,6 @@ - - @@ -388,12 +398,9 @@ - - - @@ -412,8 +419,6 @@ - - diff --git a/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs b/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs index 27e6550606..b0d9594bc5 100644 --- a/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs +++ b/test/Api.IntegrationTest/Factories/ApiApplicationFactory.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Api.Request.Accounts; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.IntegrationTestCommon.Factories; using IdentityServer4.AccessTokenValidation; using Microsoft.AspNetCore.TestHost; diff --git a/test/Api.Test/Controllers/AccountsControllerTests.cs b/test/Api.Test/Controllers/AccountsControllerTests.cs index 1f7ec5f414..1717254fa1 100644 --- a/test/Api.Test/Controllers/AccountsControllerTests.cs +++ b/test/Api.Test/Controllers/AccountsControllerTests.cs @@ -1,10 +1,11 @@ using System.Security.Claims; +using Bit.Api.Auth.Models.Request.Accounts; using Bit.Api.Controllers; -using Bit.Api.Models.Request.Accounts; +using Bit.Core.Auth.Models.Api.Request.Accounts; +using Bit.Core.Auth.Services; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/test/Api.Test/Controllers/OrganizationsControllerTests.cs b/test/Api.Test/Controllers/OrganizationsControllerTests.cs index a3d8192f33..93cee2ee57 100644 --- a/test/Api.Test/Controllers/OrganizationsControllerTests.cs +++ b/test/Api.Test/Controllers/OrganizationsControllerTests.cs @@ -1,10 +1,13 @@ using System.Security.Claims; using AutoFixture.Xunit2; using Bit.Api.Controllers; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; +using Bit.Core.Auth.Services; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Data; using Bit.Core.OrganizationFeatures.OrganizationApiKeys.Interfaces; using Bit.Core.OrganizationFeatures.OrganizationLicenses.Interfaces; using Bit.Core.Repositories; diff --git a/test/Api.Test/Models/Request/Accounts/KdfRequestModelTests.cs b/test/Api.Test/Models/Request/Accounts/KdfRequestModelTests.cs index 3d74995d6d..0edd5a96d0 100644 --- a/test/Api.Test/Models/Request/Accounts/KdfRequestModelTests.cs +++ b/test/Api.Test/Models/Request/Accounts/KdfRequestModelTests.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Bit.Api.Models.Request.Accounts; +using Bit.Api.Auth.Models.Request.Accounts; using Bit.Core.Enums; using Xunit; diff --git a/test/Core.Test/Identity/AuthenticationTokenProviderTests.cs b/test/Core.Test/Auth/Identity/AuthenticationTokenProviderTests.cs similarity index 90% rename from test/Core.Test/Identity/AuthenticationTokenProviderTests.cs rename to test/Core.Test/Auth/Identity/AuthenticationTokenProviderTests.cs index 7b1ad3892a..a76216f3fa 100644 --- a/test/Core.Test/Identity/AuthenticationTokenProviderTests.cs +++ b/test/Core.Test/Auth/Identity/AuthenticationTokenProviderTests.cs @@ -1,11 +1,11 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Identity; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Identity; +using Bit.Core.Entities; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Xunit; -namespace Bit.Core.Test.Identity; +namespace Bit.Core.Test.Auth.Identity; public class AuthenticationTokenProviderTests : BaseTokenProviderTests { diff --git a/test/Core.Test/Identity/BaseTokenProviderTests.cs b/test/Core.Test/Auth/Identity/BaseTokenProviderTests.cs similarity index 95% rename from test/Core.Test/Identity/BaseTokenProviderTests.cs rename to test/Core.Test/Auth/Identity/BaseTokenProviderTests.cs index 5a9e0316ed..b90f71ae71 100644 --- a/test/Core.Test/Identity/BaseTokenProviderTests.cs +++ b/test/Core.Test/Auth/Identity/BaseTokenProviderTests.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Entities; using Bit.Core.Services; using Bit.Core.Utilities; using Bit.Test.Common.AutoFixture; @@ -11,7 +11,7 @@ using Microsoft.Extensions.Options; using NSubstitute; using Xunit; -namespace Bit.Core.Test.Identity; +namespace Bit.Core.Test.Auth.Identity; [SutProviderCustomize] public abstract class BaseTokenProviderTests diff --git a/test/Core.Test/Identity/EmailTokenProviderTests.cs b/test/Core.Test/Auth/Identity/EmailTokenProviderTests.cs similarity index 91% rename from test/Core.Test/Identity/EmailTokenProviderTests.cs rename to test/Core.Test/Auth/Identity/EmailTokenProviderTests.cs index 707ed798df..4e85380d79 100644 --- a/test/Core.Test/Identity/EmailTokenProviderTests.cs +++ b/test/Core.Test/Auth/Identity/EmailTokenProviderTests.cs @@ -1,11 +1,11 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Identity; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Identity; +using Bit.Core.Entities; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Xunit; -namespace Bit.Core.Test.Identity; +namespace Bit.Core.Test.Auth.Identity; public class EmailTokenProviderTests : BaseTokenProviderTests { diff --git a/test/Core.Test/IdentityServer/TokenRetrievalTests.cs b/test/Core.Test/Auth/IdentityServer/TokenRetrievalTests.cs similarity index 96% rename from test/Core.Test/IdentityServer/TokenRetrievalTests.cs rename to test/Core.Test/Auth/IdentityServer/TokenRetrievalTests.cs index 591427da94..360e225c8d 100644 --- a/test/Core.Test/IdentityServer/TokenRetrievalTests.cs +++ b/test/Core.Test/Auth/IdentityServer/TokenRetrievalTests.cs @@ -1,10 +1,10 @@ -using Bit.Core.IdentityServer; +using Bit.Core.Auth.IdentityServer; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using NSubstitute; using Xunit; -namespace Bit.Core.Test.IdentityServer; +namespace Bit.Core.Test.Auth.IdentityServer; public class TokenRetrievalTests { diff --git a/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs b/test/Core.Test/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs similarity index 85% rename from test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs rename to test/Core.Test/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs index 40e390c7d0..0e3f6742d1 100644 --- a/test/Core.Test/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs +++ b/test/Core.Test/Auth/Models/Business/Tokenables/EmergencyAccessInviteTokenableTests.cs @@ -1,10 +1,10 @@ using AutoFixture.Xunit2; -using Bit.Core.Entities; -using Bit.Core.Models.Business.Tokenables; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Tokens; using Xunit; -namespace Bit.Core.Test.Models.Business.Tokenables; +namespace Bit.Core.Test.Auth.Models.Business.Tokenables; public class EmergencyAccessInviteTokenableTests { diff --git a/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs b/test/Core.Test/Auth/Models/Business/Tokenables/HCaptchaTokenableTests.cs similarity index 95% rename from test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs rename to test/Core.Test/Auth/Models/Business/Tokenables/HCaptchaTokenableTests.cs index ce97cb8b3b..56533bab7a 100644 --- a/test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs +++ b/test/Core.Test/Auth/Models/Business/Tokenables/HCaptchaTokenableTests.cs @@ -1,11 +1,11 @@ using AutoFixture.Xunit2; +using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Entities; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.Tokens; using Bit.Test.Common.AutoFixture.Attributes; using Xunit; -namespace Bit.Core.Test.Models.Business.Tokenables; +namespace Bit.Core.Test.Auth.Models.Business.Tokenables; public class HCaptchaTokenableTests { diff --git a/test/Core.Test/Models/Business/Tokenables/SsoTokenableTests.cs b/test/Core.Test/Auth/Models/Business/Tokenables/SsoTokenableTests.cs similarity index 95% rename from test/Core.Test/Models/Business/Tokenables/SsoTokenableTests.cs rename to test/Core.Test/Auth/Models/Business/Tokenables/SsoTokenableTests.cs index 0ec4b5a353..3cc85b97e0 100644 --- a/test/Core.Test/Models/Business/Tokenables/SsoTokenableTests.cs +++ b/test/Core.Test/Auth/Models/Business/Tokenables/SsoTokenableTests.cs @@ -1,11 +1,11 @@ using AutoFixture.Xunit2; +using Bit.Core.Auth.Models.Business.Tokenables; using Bit.Core.Entities; -using Bit.Core.Models.Business.Tokenables; using Bit.Core.Tokens; using Bit.Test.Common.AutoFixture.Attributes; using Xunit; -namespace Bit.Core.Test.Models.Business.Tokenables; +namespace Bit.Core.Test.Auth.Models.Business.Tokenables; public class SsoTokenableTests { diff --git a/test/Core.Test/Services/EmergencyAccessServiceTests.cs b/test/Core.Test/Auth/Services/EmergencyAccessServiceTests.cs similarity index 89% rename from test/Core.Test/Services/EmergencyAccessServiceTests.cs rename to test/Core.Test/Auth/Services/EmergencyAccessServiceTests.cs index 60cacf79fa..6c2352ca00 100644 --- a/test/Core.Test/Services/EmergencyAccessServiceTests.cs +++ b/test/Core.Test/Auth/Services/EmergencyAccessServiceTests.cs @@ -1,7 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; +using Bit.Core.Auth.Services; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; @@ -9,7 +11,7 @@ using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Core.Test.Services; +namespace Bit.Core.Test.Auth.Services; [SutProviderCustomize] public class EmergencyAccessServiceTests @@ -21,7 +23,7 @@ public class EmergencyAccessServiceTests savingUser.Premium = false; var emergencyAccess = new EmergencyAccess { - Type = Enums.EmergencyAccessType.Takeover, + Type = EmergencyAccessType.Takeover, GrantorId = savingUser.Id, }; @@ -42,7 +44,7 @@ public class EmergencyAccessServiceTests sutProvider.GetDependency().CanAccessPremium(invitingUser).Returns(true); var exception = await Assert.ThrowsAsync( - () => sutProvider.Sut.InviteAsync(invitingUser, email, Enums.EmergencyAccessType.Takeover, waitTime)); + () => sutProvider.Sut.InviteAsync(invitingUser, email, EmergencyAccessType.Takeover, waitTime)); Assert.Contains("You cannot use Emergency Access Takeover because you are using Key Connector", exception.Message); await sutProvider.GetDependency().DidNotReceiveWithAnyArgs().CreateAsync(default); @@ -55,9 +57,9 @@ public class EmergencyAccessServiceTests confirmingUser.UsesKeyConnector = true; var emergencyAccess = new EmergencyAccess { - Status = Enums.EmergencyAccessStatusType.Accepted, + Status = EmergencyAccessStatusType.Accepted, GrantorId = confirmingUser.Id, - Type = Enums.EmergencyAccessType.Takeover, + Type = EmergencyAccessType.Takeover, }; sutProvider.GetDependency().GetByIdAsync(confirmingUser.Id).Returns(confirmingUser); @@ -77,7 +79,7 @@ public class EmergencyAccessServiceTests savingUser.UsesKeyConnector = true; var emergencyAccess = new EmergencyAccess { - Type = Enums.EmergencyAccessType.Takeover, + Type = EmergencyAccessType.Takeover, GrantorId = savingUser.Id, }; @@ -99,10 +101,10 @@ public class EmergencyAccessServiceTests grantor.UsesKeyConnector = true; var emergencyAccess = new EmergencyAccess { - Status = Enums.EmergencyAccessStatusType.Confirmed, + Status = EmergencyAccessStatusType.Confirmed, GranteeId = initiatingUser.Id, GrantorId = grantor.Id, - Type = Enums.EmergencyAccessType.Takeover, + Type = EmergencyAccessType.Takeover, }; sutProvider.GetDependency().GetByIdAsync(Arg.Any()).Returns(emergencyAccess); @@ -124,8 +126,8 @@ public class EmergencyAccessServiceTests { GrantorId = grantor.Id, GranteeId = requestingUser.Id, - Status = Enums.EmergencyAccessStatusType.RecoveryApproved, - Type = Enums.EmergencyAccessType.Takeover, + Status = EmergencyAccessStatusType.RecoveryApproved, + Type = EmergencyAccessType.Takeover, }; sutProvider.GetDependency().GetByIdAsync(Arg.Any()).Returns(emergencyAccess); @@ -154,8 +156,8 @@ public class EmergencyAccessServiceTests { GrantorId = grantor.Id, GranteeId = requestingUser.Id, - Status = Enums.EmergencyAccessStatusType.RecoveryApproved, - Type = Enums.EmergencyAccessType.Takeover, + Status = EmergencyAccessStatusType.RecoveryApproved, + Type = EmergencyAccessType.Takeover, }; sutProvider.GetDependency().GetByIdAsync(Arg.Any()).Returns(emergencyAccess); diff --git a/test/Core.Test/Services/SsoConfigServiceTests.cs b/test/Core.Test/Auth/Services/SsoConfigServiceTests.cs similarity index 98% rename from test/Core.Test/Services/SsoConfigServiceTests.cs rename to test/Core.Test/Auth/Services/SsoConfigServiceTests.cs index 01899270ac..eb155cd0a1 100644 --- a/test/Core.Test/Services/SsoConfigServiceTests.cs +++ b/test/Core.Test/Auth/Services/SsoConfigServiceTests.cs @@ -1,15 +1,17 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; +using Bit.Core.Auth.Services; +using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Data; using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Repositories; -using Bit.Core.Services; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -namespace Bit.Core.Test.Services; +namespace Bit.Core.Test.Auth.Services; [SutProviderCustomize] public class SsoConfigServiceTests diff --git a/test/Core.Test/AutoFixture/OrganizationFixtures.cs b/test/Core.Test/AutoFixture/OrganizationFixtures.cs index 34f64914ef..7d0044c36c 100644 --- a/test/Core.Test/AutoFixture/OrganizationFixtures.cs +++ b/test/Core.Test/AutoFixture/OrganizationFixtures.cs @@ -1,9 +1,10 @@ using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Models.Data; using Bit.Core.Utilities; diff --git a/test/Core.Test/AutoFixture/UserFixtures.cs b/test/Core.Test/AutoFixture/UserFixtures.cs index a1330bcb81..bc5e068cae 100644 --- a/test/Core.Test/AutoFixture/UserFixtures.cs +++ b/test/Core.Test/AutoFixture/UserFixtures.cs @@ -1,8 +1,8 @@ using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Test.AutoFixture.OrganizationFixtures; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Core.Test/Entities/OrganizationTests.cs b/test/Core.Test/Entities/OrganizationTests.cs index 5a86c3fd01..996dde4588 100644 --- a/test/Core.Test/Entities/OrganizationTests.cs +++ b/test/Core.Test/Entities/OrganizationTests.cs @@ -1,7 +1,7 @@ using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Test.Common.Helpers; using Xunit; diff --git a/test/Core.Test/Entities/UserTests.cs b/test/Core.Test/Entities/UserTests.cs index 8a1986cd94..3a15ffc60f 100644 --- a/test/Core.Test/Entities/UserTests.cs +++ b/test/Core.Test/Entities/UserTests.cs @@ -1,7 +1,7 @@ using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Test.Common.Helpers; using Xunit; diff --git a/test/Core.Test/Models/Data/SelfHostedOrganizationDetailsTests.cs b/test/Core.Test/Models/Data/SelfHostedOrganizationDetailsTests.cs index 02c35151c2..71c535491b 100644 --- a/test/Core.Test/Models/Data/SelfHostedOrganizationDetailsTests.cs +++ b/test/Core.Test/Models/Data/SelfHostedOrganizationDetailsTests.cs @@ -1,7 +1,8 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Business; -using Bit.Core.Models.Data; using Bit.Core.Models.Data.Organizations; using Bit.Core.Models.OrganizationConnectionConfigs; using Bit.Core.Test.AutoFixture; diff --git a/test/Core.Test/Services/HandlebarsMailServiceTests.cs b/test/Core.Test/Services/HandlebarsMailServiceTests.cs index 5127eb2b43..b0d4f7e618 100644 --- a/test/Core.Test/Services/HandlebarsMailServiceTests.cs +++ b/test/Core.Test/Services/HandlebarsMailServiceTests.cs @@ -1,7 +1,8 @@ using System.Reflection; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business; using Bit.Core.Entities; using Bit.Core.Entities.Provider; -using Bit.Core.Models.Business; using Bit.Core.Services; using Bit.Core.Settings; using Microsoft.Extensions.Logging; diff --git a/test/Core.Test/Services/OrganizationServiceTests.cs b/test/Core.Test/Services/OrganizationServiceTests.cs index ee8fdc8fb9..9f834aced0 100644 --- a/test/Core.Test/Services/OrganizationServiceTests.cs +++ b/test/Core.Test/Services/OrganizationServiceTests.cs @@ -1,4 +1,8 @@ using System.Text.Json; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Business; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Enums; diff --git a/test/Core.Test/Services/PolicyServiceTests.cs b/test/Core.Test/Services/PolicyServiceTests.cs index 29b4285a19..992daf4b67 100644 --- a/test/Core.Test/Services/PolicyServiceTests.cs +++ b/test/Core.Test/Services/PolicyServiceTests.cs @@ -1,7 +1,9 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Core.Auth.Repositories; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Test.Common.AutoFixture; diff --git a/test/Core.Test/Services/UserServiceTests.cs b/test/Core.Test/Services/UserServiceTests.cs index 3257f1feea..9cdda95de8 100644 --- a/test/Core.Test/Services/UserServiceTests.cs +++ b/test/Core.Test/Services/UserServiceTests.cs @@ -1,7 +1,7 @@ using System.Text.Json; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Business; using Bit.Core.Models.Data.Organizations; using Bit.Core.Repositories; diff --git a/test/Identity.IntegrationTest/Controllers/AccountsControllerTests.cs b/test/Identity.IntegrationTest/Controllers/AccountsControllerTests.cs index 3d03d39a92..40bd4391af 100644 --- a/test/Identity.IntegrationTest/Controllers/AccountsControllerTests.cs +++ b/test/Identity.IntegrationTest/Controllers/AccountsControllerTests.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Api.Request.Accounts; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.IntegrationTestCommon.Factories; using Microsoft.EntityFrameworkCore; using Xunit; diff --git a/test/Identity.IntegrationTest/Endpoints/IdentityServerTests.cs b/test/Identity.IntegrationTest/Endpoints/IdentityServerTests.cs index af23e79bb0..78f683d9e9 100644 --- a/test/Identity.IntegrationTest/Endpoints/IdentityServerTests.cs +++ b/test/Identity.IntegrationTest/Endpoints/IdentityServerTests.cs @@ -1,6 +1,6 @@ using System.Text.Json; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.Core.Enums; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Repositories; using Bit.Identity.IdentityServer; using Bit.IntegrationTestCommon.Factories; diff --git a/test/Identity.Test/Controllers/AccountsControllerTests.cs b/test/Identity.Test/Controllers/AccountsControllerTests.cs index 5318a55cd2..32473593dc 100644 --- a/test/Identity.Test/Controllers/AccountsControllerTests.cs +++ b/test/Identity.Test/Controllers/AccountsControllerTests.cs @@ -1,7 +1,8 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Models.Api.Request.Accounts; +using Bit.Core.Auth.Services; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/AuthRequestFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/AuthRequestFixtures.cs similarity index 90% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/AuthRequestFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/AuthRequestFixtures.cs index e50c7a4af2..d4c1d7559a 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/AuthRequestFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/AuthRequestFixtures.cs @@ -1,13 +1,15 @@ using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Auth.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; internal class AuthRequestBuilder : ISpecimenBuilder { diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/EmergencyAccessFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/EmergencyAccessFixtures.cs similarity index 90% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/EmergencyAccessFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/EmergencyAccessFixtures.cs index 87a8f796c2..4992ff5aff 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/EmergencyAccessFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/EmergencyAccessFixtures.cs @@ -1,13 +1,15 @@ using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Auth.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; internal class EmergencyAccessBuilder : ISpecimenBuilder { diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/GrantFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs similarity index 87% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/GrantFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs index d431132de4..880a391fce 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/GrantFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs @@ -1,12 +1,13 @@ using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; +using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; -using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Auth.Repositories; +using Bit.Infrastructure.EntityFramework.Models; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; internal class GrantBuilder : ISpecimenBuilder { diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/SsoConfigFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoConfigFixtures.cs similarity index 90% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/SsoConfigFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoConfigFixtures.cs index 4cad2154f8..ecbae996dc 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/SsoConfigFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoConfigFixtures.cs @@ -1,12 +1,13 @@ using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Models.Data; +using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; internal class SsoConfigBuilder : ISpecimenBuilder { diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/SsoUserFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoUserFixtures.cs similarity index 89% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/SsoUserFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoUserFixtures.cs index f2712e0186..a58f2191d5 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/SsoUserFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/SsoUserFixtures.cs @@ -1,11 +1,12 @@ using AutoFixture; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; internal class EfSsoUser : ICustomization { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/AuthRequestRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/AuthRequestRepositoryTests.cs similarity index 75% rename from test/Infrastructure.EFIntegration.Test/Repositories/AuthRequestRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/AuthRequestRepositoryTests.cs index 994c8dca83..fe8259a0f3 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/AuthRequestRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/AuthRequestRepositoryTests.cs @@ -1,12 +1,15 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; -using Bit.Infrastructure.EFIntegration.Test.AutoFixture; -using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +using Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; +using Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; using Xunit; +using EfAuthRepo = Bit.Infrastructure.EntityFramework.Auth.Repositories; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlAuthRepo = Bit.Infrastructure.Dapper.Auth.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories; public class AuthRequestRepositoryTests { @@ -14,8 +17,8 @@ public class AuthRequestRepositoryTests public async void CreateAsync_Works_DataMatches( AuthRequest authRequest, AuthRequestCompare equalityComparer, - List suts, - SqlRepo.AuthRequestRepository sqlAuthRequestRepo, + List suts, + SqlAuthRepo.AuthRequestRepository sqlAuthRequestRepo, User user, List efUserRepos, SqlRepo.UserRepository sqlUserRepo diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EmergencyAccessRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EmergencyAccessRepositoryTests.cs similarity index 78% rename from test/Infrastructure.EFIntegration.Test/Repositories/EmergencyAccessRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EmergencyAccessRepositoryTests.cs index d014d463a5..a17dc4b105 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EmergencyAccessRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EmergencyAccessRepositoryTests.cs @@ -1,12 +1,15 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; -using Bit.Infrastructure.EFIntegration.Test.AutoFixture; -using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +using Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; +using Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; using Xunit; +using EfAuthRepo = Bit.Infrastructure.EntityFramework.Auth.Repositories; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlAuthRepo = Bit.Infrastructure.Dapper.Auth.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories; public class EmergencyAccessRepositoryTests { @@ -15,9 +18,9 @@ public class EmergencyAccessRepositoryTests EmergencyAccess emergencyAccess, List users, EmergencyAccessCompare equalityComparer, - List suts, + List suts, List efUserRepos, - SqlRepo.EmergencyAccessRepository sqlEmergencyAccessRepo, + SqlAuthRepo.EmergencyAccessRepository sqlEmergencyAccessRepo, SqlRepo.UserRepository sqlUserRepo ) { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/AuthRequestCompare.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/AuthRequestCompare.cs similarity index 83% rename from test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/AuthRequestCompare.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/AuthRequestCompare.cs index c881662dbd..1708a2ec4c 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/AuthRequestCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/AuthRequestCompare.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; public class AuthRequestCompare : IEqualityComparer { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/EmergencyAccessCompare.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/EmergencyAccessCompare.cs similarity index 84% rename from test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/EmergencyAccessCompare.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/EmergencyAccessCompare.cs index eb182d6e9a..a01ad710a4 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/EmergencyAccessCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/EmergencyAccessCompare.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; public class EmergencyAccessCompare : IEqualityComparer { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/GrantCompare.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/GrantCompare.cs similarity index 82% rename from test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/GrantCompare.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/GrantCompare.cs index 7621577166..0425412492 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/GrantCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/GrantCompare.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; public class GrantCompare : IEqualityComparer { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoConfigCompare.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoConfigCompare.cs similarity index 77% rename from test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoConfigCompare.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoConfigCompare.cs index 766b8c6857..2bedae1fdd 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoConfigCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoConfigCompare.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; public class SsoConfigCompare : IEqualityComparer { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoUserCompare.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoUserCompare.cs similarity index 72% rename from test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoUserCompare.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoUserCompare.cs index fffd512c6d..02ad5989e7 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/SsoUserCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/EqualityComparers/SsoUserCompare.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; public class SsoUserCompare : IEqualityComparer { diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/SsoConfigRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoConfigRepositoryTests.cs similarity index 90% rename from test/Infrastructure.EFIntegration.Test/Repositories/SsoConfigRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoConfigRepositoryTests.cs index 7858bc1f0e..f1eafba977 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/SsoConfigRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoConfigRepositoryTests.cs @@ -1,19 +1,21 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; -using Bit.Infrastructure.EFIntegration.Test.AutoFixture; -using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +using Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; +using Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; using Xunit; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlAuthRepo = Bit.Infrastructure.Dapper.Auth.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories; public class SsoConfigRepositoryTests { [CiSkippedTheory, EfSsoConfigAutoData] public async void CreateAsync_Works_DataMatches(SsoConfig ssoConfig, Organization org, SsoConfigCompare equalityComparer, List suts, - List efOrgRepos, SqlRepo.SsoConfigRepository sqlSsoConfigRepo, + List efOrgRepos, SqlAuthRepo.SsoConfigRepository sqlSsoConfigRepo, SqlRepo.OrganizationRepository sqlOrganizationRepo) { var savedSsoConfigs = new List(); @@ -49,7 +51,7 @@ public class SsoConfigRepositoryTests [CiSkippedTheory, EfSsoConfigAutoData] public async void ReplaceAsync_Works_DataMatches(SsoConfig postSsoConfig, SsoConfig replaceSsoConfig, Organization org, SsoConfigCompare equalityComparer, List suts, - List efOrgRepos, SqlRepo.SsoConfigRepository sqlSsoConfigRepo, + List efOrgRepos, SqlAuthRepo.SsoConfigRepository sqlSsoConfigRepo, SqlRepo.OrganizationRepository sqlOrganizationRepo) { var savedSsoConfigs = new List(); @@ -93,7 +95,7 @@ public class SsoConfigRepositoryTests [CiSkippedTheory, EfSsoConfigAutoData] public async void DeleteAsync_Works_DataMatches(SsoConfig ssoConfig, Organization org, List suts, - List efOrgRepos, SqlRepo.SsoConfigRepository sqlSsoConfigRepo, + List efOrgRepos, SqlAuthRepo.SsoConfigRepository sqlSsoConfigRepo, SqlRepo.OrganizationRepository sqlOrganizationRepo) { foreach (var sut in suts) @@ -131,7 +133,7 @@ public class SsoConfigRepositoryTests [CiSkippedTheory, EfSsoConfigAutoData] public async void GetByOrganizationIdAsync_Works_DataMatches(SsoConfig ssoConfig, Organization org, SsoConfigCompare equalityComparer, List suts, - List efOrgRepos, SqlRepo.SsoConfigRepository sqlSsoConfigRepo, + List efOrgRepos, SqlAuthRepo.SsoConfigRepository sqlSsoConfigRepo, SqlRepo.OrganizationRepository sqlOrgRepo) { var returnedList = new List(); @@ -168,7 +170,7 @@ public class SsoConfigRepositoryTests [CiSkippedTheory, EfSsoConfigAutoData] public async void GetByIdentifierAsync_Works_DataMatches(SsoConfig ssoConfig, Organization org, SsoConfigCompare equalityComparer, List suts, - List efOrgRepos, SqlRepo.SsoConfigRepository sqlSsoConfigRepo, + List efOrgRepos, SqlAuthRepo.SsoConfigRepository sqlSsoConfigRepo, SqlRepo.OrganizationRepository sqlOrgRepo) { var returnedList = new List(); diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/SsoUserRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoUserRepositoryTests.cs similarity index 90% rename from test/Infrastructure.EFIntegration.Test/Repositories/SsoUserRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoUserRepositoryTests.cs index bc43a05261..7e6a7173f1 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/SsoUserRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/Repositories/SsoUserRepositoryTests.cs @@ -1,12 +1,14 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; -using Bit.Infrastructure.EFIntegration.Test.AutoFixture; -using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; +using Bit.Infrastructure.EFIntegration.Test.Auth.AutoFixture; +using Bit.Infrastructure.EFIntegration.Test.Auth.Repositories.EqualityComparers; using Xunit; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlAuthRepo = Bit.Infrastructure.Dapper.Auth.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; -namespace Bit.Infrastructure.EFIntegration.Test.Repositories; +namespace Bit.Infrastructure.EFIntegration.Test.Auth.Repositories; public class SsoUserRepositoryTests { @@ -14,7 +16,7 @@ public class SsoUserRepositoryTests public async void CreateAsync_Works_DataMatches(SsoUser ssoUser, User user, Organization org, SsoUserCompare equalityComparer, List suts, List efOrgRepos, List efUserRepos, - SqlRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo, + SqlAuthRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo, SqlRepo.UserRepository sqlUserRepo) { var createdSsoUsers = new List(); @@ -52,7 +54,7 @@ public class SsoUserRepositoryTests public async void ReplaceAsync_Works_DataMatches(SsoUser postSsoUser, SsoUser replaceSsoUser, Organization org, User user, SsoUserCompare equalityComparer, List suts, List efUserRepos, - List efOrgRepos, SqlRepo.SsoUserRepository sqlSsoUserRepo, + List efOrgRepos, SqlAuthRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo, SqlRepo.UserRepository sqlUserRepo) { var savedSsoUsers = new List(); @@ -100,7 +102,7 @@ public class SsoUserRepositoryTests [CiSkippedTheory, EfSsoUserAutoData] public async void DeleteAsync_Works_DataMatches(SsoUser ssoUser, Organization org, User user, List suts, List efUserRepos, List efOrgRepos, - SqlRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.UserRepository sqlUserRepo, + SqlAuthRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrganizationRepo) { foreach (var sut in suts) @@ -143,7 +145,7 @@ public class SsoUserRepositoryTests public async void DeleteAsync_UserIdOrganizationId_Works_DataMatches(SsoUser ssoUser, User user, Organization org, List suts, List efUserRepos, List efOrgRepos, - SqlRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo + SqlAuthRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo ) { foreach (var sut in suts) diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationFixtures.cs b/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationFixtures.cs index 800ee14d20..8946099442 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationFixtures.cs @@ -1,8 +1,8 @@ using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationUserFixtures.cs b/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationUserFixtures.cs index c457a463d9..191b48852b 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationUserFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/AutoFixture/OrganizationUserFixtures.cs @@ -1,9 +1,9 @@ using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; +using Bit.Core.Auth.Enums; +using Bit.Core.Auth.Models; using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models; using Bit.Core.Models.Data; using Bit.Core.Test.AutoFixture.OrganizationUserFixtures; using Bit.Core.Test.AutoFixture.UserFixtures; diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/UserRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Repositories/UserRepositoryTests.cs index ce04ffdfba..e888826ded 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/UserRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Repositories/UserRepositoryTests.cs @@ -1,10 +1,12 @@ -using Bit.Core.Entities; +using Bit.Core.Auth.Entities; +using Bit.Core.Entities; using Bit.Core.Models.Data; using Bit.Core.Test.AutoFixture.Attributes; using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; using Xunit; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using SqlAuthRepo = Bit.Infrastructure.Dapper.Auth.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; namespace Bit.Infrastructure.EFIntegration.Test.Repositories; @@ -249,7 +251,7 @@ public class UserRepositoryTests public async void GetBySsoUserAsync_Works_DataMatches(User user, Organization org, SsoUser ssoUser, UserCompare equalityComparer, List suts, List ssoUserRepos, List orgRepos, - SqlRepo.UserRepository sqlUserRepo, SqlRepo.SsoUserRepository sqlSsoUserRepo, + SqlRepo.UserRepository sqlUserRepo, SqlAuthRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo) { var returnedList = new List(); diff --git a/test/Infrastructure.IntegrationTest/Repositories/EmergencyAccessRepositoryTests.cs b/test/Infrastructure.IntegrationTest/Auth/Repositories/EmergencyAccessRepositoryTests.cs similarity index 89% rename from test/Infrastructure.IntegrationTest/Repositories/EmergencyAccessRepositoryTests.cs rename to test/Infrastructure.IntegrationTest/Auth/Repositories/EmergencyAccessRepositoryTests.cs index c5143fad68..841728cdea 100644 --- a/test/Infrastructure.IntegrationTest/Repositories/EmergencyAccessRepositoryTests.cs +++ b/test/Infrastructure.IntegrationTest/Auth/Repositories/EmergencyAccessRepositoryTests.cs @@ -1,9 +1,10 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; +using Bit.Core.Auth.Entities; +using Bit.Core.Auth.Enums; +using Bit.Core.Entities; using Bit.Core.Repositories; using Xunit; -namespace Bit.Infrastructure.IntegrationTest.Repositories; +namespace Bit.Infrastructure.IntegrationTest.Auth.Repositories; public class EmergencyAccessRepositoriesTests { diff --git a/test/IntegrationTestCommon/Factories/IdentityApplicationFactory.cs b/test/IntegrationTestCommon/Factories/IdentityApplicationFactory.cs index 501ded6134..d47b3da861 100644 --- a/test/IntegrationTestCommon/Factories/IdentityApplicationFactory.cs +++ b/test/IntegrationTestCommon/Factories/IdentityApplicationFactory.cs @@ -1,7 +1,7 @@ using System.Net.Http.Json; using System.Text.Json; +using Bit.Core.Auth.Models.Api.Request.Accounts; using Bit.Core.Enums; -using Bit.Core.Models.Api.Request.Accounts; using Bit.Core.Utilities; using Bit.Identity; using Bit.Test.Common.Helpers; diff --git a/test/IntegrationTestCommon/Factories/WebApplicationFactoryBase.cs b/test/IntegrationTestCommon/Factories/WebApplicationFactoryBase.cs index e2546ac5a7..3ee554d606 100644 --- a/test/IntegrationTestCommon/Factories/WebApplicationFactoryBase.cs +++ b/test/IntegrationTestCommon/Factories/WebApplicationFactoryBase.cs @@ -1,4 +1,5 @@ using AspNetCoreRateLimit; +using Bit.Core.Auth.Services; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Infrastructure.EntityFramework.Repositories; diff --git a/util/SqlServerEFScaffold/Migrations/DatabaseContextModelSnapshot.cs b/util/SqlServerEFScaffold/Migrations/DatabaseContextModelSnapshot.cs index 1ebfca382b..44515a89cb 100644 --- a/util/SqlServerEFScaffold/Migrations/DatabaseContextModelSnapshot.cs +++ b/util/SqlServerEFScaffold/Migrations/DatabaseContextModelSnapshot.cs @@ -196,7 +196,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.ToTable("Device", (string)null); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.EmergencyAccess", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -327,7 +327,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.ToTable("Folder", (string)null); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.Grant", b => { b.Property("Key") .HasMaxLength(200) @@ -1024,7 +1024,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.ToTable("Send", (string)null); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.SsoConfig", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1054,7 +1054,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.ToTable("SsoConfig", (string)null); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.SsoUser", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1404,7 +1404,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.Navigation("User"); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.EmergencyAccess", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee") .WithMany() @@ -1604,7 +1604,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.Navigation("User"); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.SsoConfig", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") .WithMany("SsoConfigs") @@ -1615,7 +1615,7 @@ namespace Bit.SqlServerEFScaffold.Migrations b.Navigation("Organization"); }); - modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b => + modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Auth.Models.SsoUser", b => { b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization") .WithMany("SsoUsers")