Skip to content

Commit 81eba16

Browse files
committed
Update packages
1 parent b151ec3 commit 81eba16

File tree

11 files changed

+65
-129
lines changed

11 files changed

+65
-129
lines changed

DeviceFlowWeb/DeviceFlowWeb.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
1818
<PackageReference Include="IdentityModel" Version="7.0.0" />
1919
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
20-
<PackageReference Include="Serilog" Version="4.1.0" />
20+
2121
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
22-
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
23-
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
24-
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
25-
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
26-
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
22+
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
23+
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
24+
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
25+
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
26+
2727
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="1.0.0-preview.1" />
2828
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="1.0.0-preview.1" />
2929
<PackageReference Include="System.Text.Json" Version="9.0.0" />

StsServerIdentity/StsServerIdentity.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
2020
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
2121
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
22-
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
22+
2323
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0" />
2424
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
2525
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="9.0.0" />
@@ -31,5 +31,11 @@
3131
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="1.0.0-preview.1" />
3232
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="1.0.0-preview.1" />
3333
<PackageReference Include="System.Text.Json" Version="9.0.0" />
34+
35+
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
36+
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
37+
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
38+
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
39+
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
3440
</ItemGroup>
3541
</Project>

WebApi/Program.cs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,33 @@
1-
using Azure.Identity;
2-
using Serilog;
1+
using Serilog;
2+
using System.Globalization;
33
using WebApi;
44

55
Log.Logger = new LoggerConfiguration()
6-
.WriteTo.Console()
7-
.WriteTo.AzureApp()
6+
.WriteTo.Console(formatProvider: CultureInfo.InvariantCulture)
87
.CreateBootstrapLogger();
98

9+
Log.Information("Starting Web API provider server");
10+
1011
try
1112
{
12-
Log.Information("Starting WebApi");
13-
1413
var builder = WebApplication.CreateBuilder(args);
1514

16-
builder.WebHost
17-
.ConfigureKestrel(serverOptions => { serverOptions.AddServerHeader = false; })
18-
.ConfigureAppConfiguration((context, configurationBuilder) =>
19-
{
20-
var config = configurationBuilder.Build();
21-
var azureKeyVaultEndpoint = config["AzureKeyVaultEndpoint"];
22-
if (!string.IsNullOrEmpty(azureKeyVaultEndpoint))
23-
{
24-
// Add Secrets from KeyVault
25-
Log.Information("Use secrets from {AzureKeyVaultEndpoint}", azureKeyVaultEndpoint);
26-
configurationBuilder.AddAzureKeyVault(new Uri(azureKeyVaultEndpoint), new DefaultAzureCredential());
27-
}
28-
else
29-
{
30-
// Add Secrets from UserSecrets for local development
31-
configurationBuilder.AddUserSecrets("9f17b08c-435a-4f50-ba7a-802e68ca8d80");
32-
}
33-
});
34-
3515
builder.Host.UseSerilog((context, loggerConfiguration) => loggerConfiguration
16+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", formatProvider: CultureInfo.InvariantCulture)
3617
.ReadFrom.Configuration(context.Configuration));
3718

3819
var app = builder
3920
.ConfigureServices()
4021
.ConfigurePipeline();
4122

42-
app.Run();
23+
await app.RunAsync();
4324
}
44-
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException"
45-
&& ex.GetType().Name is not "HostAbortedException")
25+
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException" && ex.GetType().Name is not "HostAbortedException")
4626
{
4727
Log.Fatal(ex, "Unhandled exception");
4828
}
4929
finally
5030
{
5131
Log.Information("Shut down complete");
52-
Log.CloseAndFlush();
32+
await Log.CloseAndFlushAsync();
5333
}

WebApi/WebApi.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.2" />
2020
<PackageReference Include="Azure.Identity" Version="1.13.1" />
2121
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
22-
<PackageReference Include="Serilog" Version="4.1.0" />
22+
2323
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
2424
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
2525
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
2626
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
2727
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
28-
<PackageReference Include="Serilog.Sinks.AzureApp" Version="3.1.0" />
29-
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
28+
3029
<PackageReference Include="System.Text.Json" Version="9.0.0" />
3130
</ItemGroup>
3231

