Adds Argon2 for password protection (#123)
This commit is contained in:
parent
29467a3ed9
commit
dad8a64fad
54 changed files with 1152 additions and 167 deletions
|
|
@ -1,30 +0,0 @@
|
|||
using Xunit;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Tests.Accounting
|
||||
{
|
||||
public class PBKDF2PasswordProtectionTest
|
||||
{
|
||||
private const string plainPassword = "hello-good-sir";
|
||||
|
||||
[Fact]
|
||||
public void TestValidates()
|
||||
{
|
||||
var passwordProtection = new PBKDF2PasswordProtection();
|
||||
|
||||
string encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
||||
|
||||
Assert.True(passwordProtection.ValidatePassword(encryptedPassword, plainPassword));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestPasswordDoesNotValidate()
|
||||
{
|
||||
var passwordProtection = new PBKDF2PasswordProtection();
|
||||
|
||||
string encryptedPassword = passwordProtection.EncryptPassword(plainPassword);
|
||||
|
||||
Assert.False(passwordProtection.ValidatePassword(encryptedPassword, "Not the same password"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue