fix(cognito): return only description fields in ListUserPoolClients (#416) (#420)

ListUserPoolClients was returning full UserPoolClient objects including
ClientSecret, GenerateSecret, AllowedOAuthFlows, AllowedOAuthScopes,
CreationDate and LastModifiedDate. Per the AWS API spec, this action
returns UserPoolClientDescription containing only ClientId, ClientName
and UserPoolId.

Add clientToDescriptionNode() for the list response, matching the
existing pattern where ListUserPools uses userPoolToDescriptionNode().
DescribeUserPoolClient continues to return the full object via
clientToNode().
This commit is contained in:
TiM authored and GitHub committed 2026-04-13 20:15:21 -05:00
1 parent 0ef82f0079
commit ed553c6cbf
3 files changed
+100 -1

No files matched your search

@@ -152,7 +152,7 @@ public class CognitoJsonHandler {
List<UserPoolClient> clients = service.listUserPoolClients(request.path("UserPoolId").asText());
ObjectNode response = objectMapper.createObjectNode();
ArrayNode items = response.putArray("UserPoolClients");
clients.forEach(c -> items.add(clientToNode(c)));
clients.forEach(c -> items.add(clientToDescriptionNode(c)));
return Response.ok(response).build();
}
@@ -465,6 +465,14 @@ public class CognitoJsonHandler {
return node;
}
private ObjectNode clientToDescriptionNode(UserPoolClient c) {
ObjectNode node = objectMapper.createObjectNode();
node.put("ClientId", c.getClientId());
node.put("ClientName", c.getClientName());
node.put("UserPoolId", c.getUserPoolId());
return node;
}
private ObjectNode clientToNode(UserPoolClient c) {
ObjectNode node = objectMapper.createObjectNode();
node.put("ClientId", c.getClientId());