1- using ARMExplorer . Controllers ;
2- using ARMExplorer . Modules ;
3- using LetsEncrypt . Azure . Core ;
1+ using LetsEncrypt . Azure . Core ;
42using LetsEncrypt . Azure . Core . Models ;
53using LetsEncrypt . SiteExtension . Models ;
6- using Microsoft . Azure . Graph . RBAC ;
7- using Microsoft . Azure . Graph . RBAC . Models ;
8- using Microsoft . Azure . Management . Resources ;
94using Microsoft . Azure . Management . WebSites ;
105using 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 ;
156using System ;
167using System . Collections . Generic ;
178using 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