session
This commit is contained in:
parent
baea64229b
commit
0dc41337da
36 changed files with 324 additions and 95 deletions
19
Femto.Modules.Auth/Models/UserSession.cs
Normal file
19
Femto.Modules.Auth/Models/UserSession.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
namespace Femto.Modules.Auth.Models;
|
||||
|
||||
public class UserSession
|
||||
{
|
||||
private static TimeSpan SessionTimeout = TimeSpan.FromMinutes(30);
|
||||
public string Id { get; private set; }
|
||||
public DateTimeOffset Expires { get; private set; }
|
||||
|
||||
private UserSession() {}
|
||||
|
||||
public static UserSession Create()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Id = Convert.ToBase64String(System.Security.Cryptography.RandomNumberGenerator.GetBytes(32)),
|
||||
Expires = DateTimeOffset.Now + SessionTimeout
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue