Updates webhook client project to .NET 6.0 (#1777)
* Included globalusing file for webhookclient * Included file scope namespaces for Webhookclient * Updated packages in WebHookClient project
This commit is contained in:
parent
f5c1af1535
commit
0823cb977d
@ -1,13 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
namespace WebhookClient.Controllers;
|
||||
|
||||
namespace WebhookClient.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
@ -34,4 +26,3 @@ namespace WebhookClient.Controllers
|
||||
new AuthenticationProperties { RedirectUri = homeUrl });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
using WebhookClient.Services;
|
||||
namespace WebhookClient.Controllers;
|
||||
|
||||
namespace WebhookClient.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("webhook-received")]
|
||||
public class WebhooksReceivedController : Controller
|
||||
@ -50,4 +42,3 @@ namespace WebhookClient.Controllers
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
src/Web/WebhookClient/GlobalUsings.cs
Normal file
27
src/Web/WebhookClient/GlobalUsings.cs
Normal file
@ -0,0 +1,27 @@
|
||||
global using Microsoft.AspNetCore.Authentication;
|
||||
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;
|
||||
global using System.Linq;
|
||||
global using WebhookClient.Models;
|
||||
global using WebhookClient.Services;
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Net.Http;
|
||||
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 Microsoft.AspNetCore.Hosting;
|
||||
global using WebhookClient;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using System.Net;
|
@ -1,7 +1,6 @@
|
||||
namespace WebhookClient
|
||||
{
|
||||
namespace WebhookClient;
|
||||
|
||||
static class HeaderNames
|
||||
{
|
||||
public const string WebHookCheckHeader = "X-eshop-whtoken";
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace WebhookClient;
|
||||
|
||||
namespace WebhookClient
|
||||
{
|
||||
public class HttpClientAuthorizationDelegatingHandler
|
||||
: DelegatingHandler
|
||||
{
|
||||
@ -46,4 +38,3 @@ namespace WebhookClient
|
||||
.GetTokenAsync(ACCESS_TOKEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace WebhookClient.Models;
|
||||
|
||||
namespace WebhookClient.Models
|
||||
{
|
||||
public class WebHookReceived
|
||||
{
|
||||
public DateTime When { get; set; }
|
||||
@ -10,4 +8,3 @@ namespace WebhookClient.Models
|
||||
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace WebhookClient.Models;
|
||||
|
||||
namespace WebhookClient.Models
|
||||
{
|
||||
public class WebhookData
|
||||
{
|
||||
public DateTime When { get; set; }
|
||||
@ -10,4 +8,3 @@ namespace WebhookClient.Models
|
||||
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
using System;
|
||||
namespace WebhookClient.Models;
|
||||
|
||||
namespace WebhookClient.Models
|
||||
{
|
||||
public class WebhookResponse
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
public string DestUrl { get; set; }
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace WebhookClient.Models
|
||||
{
|
||||
namespace WebhookClient.Models;
|
||||
|
||||
public class WebhookSubscriptionRequest
|
||||
{
|
||||
public string Url { get; set; }
|
||||
@ -7,4 +7,3 @@
|
||||
public string Event { get; set; }
|
||||
public string GrantUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using WebhookClient;
|
||||
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
|
||||
|
||||
IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
|
@ -1,12 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
namespace WebhookClient.Services;
|
||||
|
||||
namespace WebhookClient.Services
|
||||
{
|
||||
public interface IHooksRepository
|
||||
{
|
||||
Task<IEnumerable<WebHookReceived>> GetAll();
|
||||
Task AddNew(WebHookReceived hook);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
namespace WebhookClient.Services;
|
||||
|
||||
namespace WebhookClient.Services
|
||||
{
|
||||
public interface IWebhooksClient
|
||||
{
|
||||
Task<IEnumerable<WebhookResponse>> LoadWebhooks();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
namespace WebhookClient.Services;
|
||||
|
||||
namespace WebhookClient.Services
|
||||
{
|
||||
public class InMemoryHooksRepository : IHooksRepository
|
||||
{
|
||||
private readonly List<WebHookReceived> _data;
|
||||
@ -22,4 +17,3 @@ namespace WebhookClient.Services
|
||||
return Task.FromResult(_data.AsEnumerable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using WebhookClient.Models;
|
||||
using System.Text.Json;
|
||||
namespace WebhookClient.Services;
|
||||
|
||||
namespace WebhookClient.Services
|
||||
{
|
||||
public class WebhooksClient : IWebhooksClient
|
||||
{
|
||||
|
||||
@ -29,4 +22,3 @@ namespace WebhookClient.Services
|
||||
return subscriptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace WebhookClient
|
||||
{
|
||||
namespace WebhookClient;
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public string Token { get; set; }
|
||||
@ -11,4 +11,3 @@
|
||||
public bool ValidateToken { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using WebhookClient.Services;
|
||||
namespace WebhookClient;
|
||||
|
||||
namespace WebhookClient
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
@ -162,4 +147,3 @@ namespace WebhookClient
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0-preview.7.21378.6" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0-preview.7.21413.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user