feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools (#579) (#591)

* feat(cognito): add TagResource, UntagResource, ListTagsForResource for user pools

Dispatch the three Cognito IDP tag operations through CognitoJsonHandler and
resolve user pools by parsing the resource ARN (O(1) pool-store lookup, not a
full scan). Malformed ARNs now surface as InvalidParameterException rather
than a swallowed ResourceNotFoundException.

Reject reserved floci:* keys on standalone TagResource via
ReservedTags.rejectReservedTagsOnUpdate, matching the existing strip-on-write
behavior on CreateUserPool / UpdateUserPool. Mutations are synchronized on
the pool instance to match the ensureJwtSigningKeys pattern.

Covered by new unit tests (CognitoServiceTest, CognitoJsonHandlerTest), AWS
CLI bats (cognito.bats), and Java SDK compat tests (CognitoFeaturesTest).

* chore: retrigger CI
This commit is contained in:
iam-ssrivastav authored and GitHub committed 2026-04-25 09:50:09 -05:00
1 parent 12c89ba751
commit 5f94b429c2
3 files changed
+84

No files matched your search

@@ -481,6 +481,53 @@ class CognitoIntegrationTest {
"DescribeUserPoolClient must include GenerateSecret");
}
@Test
@Order(36)
void updateUserPoolClient() throws Exception {
// 1. Create a client
JsonNode createResp = cognitoJson("CreateUserPoolClient", """
{
"UserPoolId": "%s",
"ClientName": "initial-name"
}
""".formatted(poolId));
String cid = createResp.path("UserPoolClient").path("ClientId").asText();
// 2. Update the client
cognitoJson("UpdateUserPoolClient", """
{
"UserPoolId": "%s",
"ClientId": "%s",
"ClientName": "updated-name",
"AllowedOAuthFlowsUserPoolClient": true,
"AllowedOAuthFlows": ["code", "implicit"],
"AllowedOAuthScopes": ["email", "openid"]
}
""".formatted(poolId, cid));
// 3. Verify the updates
JsonNode describeResp = cognitoJson("DescribeUserPoolClient", """
{
"UserPoolId": "%s",
"ClientId": "%s"
}
""".formatted(poolId, cid));
JsonNode client = describeResp.path("UserPoolClient");
assertEquals("updated-name", client.path("ClientName").asText());
assertEquals(true, client.path("AllowedOAuthFlowsUserPoolClient").asBoolean());
JsonNode flows = client.path("AllowedOAuthFlows");
assertEquals(2, flows.size());
assertTrue(flows.toString().contains("code"));
assertTrue(flows.toString().contains("implicit"));
JsonNode scopes = client.path("AllowedOAuthScopes");
assertEquals(2, scopes.size());
assertTrue(scopes.toString().contains("email"));
assertTrue(scopes.toString().contains("openid"));
}
// ── Issue #229: Password verification ──────────────────────────────
@Test