Files
server/test/Core.Test/Tokens/TestTokenable.cs
Matt Gibson 05ea5d5841 Improve DataProtectorTokenFactory test coverage (#1884)
* Add encstring to server

* Test factory

Co-authored-by: Carlos Muentes <cmuentes@bitwarden.com>

* Format

* Remove SymmetricKeyProtectedString

Not needed

* Set ForcInvalid

Co-authored-by: Carlos Muentes <cmuentes@bitwarden.com>
2022-02-24 14:26:12 -06:00

27 lines
637 B
C#

using System.Text.Json.Serialization;
using Bit.Core.Tokens;
namespace Bit.Core.Test.Tokens
{
public class TestTokenable : Tokenable
{
public bool ForceInvalid { get; set; } = false;
[JsonIgnore]
public override bool Valid => !ForceInvalid;
}
public class TestExpiringTokenable : ExpiringTokenable
{
private bool _forceInvalid;
public TestExpiringTokenable() : this(false) { }
public TestExpiringTokenable(bool forceInvalid)
{
_forceInvalid = forceInvalid;
}
protected override bool TokenIsValid() => !_forceInvalid;
}
}