Skip to content

Commit b0d93c3

Browse files
Port svc controller method for hub to net462
1 parent 454e7d6 commit b0d93c3

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

src/Certify.Service/Controllers/ManagedCertificateController.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,37 @@ public async Task<List<StatusMessage>> TestChallengeResponse(ManagedCertificate
9595
.CreateLogger())
9696
{
9797
var theLog = new Loggy(new Serilog.Extensions.Logging.SerilogLoggerFactory(log).CreateLogger<ManagedCertificatesController>());
98+
9899
var results = await _certifyManager.TestChallenge(theLog, managedCertificate, isPreviewMode: true, progress: progressIndicator);
99100

100101
return results;
101102
}
102103
}
103104

105+
[HttpPost, Route("challengecleanup")]
106+
public async Task<List<StatusMessage>> PerformChallengeCleanup(ManagedCertificate managedCertificate)
107+
{
108+
DebugLog();
109+
110+
var progressState = new RequestProgressState(RequestState.Running, "Performing Challenge Cleanup..", managedCertificate);
111+
112+
var progressIndicator = new Progress<RequestProgressState>(progressState.ProgressReport);
113+
114+
// perform challenge response test, log to string list and return in result
115+
var logList = new List<string>();
116+
using (var log = new LoggerConfiguration()
117+
118+
.WriteTo.Sink(new ProgressLogSink(progressIndicator, managedCertificate, _certifyManager))
119+
.CreateLogger())
120+
{
121+
var theLog = new Loggy(new Serilog.Extensions.Logging.SerilogLoggerFactory(log).CreateLogger<ManagedCertificatesController>());
122+
123+
var results = await _certifyManager.PerformChallengeCleanup(theLog, managedCertificate, progress: progressIndicator);
124+
125+
return results;
126+
}
127+
}
128+
104129
[HttpPost, Route("preview")]
105130
public async Task<List<ActionStep>> PreviewActions(ManagedCertificate site)
106131
{

src/Certify.Service/Controllers/SystemController.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Certify.Models;
77
using Certify.Models.Config;
88
using Certify.Models.Config.Migration;
9+
using Certify.Models.Hub;
910
using Certify.Shared;
1011

1112
namespace Certify.Service.Controllers
@@ -38,15 +39,6 @@ public async Task<UpdateCheck> PerformUpdateCheck()
3839
return await new Management.Util().CheckForUpdates();
3940
}
4041

41-
[HttpGet, Route("maintenance")]
42-
public async Task<string> PerformMaintenanceTasks()
43-
{
44-
DebugLog();
45-
46-
await _certifyManager.PerformCertificateCleanup();
47-
return "OK";
48-
}
49-
5042
[HttpGet, Route("diagnostics")]
5143
public async Task<List<Models.Config.ActionResult>> PerformServiceDiagnostics()
5244
{
@@ -105,5 +97,17 @@ public async Task<List<ActionStep>> TestDataStore(DataStoreConnection dataStore)
10597

10698
[HttpPost, Route("datastores/delete")]
10799
public async Task<List<ActionStep>> RemoveDataStore(string dataStoreId) => await _certifyManager.RemoveDataStoreConnection(dataStoreId);
100+
101+
[HttpPost, Route("hub/join")]
102+
public async Task<Models.Config.ActionResult> JoinManagementHub(HubJoiningClientSecret joiningClientSecret) => await _certifyManager.JoinManagementHub(joiningClientSecret.Url, new ClientSecret { ClientId = joiningClientSecret.ClientId, Secret = joiningClientSecret.Secret });
103+
104+
[HttpPost, Route("hub/checkcreds")]
105+
public async Task<Models.Config.ActionResult> CheckManagementHubCredentials(HubJoiningClientSecret joiningClientSecret) => await _certifyManager.CheckManagementHubCredentials(joiningClientSecret.Url, new ClientSecret { ClientId = joiningClientSecret.ClientId, Secret = joiningClientSecret.Secret });
106+
107+
[HttpGet, Route("hub/status")]
108+
public async Task<Models.Config.ActionResult> CheckManagementHubConnectionStatus() => await _certifyManager.CheckManagementHubConnectionStatus();
109+
110+
[HttpGet, Route("hub/info")]
111+
public async Task<HubInfo> GetHubInfo() => await _certifyManager.GetHubInfo();
108112
}
109113
}

0 commit comments

Comments
 (0)