Browse Source

Use Services.Common in WebhookClient

davidfowl/common-services
Reuben Bond 1 year ago
parent
commit
e4b94decb2
4 changed files with 7 additions and 17 deletions
  1. +0
    -2
      src/Web/WebhookClient/Extensions/Extensions.cs
  2. +1
    -2
      src/Web/WebhookClient/GlobalUsings.cs
  3. +2
    -13
      src/Web/WebhookClient/Program.cs
  4. +4
    -0
      src/Web/WebhookClient/WebhookClient.csproj

+ 0
- 2
src/Web/WebhookClient/Extensions/Extensions.cs View File

@ -35,9 +35,7 @@ internal static class Extensions
public static IServiceCollection AddHttpClientServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddTransient<HttpClientAuthorizationDelegatingHandler>();
services.AddHttpClient("extendedhandlerlifetime").SetHandlerLifetime(Timeout.InfiniteTimeSpan);
//add http client services
services.AddHttpClient("GrantClient")


+ 1
- 2
src/Web/WebhookClient/GlobalUsings.cs View File

@ -3,7 +3,6 @@ global using Microsoft.AspNetCore.Authentication.Cookies;
global using Microsoft.AspNetCore.Authentication.OpenIdConnect;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.Mvc;
global using System.Security.Claims;
global using System.Threading.Tasks;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
@ -17,7 +16,7 @@ global using System.Text.Json;
global using Microsoft.AspNetCore.Http;
global using System.Net.Http.Headers;
global using System.Threading;
global using Microsoft.AspNetCore;
global using Services.Common;
global using Microsoft.AspNetCore.Hosting;
global using WebhookClient;
global using Microsoft.AspNetCore.Builder;


+ 2
- 13
src/Web/WebhookClient/Program.cs View File

@ -1,5 +1,6 @@
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
builder.Services.AddSession(opt =>
{
opt.Cookie.Name = ".eShopWebhooks.Session";
@ -12,18 +13,7 @@ builder.Services.AddSession(opt =>
.AddMvc();
builder.Services.AddControllers();
var app = builder.Build();
var pathBase = app.Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
}
app.UseServiceDefaults();
app.Map("/check", capp =>
{
@ -62,7 +52,6 @@ app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMo
app.UseStaticFiles();
app.UseSession();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapDefaultControllerRoute();


+ 4
- 0
src/Web/WebhookClient/WebhookClient.csproj View File

@ -17,4 +17,8 @@
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Services\Services.Common\Services.Common.csproj" />
</ItemGroup>
</Project>

Loading…
Cancel
Save