1
- using ARMExplorer . Controllers ;
2
- using ARMExplorer . Modules ;
3
- using LetsEncrypt . Azure . Core ;
1
+ using LetsEncrypt . Azure . Core ;
4
2
using LetsEncrypt . Azure . Core . Models ;
5
3
using LetsEncrypt . SiteExtension . Models ;
6
- using Microsoft . Azure . Graph . RBAC ;
7
- using Microsoft . Azure . Graph . RBAC . Models ;
8
- using Microsoft . Azure . Management . Resources ;
9
4
using Microsoft . Azure . Management . WebSites ;
10
5
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 ;
15
6
using System ;
16
7
using System . Collections . Generic ;
17
8
using System . ComponentModel . DataAnnotations ;
@@ -35,13 +26,13 @@ public ActionResult Index()
35
26
}
36
27
37
28
[ HttpPost ]
38
- public ActionResult Index ( AuthenticationModel model )
29
+ public async Task < ActionResult > Index ( AuthenticationModel model )
39
30
{
40
31
if ( ModelState . IsValid )
41
32
{
42
33
try
43
34
{
44
- using ( var client = ArmHelper . GetWebSiteManagementClient ( model ) )
35
+ using ( var client = await ArmHelper . GetWebSiteManagementClient ( model ) )
45
36
{
46
37
//Update web config.
47
38
var site = client . WebApps . GetSiteOrSlot ( model . ResourceGroupName , model . WebAppName , model . SiteSlotName ) ;
@@ -138,14 +129,14 @@ public ActionResult PleaseWait()
138
129
return View ( ) ;
139
130
}
140
131
141
- public ActionResult Hostname ( string id )
132
+ public async Task < ActionResult > Hostname ( string id )
142
133
{
143
134
var settings = new AppSettingsAuthConfig ( ) ;
144
135
var model = new HostnameModel ( ) ;
145
136
List < ValidationResult > validationResult = null ;
146
137
if ( settings . IsValid ( out validationResult ) )
147
138
{
148
- var client = ArmHelper . GetWebSiteManagementClient ( settings ) ;
139
+ var client = await ArmHelper . GetWebSiteManagementClient ( settings ) ;
149
140
150
141
var site = client . WebApps . GetSiteOrSlot ( settings . ResourceGroupName , settings . WebAppName , settings . SiteSlotName ) ;
151
142
model . HostNames = site . HostNames ;
@@ -183,10 +174,10 @@ public ActionResult Install()
183
174
) ;
184
175
}
185
176
186
- private void SetViewBagHostnames ( )
177
+ private async Task SetViewBagHostnames ( )
187
178
{
188
179
var settings = new AppSettingsAuthConfig ( ) ;
189
- var client = ArmHelper . GetWebSiteManagementClient ( settings ) ;
180
+ var client = await ArmHelper . GetWebSiteManagementClient ( settings ) ;
190
181
191
182
var site = client . WebApps . GetSiteOrSlot ( settings . ResourceGroupName , settings . WebAppName , settings . SiteSlotName ) ;
192
183
var model = new HostnameModel ( ) ;
@@ -226,18 +217,18 @@ public async Task<ActionResult> Install(RequestAndInstallModel model)
226
217
PFXPassword = settings . PFXPassword ,
227
218
RSAKeyLength = settings . RSAKeyLength ,
228
219
} ;
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 } ) ;
232
223
}
233
224
SetViewBagHostnames ( ) ;
234
225
return View ( model ) ;
235
226
}
236
227
237
- public ActionResult AddHostname ( )
228
+ public async Task < ActionResult > AddHostname ( )
238
229
{
239
230
var settings = new AppSettingsAuthConfig ( ) ;
240
- using ( var client = ArmHelper . GetWebSiteManagementClient ( settings ) )
231
+ using ( var client = await ArmHelper . GetWebSiteManagementClient ( settings ) )
241
232
{
242
233
var s = client . WebApps . GetSiteOrSlot ( settings . ResourceGroupName , settings . WebAppName , settings . SiteSlotName ) ;
243
234
foreach ( var hostname in settings . Hostnames )
@@ -246,8 +237,7 @@ public ActionResult AddHostname()
246
237
{
247
238
CustomHostNameDnsRecordType = CustomHostNameDnsRecordType . CName ,
248
239
HostNameType = HostNameType . Verified ,
249
- SiteName = settings . WebAppName ,
250
- Location = s . Location
240
+ SiteName = settings . WebAppName ,
251
241
} ) ;
252
242
}
253
243
}
0 commit comments