logger added
This commit is contained in:
@@ -8,11 +8,13 @@ public class JwtMiddleware
|
|||||||
{
|
{
|
||||||
private readonly IJwtService _jwtService;
|
private readonly IJwtService _jwtService;
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
|
private readonly ILogger<JwtMiddleware> _logger;
|
||||||
|
|
||||||
public JwtMiddleware(RequestDelegate next, IJwtService jwtService)
|
public JwtMiddleware(RequestDelegate next, IJwtService jwtService, ILogger<JwtMiddleware> logger)
|
||||||
{
|
{
|
||||||
_next = next;
|
_next = next;
|
||||||
_jwtService = jwtService;
|
_jwtService = jwtService;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Invoke(HttpContext context)
|
public async Task Invoke(HttpContext context)
|
||||||
@@ -32,7 +34,8 @@ public class JwtMiddleware
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
|
var token = context.Request.Headers.Authorization.FirstOrDefault()?.Split(" ").Last();
|
||||||
|
_logger.LogInformation(token);
|
||||||
if (token != null && _jwtService.ValidateJwtToken(token))
|
if (token != null && _jwtService.ValidateJwtToken(token))
|
||||||
{
|
{
|
||||||
await _next(context);
|
await _next(context);
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ using Microsoft.AspNetCore.Server.Kestrel.Https;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Logging.ClearProviders();
|
||||||
|
builder.Logging.AddConsole();
|
||||||
|
builder.Logging.AddDebug();
|
||||||
|
|
||||||
|
|
||||||
// Specify the paths to your certificate and key files
|
// Specify the paths to your certificate and key files
|
||||||
var certPath = Path.Combine(Directory.GetCurrentDirectory(), "cert.pem");
|
var certPath = Path.Combine(Directory.GetCurrentDirectory(), "cert.pem");
|
||||||
var keyPath = Path.Combine(Directory.GetCurrentDirectory(), "key.pem");
|
var keyPath = Path.Combine(Directory.GetCurrentDirectory(), "key.pem");
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("API")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e57b47cae362bcdd292021d92f19844516cd42b7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e4322649e4df45cec652c7098c929f725ff16bf")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("API")]
|
[assembly: System.Reflection.AssemblyProductAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("API")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
9dc91fd589f405d9b89d7ec2470007cfa5e9ff60c37dde9d153100048a5640aa
|
453ffda4295c5e0dce92614f7a406e66ffae57500f6c15603961c11cf348a009
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Application")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Application")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e57b47cae362bcdd292021d92f19844516cd42b7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e4322649e4df45cec652c7098c929f725ff16bf")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Application")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Application")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Application")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Application")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
bfe10c0d99ed763107935cd49c0577dc27e483b0ca9df238669535f4476770d5
|
6ca174afc35f5fdcc8715c5bb376cc554f09ba16eda6d67b7df7a3c0e062c344
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Core")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Core")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e57b47cae362bcdd292021d92f19844516cd42b7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e4322649e4df45cec652c7098c929f725ff16bf")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Core")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Core")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Core")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Core")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1731d862758ef82cd7c513bcb38bff73a1b5beb084a39b696fc298cd610107a4
|
06e566e120d8488e3dfc95d85e6805370c781d6c203b86c1b46ed0b55079aa4f
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e57b47cae362bcdd292021d92f19844516cd42b7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e4322649e4df45cec652c7098c929f725ff16bf")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Infrastructure")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
96f120a4c90b24741ae606108bd0d57fcdbef6caac17c6380670528a15f69c56
|
01fdf999d8e59aa323bab4cc85ea8512cc4d311b21dd98f5a7d79aa4a2c0dbd7
|
||||||
|
|||||||
Reference in New Issue
Block a user