Skip to content

Commit

Permalink
PM-3275 / PM-1196 - Removing SsoEmail2faSessionTokenable.cs changes +…
Browse files Browse the repository at this point in the history
… tests as I've handled that separately in a new PR (#3270) for newly created task PM-3925
  • Loading branch information
JaredSnider-Bitwarden committed Sep 14, 2023
1 parent 483ea38 commit bd0785e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,31 @@ namespace Bit.Core.Auth.Models.Business.Tokenables;
public class SsoEmail2faSessionTokenable : ExpiringTokenable
{
// Just over 2 min expiration (client expires session after 2 min)
private const double _tokenLifetimeInMinutes = 2.05;
public static TimeSpan GetTokenLifetime() => TimeSpan.FromMinutes(_tokenLifetimeInMinutes);

private static readonly TimeSpan _tokenLifetime = TimeSpan.FromMinutes(2.05);
public const string ClearTextPrefix = "BwSsoEmail2FaSessionToken_";
public const string DataProtectorPurpose = "SsoEmail2faSessionTokenDataProtector";

public const string TokenIdentifier = "SsoEmail2faSessionToken";

public string Identifier { get; set; } = TokenIdentifier;
public Guid Id { get; set; }
public string Email { get; set; }


[JsonConstructor]
public SsoEmail2faSessionTokenable()
{
ExpirationDate = DateTime.UtcNow.Add(GetTokenLifetime());
ExpirationDate = DateTime.UtcNow.Add(_tokenLifetime);
}

public SsoEmail2faSessionTokenable(User user) : this()
{
Id = user?.Id ?? default;
Email = user?.Email;
}

public bool TokenIsValid(User user)
{
if (Id == default || Email == default || user == null)
{
return false;
}

return Id == user.Id &&
Email.Equals(user.Email, StringComparison.InvariantCultureIgnoreCase);
}
Expand Down

This file was deleted.

0 comments on commit bd0785e

Please sign in to comment.