WebApi/appsettings.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
11
{
2-
"AzureKeyVaultEndpoint": null,
2+
"StsServer": "https://security-headers-sts.azurewebsites.net",
33
"Serilog": {
4-
"Using": [ "Serilog.Sinks.Console" ],
4+
"Using": [ "Serilog.Sinks.ApplicationInsights" ],
55
"MinimumLevel": {
66
"Default": "Information",
77
"Override": {
88
"Microsoft": "Information",
9-
"Microsoft.EntityFrameworkCore": "Warning",
109
"System": "Information"
1110
}
1211
},
1312
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
1413
"WriteTo": [
1514
{
16-
"Name": "Console",
15+
"Name": "ApplicationInsights",
1716
"Args": {
18-
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
19-
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} ({SourceContext}){NewLine}{Exception}"
17+
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"
2018
}
2119
},
2220
{
2321
"Name": "File",
2422
"Args": {
25-
"path": "../_logs-WebApi.txt",
23+
"path": "../../LogFiles/_logs-WebAPI.txt",
2624
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] [{EventId}] {Message}{NewLine}{Exception}",
2725
"rollOnFileSizeLimit": true,
2826
"fileSizeLimitBytes": 4194304,
2927
"retainedFileCountLimit": 5
3028
}
3129
}
3230
]
33-
},
34-
"StsServer": "https://security-headers-sts.azurewebsites.net"
31+
}
3532
}

WebCodeFlowPkceClient/Program.cs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,33 @@
1-
using Azure.Identity;
21
using Serilog;
2+
using System.Globalization;
33
using WebCodeFlowPkceClient;
44

55
Log.Logger = new LoggerConfiguration()
6-
.WriteTo.Console()
7-
.WriteTo.AzureApp()
6+
.WriteTo.Console(formatProvider: CultureInfo.InvariantCulture)
87
.CreateBootstrapLogger();
98

9+
Log.Information("Starting WebCodeFlowPkceClient provider server");
10+
1011
try
1112
{
12-
Log.Information("Starting WebHybridClient");
13-
1413
var builder = WebApplication.CreateBuilder(args);
1514

16-
builder.WebHost
17-
.ConfigureKestrel(serverOptions => { serverOptions.AddServerHeader = false; })
18-
.ConfigureAppConfiguration((context, configurationBuilder) =>
19-
{
20-
var config = configurationBuilder.Build();
21-
var azureKeyVaultEndpoint = config["AzureKeyVaultEndpoint"];
22-
if (!string.IsNullOrEmpty(azureKeyVaultEndpoint))
23-
{
24-
// Add Secrets from KeyVault
25-
Log.Information("Use secrets from {AzureKeyVaultEndpoint}", azureKeyVaultEndpoint);
26-
configurationBuilder.AddAzureKeyVault(new Uri(azureKeyVaultEndpoint), new DefaultAzureCredential());
27-
}
28-
else
29-
{
30-
// Add Secrets from UserSecrets for local development
31-
configurationBuilder.AddUserSecrets("4bd68e8b-ec2d-42d4-899f-fa77fcd14af5");
32-
}
33-
});
34-
3515
builder.Host.UseSerilog((context, loggerConfiguration) => loggerConfiguration
16+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", formatProvider: CultureInfo.InvariantCulture)
3617
.ReadFrom.Configuration(context.Configuration));
3718

3819
var app = builder
3920
.ConfigureServices()
4021
.ConfigurePipeline();
4122

42-
app.Run();
23+
await app.RunAsync();
4324
}
44-
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException"
45-
&& ex.GetType().Name is not "HostAbortedException")
25+
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException" && ex.GetType().Name is not "HostAbortedException")
4626
{
4727
Log.Fatal(ex, "Unhandled exception");
4828
}
4929
finally
5030
{
5131
Log.Information("Shut down complete");
52-
Log.CloseAndFlush();
32+
await Log.CloseAndFlushAsync();
5333
}

