diff --git a/src/Certify.Client/CertifyApiClient.cs b/src/Certify.Client/CertifyApiClient.cs index 11ef64af9..c393c3b1d 100644 --- a/src/Certify.Client/CertifyApiClient.cs +++ b/src/Certify.Client/CertifyApiClient.cs @@ -6,10 +6,9 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; +using Certify.Models.Hub; using Certify.Models; -using Certify.Models.API; using Certify.Models.Config; -using Certify.Models.Config.AccessControl; using Certify.Models.Reporting; using Certify.Models.Utils; using Certify.Shared; diff --git a/src/Certify.Client/ICertifyClient.cs b/src/Certify.Client/ICertifyClient.cs index 74ee82378..cbac95bd8 100644 --- a/src/Certify.Client/ICertifyClient.cs +++ b/src/Certify.Client/ICertifyClient.cs @@ -5,6 +5,7 @@ using Certify.Models.Config; using Certify.Models.Reporting; using Certify.Models.Utils; +using Certify.Models.Hub; using Certify.Shared; namespace Certify.Client @@ -15,108 +16,67 @@ namespace Certify.Client /// public partial interface ICertifyInternalApiClient { - #region System - Task GetAppVersion(AuthContext authContext = null); - Task CheckForUpdates(AuthContext authContext = null); - Task> PerformServiceDiagnostics(AuthContext authContext = null); Task> PerformManagedCertMaintenance(string id = null, AuthContext authContext = null); - Task> SetDefaultDataStore(string dataStoreId, AuthContext authContext = null); Task> GetDataStoreProviders(AuthContext authContext = null); Task> GetDataStoreConnections(AuthContext authContext = null); Task> CopyDataStore(string sourceId, string targetId, AuthContext authContext = null); Task> UpdateDataStoreConnection(DataStoreConnection dataStoreConnection, AuthContext authContext = null); Task> TestDataStoreConnection(DataStoreConnection dataStoreConnection, AuthContext authContext = null); - #endregion System #region Server Task IsServerAvailable(StandardServerTypes serverType, AuthContext authContext = null); - Task> GetServerSiteList(StandardServerTypes serverType, string itemId = null, AuthContext authContext = null); - Task GetServerVersion(StandardServerTypes serverType, AuthContext authContext = null); - Task> GetServerSiteDomains(StandardServerTypes serverType, string serverSiteId, AuthContext authContext = null); - Task> RunConfigurationDiagnostics(StandardServerTypes serverType, string serverSiteId, AuthContext authContext = null); - Task> GetCurrentChallenges(string type, string key, AuthContext authContext = null); - #endregion Server #region Preferences - Task GetPreferences(AuthContext authContext = null); - Task SetPreferences(Preferences preferences, AuthContext authContext = null); - #endregion Preferences #region Credentials - Task> GetCredentials(AuthContext authContext = null); - Task UpdateCredentials(StoredCredential credential, AuthContext authContext = null); - Task DeleteCredential(string credentialKey, AuthContext authContext = null); - Task TestCredentials(string credentialKey, AuthContext authContext = null); - #endregion Credentials #region Managed Certificates - Task> GetManagedCertificates(ManagedCertificateFilter filter, AuthContext authContext = null); Task GetManagedCertificateSearchResult(ManagedCertificateFilter filter, AuthContext authContext = null); Task GetManagedCertificateSummary(ManagedCertificateFilter filter, AuthContext authContext = null); - Task GetManagedCertificate(string managedItemId, AuthContext authContext = null); - Task UpdateManagedCertificate(ManagedCertificate site, AuthContext authContext = null); - Task DeleteManagedCertificate(string managedItemId, AuthContext authContext = null); - Task RevokeManageSiteCertificate(string managedItemId, AuthContext authContext = null); - Task> BeginAutoRenewal(RenewalSettings settings, AuthContext authContext = null); - Task> RedeployManagedCertificates(bool isPreviewOnly, bool includeDeploymentTasks, AuthContext authContext = null); - Task ReapplyCertificateBindings(string managedItemId, bool isPreviewOnly, bool includeDeploymentTasks, AuthContext authContext = null); - Task RefetchCertificate(string managedItemId, AuthContext authContext = null); - Task BeginCertificateRequest(string managedItemId, bool resumePaused, bool isInteractive, AuthContext authContext = null); - Task> TestChallengeConfiguration(ManagedCertificate site, AuthContext authContext = null); Task> PerformChallengeCleanup(ManagedCertificate site, AuthContext authContext = null); - Task> GetDnsProviderZones(string providerTypeId, string credentialId, AuthContext authContext = null); - Task> PreviewActions(ManagedCertificate site, AuthContext authContext = null); - Task> GetChallengeAPIList(AuthContext authContext = null); - Task> GetDeploymentProviderList(AuthContext authContext = null); - Task GetDeploymentProviderDefinition(string id, Config.DeploymentTaskConfig config, AuthContext authContext = null); - Task> PerformDeployment(string managedCertificateId, string taskId, bool isPreviewOnly, bool forceTaskExecute, AuthContext authContext = null); - Task> ValidateDeploymentTask(DeploymentTaskValidationInfo info, AuthContext authContext = null); - - Task GetItemLog(string id, int limit, AuthContext authContext = null); - + Task GetItemLog(string id, int limit, AuthContext authContext = null); #endregion Managed Certificates #region Accounts Task> GetCertificateAuthorities(AuthContext authContext = null); - Task UpdateCertificateAuthority(CertificateAuthority ca, AuthContext authContext = null); Task DeleteCertificateAuthority(string id, AuthContext authContext = null); Task> GetAccounts(AuthContext authContext = null); @@ -124,9 +84,7 @@ public partial interface ICertifyInternalApiClient Task UpdateAccountContact(ContactRegistration contact, AuthContext authContext = null); Task RemoveAccount(string storageKey, bool deactivate, AuthContext authContext = null); Task ChangeAccountKey(string storageKey, string newKeyPEM = null, AuthContext authContext = null); - #endregion Accounts - } /// @@ -135,15 +93,10 @@ public partial interface ICertifyInternalApiClient public interface ICertifyClient : ICertifyInternalApiClient { event Action OnMessageFromService; - event Action OnRequestProgressStateUpdated; - event Action OnManagedCertificateUpdated; - Task ConnectStatusStreamAsync(); - Shared.ServerConnection GetConnectionInfo(); - Task EnsureServiceHubConnected(); } } diff --git a/src/Certify.Client/ManagementServerClient.cs b/src/Certify.Client/ManagementServerClient.cs index 4c49cb29e..e2cd6dffb 100644 --- a/src/Certify.Client/ManagementServerClient.cs +++ b/src/Certify.Client/ManagementServerClient.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Certify.API.Management; +using Certify.Models.Hub; using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Certify.Core/Management/Access/AccessControl.cs b/src/Certify.Core/Management/Access/AccessControl.cs index 5610ccc25..ecbf0d8b4 100644 --- a/src/Certify.Core/Management/Access/AccessControl.cs +++ b/src/Certify.Core/Management/Access/AccessControl.cs @@ -4,8 +4,7 @@ using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; -using Certify.Models.API; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; using Certify.Models.Providers; using Certify.Providers; diff --git a/src/Certify.Core/Management/Access/IAccessControl.cs b/src/Certify.Core/Management/Access/IAccessControl.cs index 8e9a8b8c9..f1f711820 100644 --- a/src/Certify.Core/Management/Access/IAccessControl.cs +++ b/src/Certify.Core/Management/Access/IAccessControl.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Certify.Models.API; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; namespace Certify.Core.Management.Access { diff --git a/src/Certify.Core/Management/CertifyManager/CertifyManager.Maintenance.cs b/src/Certify.Core/Management/CertifyManager/CertifyManager.Maintenance.cs index 0dfb52078..90c9ea746 100644 --- a/src/Certify.Core/Management/CertifyManager/CertifyManager.Maintenance.cs +++ b/src/Certify.Core/Management/CertifyManager/CertifyManager.Maintenance.cs @@ -6,9 +6,9 @@ using System.Threading; using System.Threading.Tasks; using Certify.Core.Management.Access; +using Certify.Models.Hub; using Certify.Models; using Certify.Models.Config; -using Certify.Models.Config.AccessControl; using Certify.Models.Shared; namespace Certify.Management diff --git a/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs b/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs index d4ffccc97..0eec7b296 100644 --- a/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs +++ b/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagedCertificates.cs @@ -4,8 +4,8 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using Certify.Models.Hub; using Certify.Models; -using Certify.Models.API; using Certify.Models.Providers; using Certify.Models.Reporting; using Certify.Models.Shared; diff --git a/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagementHub.cs b/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagementHub.cs index 90e90a619..ce8f43856 100644 --- a/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagementHub.cs +++ b/src/Certify.Core/Management/CertifyManager/CertifyManager.ManagementHub.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; -using Certify.API.Management; using Certify.Client; +using Certify.Models.Hub; using Certify.Models; using Certify.Models.Config; using Certify.Shared.Core.Utils; diff --git a/src/Certify.Core/Management/CertifyManager/ICertifyManager.cs b/src/Certify.Core/Management/CertifyManager/ICertifyManager.cs index d63fbb762..e5c96540c 100644 --- a/src/Certify.Core/Management/CertifyManager/ICertifyManager.cs +++ b/src/Certify.Core/Management/CertifyManager/ICertifyManager.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Threading.Tasks; using Certify.Config; +using Certify.Models.Hub; using Certify.Models; -using Certify.Models.API; using Certify.Models.Config; using Certify.Models.Config.Migration; using Certify.Models.Providers; diff --git a/src/Certify.Models/Config/AccessControl.cs b/src/Certify.Models/Hub/AccessControl.cs similarity index 98% rename from src/Certify.Models/Config/AccessControl.cs rename to src/Certify.Models/Hub/AccessControl.cs index fd6fcbbc8..50e8ff9b4 100644 --- a/src/Certify.Models/Config/AccessControl.cs +++ b/src/Certify.Models/Hub/AccessControl.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Certify.Models.Config.AccessControl +namespace Certify.Models.Hub { public class AccessStoreItem { diff --git a/src/Certify.Models/Config/AccessControlConfig.cs b/src/Certify.Models/Hub/AccessControlConfig.cs similarity index 99% rename from src/Certify.Models/Config/AccessControlConfig.cs rename to src/Certify.Models/Hub/AccessControlConfig.cs index a1d119a50..0c545b72e 100644 --- a/src/Certify.Models/Config/AccessControlConfig.cs +++ b/src/Certify.Models/Hub/AccessControlConfig.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Certify.Models.Config.AccessControl +namespace Certify.Models.Hub { public enum SecurityPrincipleType { diff --git a/src/Certify.Models/API/AuthRequest.cs b/src/Certify.Models/Hub/AuthRequest.cs similarity index 93% rename from src/Certify.Models/API/AuthRequest.cs rename to src/Certify.Models/Hub/AuthRequest.cs index d5ad8eeac..ada89804e 100644 --- a/src/Certify.Models/API/AuthRequest.cs +++ b/src/Certify.Models/Hub/AuthRequest.cs @@ -1,6 +1,4 @@ -using Certify.Models.Config.AccessControl; - -namespace Certify.Models.API +namespace Certify.Models.Hub { /// /// Required info to begin auth @@ -40,7 +38,7 @@ public class AuthResponse /// public string RefreshToken { get; set; } = string.Empty; - public Models.Config.AccessControl.SecurityPrinciple? SecurityPrinciple { get; set; } + public SecurityPrinciple? SecurityPrinciple { get; set; } public RoleStatus? RoleStatus { get; set; } } diff --git a/src/Certify.Models/API/LogResult.cs b/src/Certify.Models/Hub/LogResult.cs similarity index 98% rename from src/Certify.Models/API/LogResult.cs rename to src/Certify.Models/Hub/LogResult.cs index b74bdcc2e..67e50e0f1 100644 --- a/src/Certify.Models/API/LogResult.cs +++ b/src/Certify.Models/Hub/LogResult.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Certify.Models.API +namespace Certify.Models.Hub { public class LogItem { diff --git a/src/Certify.Models/API/ManagedCertificateSummary.cs b/src/Certify.Models/Hub/ManagedCertificateSummary.cs similarity index 97% rename from src/Certify.Models/API/ManagedCertificateSummary.cs rename to src/Certify.Models/Hub/ManagedCertificateSummary.cs index 01a5b65e9..1b6804447 100644 --- a/src/Certify.Models/API/ManagedCertificateSummary.cs +++ b/src/Certify.Models/Hub/ManagedCertificateSummary.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; +using Certify.Models; -namespace Certify.Models.API +namespace Certify.Models.Hub { /// /// Summary information for a managed certificate diff --git a/src/Certify.Models/Hub/ManagedChallenge.cs b/src/Certify.Models/Hub/ManagedChallenge.cs new file mode 100644 index 000000000..3a2e96934 --- /dev/null +++ b/src/Certify.Models/Hub/ManagedChallenge.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Certify.Models; + +namespace Certify.Models.Hub +{ + /// + /// Configuration for a managed challenge, such as a DNS challenge for a specific domain/zone + /// A managed challenge is one the management hub can complete on behalf of another ACME client + /// + public class ManagedChallenge + { + public ManagedChallenge() + { + Id = Guid.NewGuid().ToString(); + } + public string Id { get; set; } + public string Title { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string ItemType { get; set; } = string.Empty; + + public CertRequestChallengeConfig ChallengeConfig { get; set; } + } +} diff --git a/src/Certify.Models/API/Management/ManagedInstanceInfo.cs b/src/Certify.Models/Hub/ManagedInstanceInfo.cs similarity index 94% rename from src/Certify.Models/API/Management/ManagedInstanceInfo.cs rename to src/Certify.Models/Hub/ManagedInstanceInfo.cs index d0c1ef84f..38d199f5e 100644 --- a/src/Certify.Models/API/Management/ManagedInstanceInfo.cs +++ b/src/Certify.Models/Hub/ManagedInstanceInfo.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Certify.Models; -namespace Certify.API.Management +namespace Certify.Models.Hub { public class ManagedInstanceInfo { diff --git a/src/Certify.Models/API/Management/ManagementHubMessages.cs b/src/Certify.Models/Hub/ManagementHubMessages.cs similarity index 99% rename from src/Certify.Models/API/Management/ManagementHubMessages.cs rename to src/Certify.Models/Hub/ManagementHubMessages.cs index a2fc4f48d..f6cebc7d7 100644 --- a/src/Certify.Models/API/Management/ManagementHubMessages.cs +++ b/src/Certify.Models/Hub/ManagementHubMessages.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Certify.API.Management +namespace Certify.Models.Hub { public class ManagementHubMessages { diff --git a/src/Certify.Models/API/VersionInfo.cs b/src/Certify.Models/Hub/VersionInfo.cs similarity index 83% rename from src/Certify.Models/API/VersionInfo.cs rename to src/Certify.Models/Hub/VersionInfo.cs index 65e630d26..a8327f859 100644 --- a/src/Certify.Models/API/VersionInfo.cs +++ b/src/Certify.Models/Hub/VersionInfo.cs @@ -1,4 +1,4 @@ -namespace Certify.Models.API +namespace Certify.Models.Hub { public class VersionInfo { diff --git a/src/Certify.Server/Certify.Server.Api.Public.Client/Certify.API.Public.cs b/src/Certify.Server/Certify.Server.Api.Public.Client/Certify.API.Public.cs index c55f1ae1f..962b12550 100644 --- a/src/Certify.Server/Certify.Server.Api.Public.Client/Certify.API.Public.cs +++ b/src/Certify.Server/Certify.Server.Api.Public.Client/Certify.API.Public.cs @@ -9,9 +9,8 @@ using Certify.Models.Config; using Certify.Models.API; using Certify.Models.Providers; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; using Certify.Models.Config.Migration; -using Certify.API.Management; #pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." #pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." diff --git a/src/Certify.Server/Certify.Server.Api.Public.Client/nswag.json b/src/Certify.Server/Certify.Server.Api.Public.Client/nswag.json index afefcbf6e..6fe5e2669 100644 --- a/src/Certify.Server/Certify.Server.Api.Public.Client/nswag.json +++ b/src/Certify.Server/Certify.Server.Api.Public.Client/nswag.json @@ -52,9 +52,8 @@ "Certify.Models.Config", "Certify.Models.API", "Certify.Models.Providers", - "Certify.Models.Config.AccessControl", - "Certify.Models.Config.Migration", - "Certify.API.Management" + "Certify.Models.Hub", + "Certify.Models.Config.Migration" ], "additionalContractNamespaceUsages": [], "generateOptionalParameters": false, @@ -115,4 +114,4 @@ "newLineBehavior": "Auto" } } -} \ No newline at end of file +} diff --git a/src/Certify.Server/Certify.Server.Api.Public/Controllers/internal/HubController.cs b/src/Certify.Server/Certify.Server.Api.Public/Controllers/internal/HubController.cs index 86983db3f..b969a09e3 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Controllers/internal/HubController.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Controllers/internal/HubController.cs @@ -1,6 +1,5 @@ -using Certify.API.Management; -using Certify.Client; -using Certify.Models.API; +using Certify.Client; +using Certify.Models.Hub; using Certify.Server.Api.Public.SignalR.ManagementHub; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; diff --git a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/AuthController.cs b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/AuthController.cs index 60bceb3c1..18e9dac70 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/AuthController.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/AuthController.cs @@ -1,7 +1,7 @@ using System.Net.Http.Headers; using System.Security.Claims; using Certify.Client; -using Certify.Models.API; +using Certify.Models.Hub; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/CertificateController.cs b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/CertificateController.cs index 57005eef1..4ec2e7eab 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/CertificateController.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/CertificateController.cs @@ -1,5 +1,5 @@ using Certify.Client; -using Certify.Models.API; +using Certify.Models.Hub; using Certify.Models.Reporting; using Certify.Server.Api.Public.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; diff --git a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/SystemController.cs b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/SystemController.cs index b9dff4dcd..cee67f72e 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/SystemController.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Controllers/v1/SystemController.cs @@ -1,4 +1,5 @@ using Certify.Client; +using Certify.Models.Hub; using Microsoft.AspNetCore.Mvc; namespace Certify.Server.Api.Public.Controllers @@ -32,11 +33,11 @@ public SystemController(ILogger logger, ICertifyInternalApiCli /// [HttpGet] [Route("version")] - [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Models.API.VersionInfo))] + [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(VersionInfo))] public async Task GetSystemVersion() { var versionInfo = await _client.GetAppVersion(); - var result = new Models.API.VersionInfo { Version = versionInfo, Product = "Certify Management Hub" }; + var result = new Models.Hub.VersionInfo { Version = versionInfo, Product = "Certify Management Hub" }; return new OkObjectResult(result); } diff --git a/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementAPI.cs b/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementAPI.cs index f97adddf3..cd9b60a34 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementAPI.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementAPI.cs @@ -1,8 +1,7 @@ using System.Text.Json; -using Certify.API.Management; using Certify.Client; +using Certify.Models.Hub; using Certify.Models; -using Certify.Models.API; using Certify.Models.Config; using Certify.Models.Providers; using Certify.Models.Reporting; diff --git a/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementWorker.cs b/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementWorker.cs index d40563126..8f62d7a66 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementWorker.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/Services/ManagementWorker.cs @@ -1,4 +1,4 @@ -using Certify.API.Management; +using Certify.Models.Hub; using Certify.Server.Api.Public.SignalR.ManagementHub; using Microsoft.AspNetCore.SignalR; diff --git a/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementHub.cs b/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementHub.cs index d6058f7d4..8b8f47e6c 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementHub.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementHub.cs @@ -1,4 +1,4 @@ -using Certify.API.Management; +using Certify.Models.Hub; using Certify.Models.Reporting; using Microsoft.AspNetCore.SignalR; diff --git a/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementStateProvider.cs b/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementStateProvider.cs index 3e74e0ecc..a859aa7ef 100644 --- a/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementStateProvider.cs +++ b/src/Certify.Server/Certify.Server.Api.Public/SignalR/ManagementHub/InstanceManagementStateProvider.cs @@ -1,5 +1,5 @@ using System.Collections.Concurrent; -using Certify.API.Management; +using Certify.Models.Hub; using Certify.Models; using Certify.Models.Reporting; diff --git a/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/AccessController.cs b/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/AccessController.cs index fbdba67a4..d0b445726 100644 --- a/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/AccessController.cs +++ b/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/AccessController.cs @@ -1,6 +1,5 @@ -using Certify.Management; -using Certify.Models.API; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; +using Certify.Management; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Mvc; diff --git a/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/ManagedCertificateController.cs b/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/ManagedCertificateController.cs index 131f6dc6c..16ca6edcd 100644 --- a/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/ManagedCertificateController.cs +++ b/src/Certify.Server/Certify.Server.Core/Certify.Server.Core/Controllers/ManagedCertificateController.cs @@ -1,7 +1,7 @@ using Certify.Config; +using Certify.Models.Hub; using Certify.Management; using Certify.Models; -using Certify.Models.API; using Certify.Models.Config; using Certify.Models.Reporting; using Certify.Models.Utils; diff --git a/src/Certify.Service/Controllers/ManagedCertificateController.cs b/src/Certify.Service/Controllers/ManagedCertificateController.cs index 94a5b12ec..65785e2e7 100644 --- a/src/Certify.Service/Controllers/ManagedCertificateController.cs +++ b/src/Certify.Service/Controllers/ManagedCertificateController.cs @@ -5,9 +5,9 @@ using System.Web.Http; using System.Web.Http.Cors; using Certify.Config; +using Certify.Models.Hub; using Certify.Management; using Certify.Models; -using Certify.Models.API; using Certify.Models.Config; using Certify.Models.Reporting; using Certify.Models.Utils; diff --git a/src/Certify.Shared/Utils/NetworkUtils.cs b/src/Certify.Shared/Utils/NetworkUtils.cs index 271446f8a..24e56c838 100644 --- a/src/Certify.Shared/Utils/NetworkUtils.cs +++ b/src/Certify.Shared/Utils/NetworkUtils.cs @@ -7,6 +7,8 @@ using System.Net.Sockets; using System.Threading.Tasks; using Certify.Management; +using Certify.Models.API; + #if NET6_0_OR_GREATER using ARSoft.Tools.Net; using ARSoft.Tools.Net.Dns; @@ -157,7 +159,7 @@ public async Task CheckURL(ILog log, string url, bool? useProxyAPI = null) { var jsonText = await response.Content.ReadAsStringAsync(); - var result = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonText); + var result = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonText); if (result.IsAccessible == true) { diff --git a/src/Certify.Shared/Utils/Util.cs b/src/Certify.Shared/Utils/Util.cs index f8dd77318..44498ee31 100644 --- a/src/Certify.Shared/Utils/Util.cs +++ b/src/Certify.Shared/Utils/Util.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/src/Certify.SourceGenerators/ApiMethods.cs b/src/Certify.SourceGenerators/ApiMethods.cs index 30b1dd19d..4980bf857 100644 --- a/src/Certify.SourceGenerators/ApiMethods.cs +++ b/src/Certify.SourceGenerators/ApiMethods.cs @@ -82,8 +82,8 @@ public static List GetApiDefinitions() PublicAPIController = "Access", PublicAPIRoute = "validate", ServiceAPIRoute = "access/validate", - ReturnType = "Certify.Models.API.SecurityPrincipleCheckResponse", - Params = new Dictionary{{"passwordCheck", "Certify.Models.API.SecurityPrinciplePasswordCheck" } } + ReturnType = "Certify.Models.Hub.SecurityPrincipleCheckResponse", + Params = new Dictionary{{"passwordCheck", "Certify.Models.Hub.SecurityPrinciplePasswordCheck" } } }, new GeneratedAPI { @@ -94,7 +94,7 @@ public static List GetApiDefinitions() PublicAPIRoute = "updatepassword", ServiceAPIRoute = "access/updatepassword", ReturnType = "Models.Config.ActionResult", - Params = new Dictionary{{"passwordUpdate", "Certify.Models.API.SecurityPrinciplePasswordUpdate" } } + Params = new Dictionary{{"passwordUpdate", "Certify.Models.Hub.SecurityPrinciplePasswordUpdate" } } }, new GeneratedAPI { @@ -105,7 +105,7 @@ public static List GetApiDefinitions() PublicAPIRoute = "securityprinciple", ServiceAPIRoute = "access/securityprinciple", ReturnType = "Models.Config.ActionResult", - Params = new Dictionary{{"principle", "Certify.Models.Config.AccessControl.SecurityPrinciple" } } + Params = new Dictionary{{"principle", "Certify.Models.Hub.SecurityPrinciple" } } }, new GeneratedAPI { @@ -117,7 +117,7 @@ public static List GetApiDefinitions() ServiceAPIRoute = "access/securityprinciple/update", ReturnType = "Models.Config.ActionResult", Params = new Dictionary{ - { "principle", "Certify.Models.Config.AccessControl.SecurityPrinciple" } + { "principle", "Certify.Models.Hub.SecurityPrinciple" } } }, new GeneratedAPI { @@ -130,7 +130,7 @@ public static List GetApiDefinitions() ServiceAPIRoute = "access/securityprinciple/roles/update", ReturnType = "Models.Config.ActionResult", Params = new Dictionary{ - { "update", "Certify.Models.Config.AccessControl.SecurityPrincipleAssignedRoleUpdate" } + { "update", "Certify.Models.Hub.SecurityPrincipleAssignedRoleUpdate" } } }, new GeneratedAPI { diff --git a/src/Certify.SourceGenerators/PublicAPISourceGenerator.cs b/src/Certify.SourceGenerators/PublicAPISourceGenerator.cs index c330aeae5..493eaf5a5 100644 --- a/src/Certify.SourceGenerators/PublicAPISourceGenerator.cs +++ b/src/Certify.SourceGenerators/PublicAPISourceGenerator.cs @@ -67,7 +67,7 @@ private static void ImplementAppModel(GeneratorExecutionContext context, Generat using System.Threading.Tasks; using Certify.Models; using Certify.Models.Providers; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; namespace Certify.UI.Client.Core {{ @@ -95,7 +95,7 @@ private static void ImplementPublicAPI(GeneratorExecutionContext context, Genera using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Certify.Models; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; namespace Certify.Server.Api.Public.Controllers @@ -126,7 +126,7 @@ private static void ImplementInternalAPIClient(GeneratorExecutionContext context using Certify.Models; using Certify.Models.Config.Migration; using Certify.Models.Providers; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Certify.Tests/Certify.Core.Tests.Integration/DataStores/AccessControlDataStoreTests.cs b/src/Certify.Tests/Certify.Core.Tests.Integration/DataStores/AccessControlDataStoreTests.cs index ac1261907..55cbb39de 100644 --- a/src/Certify.Tests/Certify.Core.Tests.Integration/DataStores/AccessControlDataStoreTests.cs +++ b/src/Certify.Tests/Certify.Core.Tests.Integration/DataStores/AccessControlDataStoreTests.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Certify.Core.Management.Access; using Certify.Datastore.SQLite; -using Certify.Models.Config.AccessControl; +using Certify.Models.Hub; using Certify.Providers; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/AccessControlTests.cs b/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/AccessControlTests.cs index 1bc4a1339..e820ec5d3 100644 --- a/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/AccessControlTests.cs +++ b/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/AccessControlTests.cs @@ -4,8 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Certify.Core.Management.Access; +using Certify.Models.Hub; using Certify.Models; -using Certify.Models.Config.AccessControl; using Certify.Providers; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -413,7 +413,7 @@ public async Task TestUpdateSecurityPrinciplePassword() // Update security principle in AccessControl with a new password var newPassword = "GFEDCBA"; - var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.API.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword, newPassword)); + var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.Hub.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword, newPassword)); Assert.IsTrue(securityPrincipleUpdated, $"Expected security principle password update for {adminSecurityPrinciples[0].Id} to succeed"); // Validate password of SecurityPrinciple object returned by AccessControl.GetSecurityPrinciple() after update @@ -434,7 +434,7 @@ public async Task TestUpdateSecurityPrinciplePasswordNoRoles() // Update security principle in AccessControl with a new password var newPassword = "GFEDCBA"; - var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.API.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword, newPassword)); + var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.Hub.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword, newPassword)); Assert.IsFalse(securityPrincipleUpdated, $"Expected security principle password update for {adminSecurityPrinciples[0].Id} to fail without roles"); // Validate password of SecurityPrinciple object returned by AccessControl.GetSecurityPrinciple() after failed update @@ -470,7 +470,7 @@ public async Task TestUpdateSecurityPrinciplePasswordBadPassword() // Update security principle in AccessControl with a new password, but wrong original password var newPassword = "GFEDCBA"; - var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.API.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword.ToLower(), newPassword)); + var securityPrincipleUpdated = await access.UpdateSecurityPrinciplePassword(contextUserId, new Models.Hub.SecurityPrinciplePasswordUpdate(adminSecurityPrinciples[0].Id, firstPassword.ToLower(), newPassword)); Assert.IsFalse(securityPrincipleUpdated, $"Expected security principle password update for {adminSecurityPrinciples[0].Id} to fail with wrong password"); // Validate password of SecurityPrinciple object returned by AccessControl.GetSecurityPrinciple() after failed update @@ -739,7 +739,7 @@ public async Task TestSecurityPrinciplePwdValid() { // Add test devops user security principle _ = await access.AddSecurityPrinciple(contextUserId, TestSecurityPrinciples.DevopsUser, bypassIntegrityCheck: true); - var check = await access.CheckSecurityPrinciplePassword(contextUserId, new Models.API.SecurityPrinciplePasswordCheck(TestSecurityPrinciples.DevopsUser.Id, TestSecurityPrinciples.DevopsUser.Password)); + var check = await access.CheckSecurityPrinciplePassword(contextUserId, new Models.Hub.SecurityPrinciplePasswordCheck(TestSecurityPrinciples.DevopsUser.Id, TestSecurityPrinciples.DevopsUser.Password)); Assert.IsTrue(check.IsSuccess, "Password should be valid"); } @@ -749,7 +749,7 @@ public async Task TestSecurityPrinciplePwdInvalid() { // Add test devops user security principle _ = await access.AddSecurityPrinciple(contextUserId, TestSecurityPrinciples.DevopsUser, bypassIntegrityCheck: true); - var check = await access.CheckSecurityPrinciplePassword(contextUserId, new Models.API.SecurityPrinciplePasswordCheck(TestSecurityPrinciples.DevopsUser.Id, "INVALID_PWD")); + var check = await access.CheckSecurityPrinciplePassword(contextUserId, new Models.Hub.SecurityPrinciplePasswordCheck(TestSecurityPrinciples.DevopsUser.Id, "INVALID_PWD")); Assert.IsFalse(check.IsSuccess, "Password should not be valid"); } diff --git a/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/MiscTests.cs b/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/MiscTests.cs index 80bd0bc08..461fceb3e 100644 --- a/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/MiscTests.cs +++ b/src/Certify.Tests/Certify.Core.Tests.Unit/Tests/MiscTests.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Certify.Models.API; +using Certify.Models.Hub; using Certify.Shared.Core.Utils; using Certify.Shared.Core.Utils.PKI; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.ManagedCerticates.cs b/src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.ManagedCerticates.cs index 49d7f8f38..b0201450e 100644 --- a/src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.ManagedCerticates.cs +++ b/src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.ManagedCerticates.cs @@ -6,9 +6,9 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using Certify.Models.Hub; using Certify.Locales; using Certify.Models; -using Certify.Models.API; using Certify.Models.Reporting; using Certify.UI.Shared; using PropertyChanged;