pzampino commented on a change in pull request #542: URL: https://github.com/apache/knox/pull/542#discussion_r821130144
########## File path: gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java ########## @@ -395,11 +397,22 @@ public Response doPost() { @GET @Path(GET_USER_TOKENS) @Produces({APPLICATION_JSON, APPLICATION_XML}) - public Response getUserTokens(@QueryParam("userName") String userName) { + public Response getUserTokens(@QueryParam("userName") String userName, @QueryParam("mdName") String metadataName, @QueryParam("mdValue") String metadataValue) { Review comment: Is it not possible to specify multiple metadata NV pairs in the query string? This seems to allow only a single pair. ########## File path: gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java ########## @@ -729,6 +743,19 @@ private Response getAuthenticationToken() { return Response.ok().entity("{ \"Unable to acquire token.\" }").build(); } + private void addArbitraryTokenMetadata(TokenMetadata tokenMetadata) { + final String metadataPrefix = "md_"; + final Enumeration<String> paramNames = request.getParameterNames(); + while (paramNames.hasMoreElements()) { + final String paramName = paramNames.nextElement(); + if (paramName.startsWith(metadataPrefix)) { + final String metadataName = paramName.replace(metadataPrefix, ""); Review comment: Is this less expensive than `paramName.substring(metadataPrefix.length() + 1)` ? What if the paramName value itself includes the metadataPrefix String (e.g., md_MyMetadata_md_xyz) ########## File path: gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java ########## @@ -1006,7 +1007,7 @@ public void testTokenLimitChangeAfterAlreadyHavingTokens() throws Exception { for (int i = 0; i < numberOfPreExistingTokens; i++) { tr.doGet(); } - Response getKnoxTokensResponse = tr.getUserTokens(USER_NAME); + Response getKnoxTokensResponse = tr.getUserTokens(USER_NAME, null, null); Review comment: Should these additional parameters be required here? I would expect the same result from a call to `tr.getUserTokens(USER_NAME);` Is this a backward-compatabiltiy concern? ########## File path: gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java ########## @@ -1046,7 +1047,7 @@ private void testLimitingTokensPerUser(String configuredLimit, int numberOfToken throw new Exception(getTokenResponse.getEntity().toString()); } } - final Response getKnoxTokensResponse = tr.getUserTokens(USER_NAME); + final Response getKnoxTokensResponse = tr.getUserTokens(USER_NAME, null, null); Review comment: Same as previous comment/question. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@knox.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org