-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from swiss-ssi-group/net9
.NET 9
- Loading branch information
Showing
26 changed files
with
230 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<UserSecretsId>aspnet-IssuerDrivingLicense-825A2CCD-D7A7-4681-8552-A73D569859BF</UserSecretsId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" NoWarn="NU1605" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.9" NoWarn="NU1605" /> | ||
<PackageReference Include="Microsoft.Identity.Web" Version="2.13.1" /> | ||
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.13.1" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9"> | ||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" NoWarn="NU1605" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.0" NoWarn="NU1605" /> | ||
<PackageReference Include="Microsoft.Identity.Web" Version="3.5.0" /> | ||
<PackageReference Include="Microsoft.Identity.Web.UI" Version="3.5.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" /> | ||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" /> | ||
|
||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.9" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.8" /> | ||
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.20.0" /> | ||
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="0.20.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" /> | ||
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="1.0.0-preview.2" /> | ||
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="1.0.0-preview.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
3 changes: 1 addition & 2 deletions
3
IssuerDrivingLicense/Migrations/20230623080507_update-scheme.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,78 @@ | ||
namespace IssuerDrivingLicense; | ||
using System.Configuration; | ||
using IssuerDrivingLicense; | ||
using IssuerDrivingLicense.Persistence; | ||
using Microsoft.AspNetCore.Authentication.OpenIdConnect; | ||
using Microsoft.AspNetCore.Server.Kestrel.Core; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Identity.Web.UI; | ||
using Microsoft.Identity.Web; | ||
|
||
public class Program | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.WebHost.ConfigureKestrel(serverOptions => | ||
{ | ||
serverOptions.AddServerHeader = false; | ||
}); | ||
|
||
var services = builder.Services; | ||
var configuration = builder.Configuration; | ||
|
||
services.Configure<KestrelServerOptions>(options => | ||
{ | ||
options.AllowSynchronousIO = true; | ||
}); | ||
|
||
services.AddSecurityHeaderPolicies() | ||
.SetPolicySelector(ctx => SecurityHeadersDefinitions | ||
.GetHeaderPolicyCollection(builder.Environment.IsDevelopment())); | ||
|
||
services.Configure<CredentialSettings>(configuration.GetSection("CredentialSettings")); | ||
services.AddScoped<DriverLicenseService>(); | ||
services.AddScoped<IssuerService>(); | ||
|
||
services.AddDatabaseDeveloperPageExceptionFilter(); | ||
services.AddDbContext<DrivingLicenseDbContext>(options => | ||
options.UseSqlServer( | ||
configuration.GetConnectionString("DefaultConnection"))); | ||
|
||
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) | ||
.AddMicrosoftIdentityWebApp(configuration.GetSection("AzureAd")); | ||
|
||
services.AddAuthorization(options => | ||
{ | ||
options.FallbackPolicy = options.DefaultPolicy; | ||
}); | ||
|
||
services.AddDistributedMemoryCache(); | ||
|
||
services.AddRazorPages() | ||
.AddMvcOptions(options => { }) | ||
.AddMicrosoftIdentityUI(); | ||
|
||
services.AddRazorPages(); | ||
|
||
var app = builder.Build(); | ||
|
||
app.UseSecurityHeaders(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
else | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder | ||
.ConfigureKestrel(options => options.AddServerHeader = false) | ||
.UseStartup<Startup>(); | ||
}); | ||
app.UseExceptionHandler("/Error"); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseStaticFiles(); | ||
|
||
app.UseRouting(); | ||
|
||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
|
||
app.MapRazorPages(); | ||
app.MapControllers(); | ||
|
||
app.Run(); |
Oops, something went wrong.