1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-24 22:32:22 -05:00
bitwarden/src/Core/Entities/AuthRequest.cs
André Bispo bf4e039911
[PM-107] Remove fingerprint phase 2 (#2809)
* [PM-131] Remove fingerprint (#2759)

* [PM-107][PM-131] Remove fingerprint property from auth request

* [PM-107][PM-131] Remove fingerprint property from comparer

* [PM-132] Drop fingerprint phrase (#2803)

* [PM-132] Added migrations to remove fingerprint phrase from db

* [PM-132] Remove fp from stored procedures
2023-03-23 13:08:49 +00:00

42 lines
1.2 KiB
C#

using System.ComponentModel.DataAnnotations;
using Bit.Core.Utilities;
namespace Bit.Core.Entities;
public class AuthRequest : ITableObject<Guid>
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
public Enums.AuthRequestType Type { get; set; }
[MaxLength(50)]
public string RequestDeviceIdentifier { get; set; }
public Enums.DeviceType RequestDeviceType { get; set; }
[MaxLength(50)]
public string RequestIpAddress { get; set; }
public Guid? ResponseDeviceId { get; set; }
[MaxLength(25)]
public string AccessCode { get; set; }
public string PublicKey { get; set; }
public string Key { get; set; }
public string MasterPasswordHash { get; set; }
public bool? Approved { get; set; }
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
public DateTime? ResponseDate { get; set; }
public DateTime? AuthenticationDate { get; set; }
public void SetNewId()
{
Id = CoreHelpers.GenerateComb();
}
public bool IsSpent()
{
return ResponseDate.HasValue || AuthenticationDate.HasValue || GetExpirationDate() < DateTime.UtcNow;
}
public DateTime GetExpirationDate()
{
return CreationDate.AddMinutes(15);
}
}