mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(kms): add RotateKeyOnDemand support (#990)
This commit is contained in:
1 parent
8fb07d2654
commit
255b41bca8
5 files changed
+73
No files matched your search
@@ -108,4 +108,28 @@ class KmsIntegrationTest {
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("KMSInvalidMacException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rotateKeyOnDemandReturnsKeyId() {
|
||||
String keyId = given()
|
||||
.header("X-Amz-Target", "TrentService.CreateKey")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"Description\":\"rotate-on-demand\"}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract()
|
||||
.path("KeyMetadata.KeyId");
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.RotateKeyOnDemand")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"KeyId\":\"" + keyId + "\"}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("KeyId", equalTo(keyId));
|
||||
}
|
||||
}
|
||||
@@ -633,6 +633,36 @@ class KmsServiceTest {
|
||||
assertFalse(kmsService.getKeyRotationStatus(key.getKeyId(), REGION));
|
||||
}
|
||||
|
||||
// ── Issue #911 — RotateKeyOnDemand ──────────────────────────────────────
|
||||
|
||||
@Test
|
||||
void rotateKeyOnDemandReturnsKeyId() {
|
||||
KmsKey key = kmsService.createKey(null, REGION);
|
||||
String keyId = kmsService.rotateKeyOnDemand(key.getKeyId(), REGION);
|
||||
assertEquals(key.getKeyId(), keyId);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rotateKeyOnDemandOnAsymmetricKeyThrows() {
|
||||
KmsKey key = kmsService.createKey("rsa key", "SIGN_VERIFY", "RSA_2048", null, Map.of(), REGION);
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
kmsService.rotateKeyOnDemand(key.getKeyId(), REGION));
|
||||
|
||||
assertEquals("UnsupportedOperationException", ex.getErrorCode());
|
||||
assertEquals(400, ex.getHttpStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rotateKeyOnDemandOnDisabledKeyThrows() {
|
||||
KmsKey key = kmsService.createKey(null, REGION);
|
||||
key.setEnabled(false);
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
kmsService.rotateKeyOnDemand(key.getKeyId(), REGION));
|
||||
|
||||
assertEquals("DisabledException", ex.getErrorCode());
|
||||
assertEquals(400, ex.getHttpStatus());
|
||||
}
|
||||
|
||||
// ── Issue #497 — HMAC key specs ─────────────────────────────────────────
|
||||
|
||||
@ParameterizedTest
|
||||
|
||||
Reference in new issue
Block a user