Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit e4b94de

Browse files
committed
Use Services.Common in WebhookClient
1 parent 6f4ae50 commit e4b94de

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

src/Web/WebhookClient/Extensions/Extensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public static IServiceCollection AddCustomAuthentication(this IServiceCollection
3535

3636
public static IServiceCollection AddHttpClientServices(this IServiceCollection services, IConfiguration configuration)
3737
{
38-
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
3938
services.AddTransient<HttpClientAuthorizationDelegatingHandler>();
40-
services.AddHttpClient("extendedhandlerlifetime").SetHandlerLifetime(Timeout.InfiniteTimeSpan);
4139

4240
//add http client services
4341
services.AddHttpClient("GrantClient")

src/Web/WebhookClient/GlobalUsings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
global using Microsoft.AspNetCore.Authentication.OpenIdConnect;
44
global using Microsoft.AspNetCore.Authorization;
55
global using Microsoft.AspNetCore.Mvc;
6-
global using System.Security.Claims;
76
global using System.Threading.Tasks;
87
global using Microsoft.Extensions.Logging;
98
global using Microsoft.Extensions.Options;
@@ -17,7 +16,7 @@
1716
global using Microsoft.AspNetCore.Http;
1817
global using System.Net.Http.Headers;
1918
global using System.Threading;
20-
global using Microsoft.AspNetCore;
19+
global using Services.Common;
2120
global using Microsoft.AspNetCore.Hosting;
2221
global using WebhookClient;
2322
global using Microsoft.AspNetCore.Builder;

src/Web/WebhookClient/Program.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var builder = WebApplication.CreateBuilder(args);
22

3+
builder.AddServiceDefaults();
34
builder.Services.AddSession(opt =>
45
{
56
opt.Cookie.Name = ".eShopWebhooks.Session";
@@ -12,18 +13,7 @@
1213
.AddMvc();
1314
builder.Services.AddControllers();
1415
var app = builder.Build();
15-
16-
var pathBase = app.Configuration["PATH_BASE"];
17-
if (!string.IsNullOrEmpty(pathBase))
18-
{
19-
app.UsePathBase(pathBase);
20-
}
21-
22-
if (!app.Environment.IsDevelopment())
23-
{
24-
app.UseExceptionHandler("/Error");
25-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
26-
}
16+
app.UseServiceDefaults();
2717

2818
app.Map("/check", capp =>
2919
{
@@ -62,7 +52,6 @@
6252

6353
app.UseStaticFiles();
6454
app.UseSession();
65-
app.UseRouting();
6655
app.UseAuthentication();
6756
app.UseAuthorization();
6857
app.MapDefaultControllerRoute();

src/Web/WebhookClient/WebhookClient.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" />
1818
</ItemGroup>
1919

20+
<ItemGroup>
21+
<ProjectReference Include="..\..\Services\Services.Common\Services.Common.csproj" />
22+
</ItemGroup>
23+
2024
</Project>

0 commit comments

Comments
 (0)