1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-06 18:42:49 -05:00

updates for license validation

This commit is contained in:
Kyle Spearrin
2017-08-14 13:06:44 -04:00
parent 18cbc79dd2
commit 6b80ec6331
9 changed files with 140 additions and 25 deletions

View File

@ -65,6 +65,28 @@ namespace Bit.Core.Models.Business
return Encoding.UTF8.GetBytes(data);
}
public bool CanUse(User user)
{
if(Issued > DateTime.UtcNow)
{
return false;
}
if(Expires < DateTime.UtcNow)
{
return false;
}
if(Version == 1)
{
return user.Email.Equals(Email, StringComparison.InvariantCultureIgnoreCase);
}
else
{
throw new NotSupportedException($"Version {Version} is not supported.");
}
}
public bool VerifyData(User user)
{
if(Issued > DateTime.UtcNow)