token ValidFrom

master
Tudor Stanciu 2020-12-25 01:08:20 +02:00
parent cc6784b073
commit ee13545e61
3 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,9 @@ namespace IdentityServer.Application.Services
return null; return null;
var tokenRaw = $"{Guid.NewGuid()}-{Guid.NewGuid()}-{user.UserId}"; var tokenRaw = $"{Guid.NewGuid()}-{Guid.NewGuid()}-{user.UserId}";
var token = new Token() { Raw = tokenRaw, ValidUntil = DateTime.Now.AddMonths(12) };
var currentDate = DateTime.Now;
var token = new Token() { Raw = tokenRaw, ValidFrom = currentDate, ValidUntil = currentDate.AddMonths(12) };
_securityStore.SetToken(token, user.UserId); _securityStore.SetToken(token, user.UserId);
return token; return token;

View File

@ -5,6 +5,7 @@ namespace IdentityServer.Domain.Models
public class Token public class Token
{ {
public string Raw { get; set; } public string Raw { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime ValidUntil { get; set; } public DateTime ValidUntil { get; set; }
} }
} }

View File

@ -5,6 +5,7 @@ namespace IdentityServer.PublishedLanguage.Dto
public class Token public class Token
{ {
public string Raw { get; set; } public string Raw { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime ValidUntil { get; set; } public DateTime ValidUntil { get; set; }
} }
} }