commit
This commit is contained in:
parent
a5dd73d8f0
commit
0e7c5edef3
@ -36,6 +36,12 @@
|
|||||||
|
|
||||||
// Dodaj token do nagłówka Authorization
|
// Dodaj token do nagłówka Authorization
|
||||||
context.Request.Headers["Authorization"] = $"Bearer {token}";
|
context.Request.Headers["Authorization"] = $"Bearer {token}";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
context.Session.Remove("AccessToken");
|
||||||
|
context.Session.Remove("RefreshToken");
|
||||||
|
context.Session.Remove("TokenExpiration");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _next(context);
|
await _next(context);
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
@ -80,4 +81,9 @@ app.MapControllerRoute(
|
|||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|
||||||
|
//app.Use(async (context, next) =>
|
||||||
|
//{
|
||||||
|
//// await context.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
// await next();
|
||||||
|
//});
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user