Add tests and fixes to .well-known/openid-configuration and create realm
This commit is contained in:
parent
e07d6e3ea5
commit
d440979451
17 changed files with 642 additions and 45 deletions
|
|
@ -3,7 +3,7 @@ using IdentityShroud.Core.Model;
|
|||
|
||||
namespace IdentityShroud.Core.Tests.Model;
|
||||
|
||||
public class RealmTests
|
||||
public class KeyTests
|
||||
{
|
||||
[Fact]
|
||||
public void SetNewKey()
|
||||
|
|
@ -16,12 +16,12 @@ public class RealmTests
|
|||
.Encrypt(Arg.Any<byte[]>())
|
||||
.Returns(x => encryptedPrivateKey);
|
||||
|
||||
Realm realm = new();
|
||||
realm.SetPrivateKey(encryptionService, privateKey);
|
||||
Key key = new();
|
||||
key.SetPrivateKey(encryptionService, privateKey);
|
||||
|
||||
// should be able to return original without calling decrypt
|
||||
Assert.Equal(privateKey, realm.GetPrivateKey(encryptionService));
|
||||
Assert.Equal(encryptedPrivateKey, realm.PrivateKeyEncrypted);
|
||||
Assert.Equal(privateKey, key.GetPrivateKey(encryptionService));
|
||||
Assert.Equal(encryptedPrivateKey, key.PrivateKeyEncrypted);
|
||||
|
||||
encryptionService.Received(1).Encrypt(privateKey);
|
||||
encryptionService.DidNotReceive().Decrypt(Arg.Any<byte[]>());
|
||||
|
|
@ -38,12 +38,12 @@ public class RealmTests
|
|||
.Decrypt(encryptedPrivateKey)
|
||||
.Returns(x => privateKey);
|
||||
|
||||
Realm realm = new();
|
||||
realm.PrivateKeyEncrypted = encryptedPrivateKey;
|
||||
Key key = new();
|
||||
key.PrivateKeyEncrypted = encryptedPrivateKey;
|
||||
|
||||
// should be able to return original without calling decrypt
|
||||
Assert.Equal(privateKey, realm.GetPrivateKey(encryptionService));
|
||||
Assert.Equal(encryptedPrivateKey, realm.PrivateKeyEncrypted);
|
||||
Assert.Equal(privateKey, key.GetPrivateKey(encryptionService));
|
||||
Assert.Equal(encryptedPrivateKey, key.PrivateKeyEncrypted);
|
||||
|
||||
encryptionService.Received(1).Decrypt(encryptedPrivateKey);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue