Skip to content

Commit a89ce29

Browse files
validation
1 parent 8d07ee4 commit a89ce29

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

‎test-server/net-v2-v3-server/Controllers/ClientController.cs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ public IActionResult CreateClient([FromBody] ClientRequest request)
1919
var enableLegacyWrappingAlgorithms = request.Config.EnableLegacyWrappingAlgorithms;
2020
var encryptionContext = request.Config.EncryptionContext;
2121

22-
if (string.IsNullOrEmpty(kmsKeyId))
23-
{
24-
return BadRequest(new GenericServerError
25-
{
26-
Message = "KMS Key ID is required"
27-
});
28-
}
29-
3022
try
3123
{
3224
var encryptionMaterial = new EncryptionMaterialsV2(kmsKeyId, KmsType.KmsContext, encryptionContext);

‎test-server/net-v2-v3-server/Models/ClientRequest.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using System.ComponentModel.DataAnnotations;
2+
13
namespace NetV2V3Server.Models;
24

35
public class ClientRequest
46
{
7+
[Required]
58
public ClientConfig Config { get; set; } = new();
69
}
710

@@ -10,10 +13,12 @@ public class ClientConfig
1013
public Dictionary<string, string> EncryptionContext { get; set; } = new();
1114
public bool EnableLegacyUnauthenticatedModes { get; set; }
1215
public bool EnableLegacyWrappingAlgorithms { get; set; }
16+
[Required]
1317
public KeyMaterial KeyMaterial { get; set; } = new();
1418
}
1519

1620
public class KeyMaterial
1721
{
22+
[Required]
1823
public string KmsKeyId { get; set; } = string.Empty;
1924
}

0 commit comments

Comments
 (0)