Skip to content

Commit

Permalink
Update the ASP.NET Core samples to use Kestrel as the default HTTP se…
Browse files Browse the repository at this point in the history
…rver
  • Loading branch information
kevinchalet committed Apr 11, 2024
1 parent 9d0eca3 commit 61b355f
Show file tree
Hide file tree
Showing 28 changed files with 237 additions and 182 deletions.
16 changes: 9 additions & 7 deletions samples/Aridka/Aridka.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52698/",
"applicationUrl": "https://localhost:44385/",
"sslPort": 44385
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:44385/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Aridka.Server": {
"commandName": "Project",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:44385/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public async Task<IActionResult> Authorize()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
Expand Down Expand Up @@ -236,7 +236,7 @@ public async Task<IActionResult> Accept()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
Expand Down Expand Up @@ -336,7 +336,7 @@ public async Task<IActionResult> Exchange()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

identity.SetDestinations(GetDestinations);

Expand Down
48 changes: 25 additions & 23 deletions samples/Balosar/Balosar.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51818/",
"sslPort": 44310
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44310/",
"sslPort": 44310
}
},

"profiles": {
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:44310/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Balosar.Server": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:44310/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<IActionResult> OnGetAsync()
properties: new AuthenticationProperties
{
RedirectUri = Request.PathBase + Request.Path + QueryString.Create(
Request.HasFormContentType ? Request.Form.ToList() : Request.Query.ToList())
Request.HasFormContentType ? [.. Request.Form] : [.. Request.Query])
});
}

Expand Down
15 changes: 8 additions & 7 deletions samples/Contruum/Contruum.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:16181",
"applicationUrl": "https://localhost:44323/",
"sslPort": 44323
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:44323/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Contruum.Server": {
"commandName": "Project",
"dotnetRunMessages": "true",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:44323/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
18 changes: 10 additions & 8 deletions samples/Dantooine/Dantooine.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@
"sslPort": 44343
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:44343/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dantooine.Api": {
"commandName": "Project",
"launchBrowser": false,
"applicationUrl": "https://localhost:44343/",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public async Task<IActionResult> Authorize()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
Expand Down Expand Up @@ -236,7 +236,7 @@ public async Task<IActionResult> Accept()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
Expand Down Expand Up @@ -336,7 +336,7 @@ public async Task<IActionResult> Exchange()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

identity.SetDestinations(GetDestinations);

Expand Down
23 changes: 11 additions & 12 deletions samples/Dantooine/Dantooine.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,23 @@
"sslPort": 44319
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:44319/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dantooine.Server": {
"commandName": "Project",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:44319/"
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@
"sslPort": 44348
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:44348/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
},
"Dantooine.WebAssembly.Server": {
"commandName": "Project",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:44348/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
5 changes: 3 additions & 2 deletions samples/Fornax/Fornax.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63303/",
"applicationUrl": "https://localhost:44387/",
"sslPort": 44387
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
Expand All @@ -16,4 +17,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task<IActionResult> Exchange()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Set the list of scopes granted to the client application.
identity.SetScopes(new[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58795/",
"applicationUrl": "https://localhost:44360/",
"sslPort": 44360
}
},

"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"Kestrel": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:44360/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Hollastin.Server": {
"commandName": "Project",

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:44360/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task<IActionResult> Exchange()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task<IActionResult> Exchange()
.SetClaim(Claims.Email, await _userManager.GetEmailAsync(user))
.SetClaim(Claims.Name, await _userManager.GetUserNameAsync(user))
.SetClaim(Claims.PreferredUsername, await _userManager.GetUserNameAsync(user))
.SetClaims(Claims.Role, (await _userManager.GetRolesAsync(user)).ToImmutableArray());
.SetClaims(Claims.Role, [.. (await _userManager.GetRolesAsync(user))]);

identity.SetDestinations(GetDestinations);

Expand Down

0 comments on commit 61b355f

Please sign in to comment.