remove autorenew feature as it wont work
Docker Build and Release Upload / build (push) Successful in 1m18s
Docker Build and Release Upload / build (push) Successful in 1m18s
This commit is contained in:
@@ -87,20 +87,6 @@ builder.Services.AddAuthentication(options => {
|
||||
OnMessageReceived = context => {
|
||||
context.Token = context.Request.Cookies[AuthJWT.TokenName];
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
OnTokenValidated = context => {
|
||||
var jwtToken = context.SecurityToken as JwtSecurityToken;
|
||||
if (jwtToken != null) {
|
||||
var exp = jwtToken.ValidTo;
|
||||
var now = DateTime.UtcNow;
|
||||
if ((exp - now) < TimeSpan.FromDays(3)) {
|
||||
int accountID = Convert.ToInt32(context.Principal?.FindFirst(ClaimTypes.NameIdentifier)?.Value);
|
||||
bool isPersistent = bool.Parse(context.Principal?.FindFirst(ClaimTypes.IsPersistent)?.Value);
|
||||
var newJWT = AuthJWT.GenereateJWTToken(accountID, isPersistent);
|
||||
AuthJWT.SignIn(context.HttpContext.Response, isPersistent, newJWT);
|
||||
}
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user