mirror of
https://github.com/bitwarden/server.git
synced 2024-12-01 13:43:23 +01:00
e2c6fc81f4
* Implement draft token service * Add tokenizer and factory * Handle expiring tokens through base class * Allow direct token validity checks * Add safe unprotect to tokenizer * Add interface to tokenizer factory * Use tokenizer * Fix rebase * Handle cleartext prefix in tokenizer base * Use epoch milliseconds for expiration in tokens * Use tokenizers * Test tokens * Linter fixes * Add TokenizerFactory to DI services * Test epoch milliseconds deserialization * Use separate injectables for each token type * Fix directory * Add functional unprotect to token * Fix namespace and correct object names * Remove Tokenable interface * Test remaining Tokens classes * Dotnet format * Fix sut provider errors with update * Remove useless property Co-authored-by: Hinton <oscar@oscarhinton.com>
23 lines
512 B
C#
23 lines
512 B
C#
using Bit.Core.Tokens;
|
|
|
|
namespace Bit.Core.Test.Tokens
|
|
{
|
|
public class TestTokenable : Tokenable
|
|
{
|
|
public override bool Valid => true;
|
|
}
|
|
|
|
public class TestExpiringTokenable : ExpiringTokenable
|
|
{
|
|
private bool _forceInvalid;
|
|
|
|
public TestExpiringTokenable() : this(false) { }
|
|
|
|
public TestExpiringTokenable(bool forceInvalid)
|
|
{
|
|
_forceInvalid = forceInvalid;
|
|
}
|
|
protected override bool TokenIsValid() => !_forceInvalid;
|
|
}
|
|
}
|