WebCodeFlowPkceClient/WebCodeFlowPkceClient.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
<PackageReference Include="Azure.Identity" Version="1.13.1" />
1717
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
1818
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
19-
<PackageReference Include="Serilog" Version="4.1.0" />
19+
2020
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
2121
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
2222
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
2323
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
2424
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
25-
<PackageReference Include="Serilog.Sinks.AzureApp" Version="3.1.0" />
26-
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
25+
2726
<PackageReference Include="System.Text.Json" Version="9.0.0" />
2827
</ItemGroup>
2928

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
{
22
"AzureKeyVaultEndpoint": null,
3+
"AllowedHosts": "*",
34
"Serilog": {
4-
"Using": [ "Serilog.Sinks.Console" ],
5+
"Using": [ "Serilog.Sinks.ApplicationInsights" ],
56
"MinimumLevel": {
67
"Default": "Information",
78
"Override": {
89
"Microsoft": "Information",
9-
"Microsoft.EntityFrameworkCore": "Warning",
1010
"System": "Information"
1111
}
1212
},
1313
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
1414
"WriteTo": [
1515
{
16-
"Name": "Console",
16+
"Name": "ApplicationInsights",
1717
"Args": {
18-
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
19-
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} ({SourceContext}){NewLine}{Exception}"
18+
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"
2019
}
2120
},
2221
{
2322
"Name": "File",
2423
"Args": {
25-
"path": "../_logs-WebCodeFlowPkceClient.txt",
24+
"path": "../../LogFiles/_logs-WebCodeFlowPkceClient.txt",
2625
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] [{EventId}] {Message}{NewLine}{Exception}",
2726
"rollOnFileSizeLimit": true,
2827
"fileSizeLimitBytes": 4194304,
2928
"retainedFileCountLimit": 5
3029
}
3130
}
3231
]
33-
},
34-
"AllowedHosts": "*"
32+
}
3533
}

WebHybridFlowClient/Program.cs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,33 @@
1-
using Azure.Identity;
2-
using Serilog;
1+
using Serilog;
2+
using System.Globalization;
33
using WebHybridFlowClient;
44

55
Log.Logger = new LoggerConfiguration()
6-
.WriteTo.Console()
7-
.WriteTo.AzureApp()
6+
.WriteTo.Console(formatProvider: CultureInfo.InvariantCulture)
87
.CreateBootstrapLogger();
98

9+
Log.Information("Starting WebHybridFlowClient provider server");
10+
1011
try
1112
{
12-
Log.Information("Starting WebHybridClient");
13-
1413
var builder = WebApplication.CreateBuilder(args);
1514

16-
builder.WebHost
17-
.ConfigureKestrel(serverOptions => { serverOptions.AddServerHeader = false; })
18-
.ConfigureAppConfiguration((context, configurationBuilder) =>
19-
{
20-
var config = configurationBuilder.Build();
21-
var azureKeyVaultEndpoint = config["AzureKeyVaultEndpoint"];
22-
if (!string.IsNullOrEmpty(azureKeyVaultEndpoint))
23-
{
24-
// Add Secrets from KeyVault
25-
Log.Information("Use secrets from {AzureKeyVaultEndpoint}", azureKeyVaultEndpoint);
26-
configurationBuilder.AddAzureKeyVault(new Uri(azureKeyVaultEndpoint), new DefaultAzureCredential());
27-
}
28-
else
29-
{
30-
// Add Secrets from UserSecrets for local development
31-
configurationBuilder.AddUserSecrets("81795b76-afe1-496b-bb97-8835d573e9c4");
32-
}
33-
});
34-
3515
builder.Host.UseSerilog((context, loggerConfiguration) => loggerConfiguration
16+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", formatProvider: CultureInfo.InvariantCulture)
3617
.ReadFrom.Configuration(context.Configuration));
3718

3819
var app = builder
3920
.ConfigureServices()
4021
.ConfigurePipeline();
4122

42-
app.Run();
23+
await app.RunAsync();
4324
}
44-
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException"
45-
&& ex.GetType().Name is not "HostAbortedException")
25+
catch (Exception ex) when (ex.GetType().Name is not "StopTheHostException" && ex.GetType().Name is not "HostAbortedException")
4626
{
4727
Log.Fatal(ex, "Unhandled exception");
4828
}
4929
finally
5030
{
5131
Log.Information("Shut down complete");
52-
Log.CloseAndFlush();
32+
await Log.CloseAndFlushAsync();
5333
}

WebHybridFlowClient/WebHybridFlowClient.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
<PackageReference Include="Azure.Identity" Version="1.13.1" />
1818
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
1919
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
20-
<PackageReference Include="Serilog" Version="4.1.0" />
20+
2121
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
2222
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
2323
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
2424
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
2525
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
26-
<PackageReference Include="Serilog.Sinks.AzureApp" Version="3.1.0" />
27-
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
26+
2827
<PackageReference Include="System.Text.Json" Version="9.0.0" />
2928
</ItemGroup>
3029

0 commit comments

Comments
 (0)