remember me
This commit is contained in:
parent
dac3acfecf
commit
8629883f88
10 changed files with 278 additions and 96 deletions
|
@ -4,11 +4,13 @@ namespace Femto.Modules.Auth.Models;
|
|||
|
||||
public class Session(Guid userId, bool isStrong)
|
||||
{
|
||||
private static readonly TimeSpan ValidityPeriod = TimeSpan.FromSeconds(5);
|
||||
private static readonly TimeSpan RefreshBuffer = TimeSpan.FromMinutes(0);
|
||||
public string Id { get; } = Convert.ToBase64String(GetBytes(32));
|
||||
public Guid UserId { get; } = userId;
|
||||
public DateTimeOffset Expires { get; } = DateTimeOffset.UtcNow + TimeSpan.FromMinutes(15);
|
||||
public DateTimeOffset Expires { get; } = DateTimeOffset.UtcNow + ValidityPeriod;
|
||||
|
||||
public bool ExpiresSoon => this.Expires < DateTimeOffset.UtcNow + TimeSpan.FromMinutes(5);
|
||||
public bool ExpiresSoon => this.Expires < DateTimeOffset.UtcNow + RefreshBuffer;
|
||||
public bool IsStronglyAuthenticated { get; } = isStrong;
|
||||
public bool IsExpired => this.Expires < DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue