Skip to content

Commit 8e75857

Browse files
authored
Merge pull request #286 from sjkp/feature/nugetupgrade
Feature/nugetupgrade
2 parents 236934b + 6fcd8e1 commit 8e75857

34 files changed

+644
-305
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ azuredeploy.parameters.serviceplan.local.json
4949
/Letsencrypt.Azure.Core.Test/unoeuro.json
5050
.vs/
5151
/LetsEncrypt.ResourceGroup/Templates/azuredeploy.acm.parameters.local.json
52+
*.pubxml
Binary file not shown.

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ WORKDIR /src
66
COPY LetsEncrypt.Azure.Core.V2 /src/LetsEncrypt.Azure.Core.V2
77
COPY Letsencrypt.Azure.Core.Test /src/Letsencrypt.Azure.Core.Test
88
COPY LetsEncrypt.Azure.Runner /src/LetsEncrypt.Azure.Runner
9-
COPY DnsClient.NET /src/DnsClient.NET
109
COPY LetsEncrypt.Azure.DotNetCore.sln /src/LetsEncrypt.Azure.DotNetCore.sln
1110

1211

LetsEncrypt-SiteExtension.sln

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{ED36B174
1818
build.cmd = build.cmd
1919
build.core.cmd = build.core.cmd
2020
LetsEncrypt.nuspec = LetsEncrypt.nuspec
21+
LetsEncrypt.SiteExtension.Core\LetsEncrypt.SiteExtension.Core.nuspec = LetsEncrypt.SiteExtension.Core\LetsEncrypt.SiteExtension.Core.nuspec
2122
LetsEncrypt.WebAppOnly.nuspec = LetsEncrypt.WebAppOnly.nuspec
2223
EndProjectSection
2324
EndProject

LetsEncrypt-SiteExtension/Controllers/HomeController.cs

+13-23
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
using ARMExplorer.Controllers;
2-
using ARMExplorer.Modules;
3-
using LetsEncrypt.Azure.Core;
1+
using LetsEncrypt.Azure.Core;
42
using LetsEncrypt.Azure.Core.Models;
53
using LetsEncrypt.SiteExtension.Models;
6-
using Microsoft.Azure.Graph.RBAC;
7-
using Microsoft.Azure.Graph.RBAC.Models;
8-
using Microsoft.Azure.Management.Resources;
94
using Microsoft.Azure.Management.WebSites;
105
using Microsoft.Azure.Management.WebSites.Models;
11-
using Microsoft.IdentityModel.Clients.ActiveDirectory;
12-
using Microsoft.Rest;
13-
using Microsoft.Rest.Azure;
14-
using Microsoft.Rest.Azure.Authentication;
156
using System;
167
using System.Collections.Generic;
178
using System.ComponentModel.DataAnnotations;
@@ -35,13 +26,13 @@ public ActionResult Index()
3526
}
3627

3728
[HttpPost]
38-
public ActionResult Index(AuthenticationModel model)
29+
public async Task<ActionResult> Index(AuthenticationModel model)
3930
{
4031
if (ModelState.IsValid)
4132
{
4233
try
4334
{
44-
using (var client = ArmHelper.GetWebSiteManagementClient(model))
35+
using (var client = await ArmHelper.GetWebSiteManagementClient(model))
4536
{
4637
//Update web config.
4738
var site = client.WebApps.GetSiteOrSlot(model.ResourceGroupName, model.WebAppName, model.SiteSlotName);
@@ -138,14 +129,14 @@ public ActionResult PleaseWait()
138129
return View();
139130
}
140131

141-
public ActionResult Hostname(string id)
132+
public async Task<ActionResult> Hostname(string id)
142133
{
143134
var settings = new AppSettingsAuthConfig();
144135
var model = new HostnameModel();
145136
List<ValidationResult> validationResult = null;
146137
if (settings.IsValid(out validationResult))
147138
{
148-
var client = ArmHelper.GetWebSiteManagementClient(settings);
139+
var client = await ArmHelper.GetWebSiteManagementClient(settings);
149140

150141
var site = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
151142
model.HostNames = site.HostNames;
@@ -183,10 +174,10 @@ public ActionResult Install()
183174
);
184175
}
185176

186-
private void SetViewBagHostnames()
177+
private async Task SetViewBagHostnames()
187178
{
188179
var settings = new AppSettingsAuthConfig();
189-
var client = ArmHelper.GetWebSiteManagementClient(settings);
180+
var client = await ArmHelper.GetWebSiteManagementClient(settings);
190181

191182
var site = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
192183
var model = new HostnameModel();
@@ -226,18 +217,18 @@ public async Task<ActionResult> Install(RequestAndInstallModel model)
226217
PFXPassword = settings.PFXPassword,
227218
RSAKeyLength = settings.RSAKeyLength,
228219
};
229-
var thumbprint = await new CertificateManager(settings).RequestAndInstallInternalAsync(target);
230-
if (thumbprint != null)
231-
return RedirectToAction("Hostname", new { id = thumbprint });
220+
var certModel = await new CertificateManager(settings).RequestAndInstallInternalAsync(target);
221+
if (certModel != null)
222+
return RedirectToAction("Hostname", new { id = certModel.CertificateInfo.Certificate.Thumbprint });
232223
}
233224
SetViewBagHostnames();
234225
return View(model);
235226
}
236227

237-
public ActionResult AddHostname()
228+
public async Task<ActionResult> AddHostname()
238229
{
239230
var settings = new AppSettingsAuthConfig();
240-
using (var client = ArmHelper.GetWebSiteManagementClient(settings))
231+
using (var client = await ArmHelper.GetWebSiteManagementClient(settings))
241232
{
242233
var s = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
243234
foreach (var hostname in settings.Hostnames)
@@ -246,8 +237,7 @@ public ActionResult AddHostname()
246237
{
247238
CustomHostNameDnsRecordType = CustomHostNameDnsRecordType.CName,
248239
HostNameType = HostNameType.Verified,
249-
SiteName = settings.WebAppName,
250-
Location = s.Location
240+
SiteName = settings.WebAppName,
251241
});
252242
}
253243
}

0 commit comments

Comments
 (0)