Skip to content

Commit

Permalink
Merge pull request #286 from sjkp/feature/nugetupgrade
Browse files Browse the repository at this point in the history
Feature/nugetupgrade
  • Loading branch information
sjkp authored Jan 13, 2019
2 parents 236934b + 6fcd8e1 commit 8e75857
Show file tree
Hide file tree
Showing 34 changed files with 644 additions and 305 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ azuredeploy.parameters.serviceplan.local.json
/Letsencrypt.Azure.Core.Test/unoeuro.json
.vs/
/LetsEncrypt.ResourceGroup/Templates/azuredeploy.acm.parameters.local.json
*.pubxml
Binary file not shown.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ WORKDIR /src
COPY LetsEncrypt.Azure.Core.V2 /src/LetsEncrypt.Azure.Core.V2
COPY Letsencrypt.Azure.Core.Test /src/Letsencrypt.Azure.Core.Test
COPY LetsEncrypt.Azure.Runner /src/LetsEncrypt.Azure.Runner
COPY DnsClient.NET /src/DnsClient.NET
COPY LetsEncrypt.Azure.DotNetCore.sln /src/LetsEncrypt.Azure.DotNetCore.sln


Expand Down
1 change: 1 addition & 0 deletions LetsEncrypt-SiteExtension.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{ED36B174
build.cmd = build.cmd
build.core.cmd = build.core.cmd
LetsEncrypt.nuspec = LetsEncrypt.nuspec
LetsEncrypt.SiteExtension.Core\LetsEncrypt.SiteExtension.Core.nuspec = LetsEncrypt.SiteExtension.Core\LetsEncrypt.SiteExtension.Core.nuspec
LetsEncrypt.WebAppOnly.nuspec = LetsEncrypt.WebAppOnly.nuspec
EndProjectSection
EndProject
Expand Down
36 changes: 13 additions & 23 deletions LetsEncrypt-SiteExtension/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using ARMExplorer.Controllers;
using ARMExplorer.Modules;
using LetsEncrypt.Azure.Core;
using LetsEncrypt.Azure.Core;
using LetsEncrypt.Azure.Core.Models;
using LetsEncrypt.SiteExtension.Models;
using Microsoft.Azure.Graph.RBAC;
using Microsoft.Azure.Graph.RBAC.Models;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Management.WebSites;
using Microsoft.Azure.Management.WebSites.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Azure.Authentication;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
Expand All @@ -35,13 +26,13 @@ public ActionResult Index()
}

[HttpPost]
public ActionResult Index(AuthenticationModel model)
public async Task<ActionResult> Index(AuthenticationModel model)
{
if (ModelState.IsValid)
{
try
{
using (var client = ArmHelper.GetWebSiteManagementClient(model))
using (var client = await ArmHelper.GetWebSiteManagementClient(model))
{
//Update web config.
var site = client.WebApps.GetSiteOrSlot(model.ResourceGroupName, model.WebAppName, model.SiteSlotName);
Expand Down Expand Up @@ -138,14 +129,14 @@ public ActionResult PleaseWait()
return View();
}

public ActionResult Hostname(string id)
public async Task<ActionResult> Hostname(string id)
{
var settings = new AppSettingsAuthConfig();
var model = new HostnameModel();
List<ValidationResult> validationResult = null;
if (settings.IsValid(out validationResult))
{
var client = ArmHelper.GetWebSiteManagementClient(settings);
var client = await ArmHelper.GetWebSiteManagementClient(settings);

var site = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
model.HostNames = site.HostNames;
Expand Down Expand Up @@ -183,10 +174,10 @@ public ActionResult Install()
);
}

private void SetViewBagHostnames()
private async Task SetViewBagHostnames()
{
var settings = new AppSettingsAuthConfig();
var client = ArmHelper.GetWebSiteManagementClient(settings);
var client = await ArmHelper.GetWebSiteManagementClient(settings);

var site = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
var model = new HostnameModel();
Expand Down Expand Up @@ -226,18 +217,18 @@ public async Task<ActionResult> Install(RequestAndInstallModel model)
PFXPassword = settings.PFXPassword,
RSAKeyLength = settings.RSAKeyLength,
};
var thumbprint = await new CertificateManager(settings).RequestAndInstallInternalAsync(target);
if (thumbprint != null)
return RedirectToAction("Hostname", new { id = thumbprint });
var certModel = await new CertificateManager(settings).RequestAndInstallInternalAsync(target);
if (certModel != null)
return RedirectToAction("Hostname", new { id = certModel.CertificateInfo.Certificate.Thumbprint });
}
SetViewBagHostnames();
return View(model);
}

public ActionResult AddHostname()
public async Task<ActionResult> AddHostname()
{
var settings = new AppSettingsAuthConfig();
using (var client = ArmHelper.GetWebSiteManagementClient(settings))
using (var client = await ArmHelper.GetWebSiteManagementClient(settings))
{
var s = client.WebApps.GetSiteOrSlot(settings.ResourceGroupName, settings.WebAppName, settings.SiteSlotName);
foreach (var hostname in settings.Hostnames)
Expand All @@ -246,8 +237,7 @@ public ActionResult AddHostname()
{
CustomHostNameDnsRecordType = CustomHostNameDnsRecordType.CName,
HostNameType = HostNameType.Verified,
SiteName = settings.WebAppName,
Location = s.Location
SiteName = settings.WebAppName,
});
}
}
Expand Down
Loading

0 comments on commit 8e75857

Please sign in to comment.