You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2022/09/07 13:24:21 UTC

[GitHub] [knox] smolnar82 commented on a diff in pull request #631: KNOX-2800 - Knox token revocation should also work for impersonated tokens

smolnar82 commented on code in PR #631:
URL: https://github.com/apache/knox/pull/631#discussion_r964838187


##########
gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java:
##########
@@ -770,7 +771,11 @@ private Response getAuthenticationToken() {
             // userTokens is an ordered collection (by issue time) -> the first element is the oldest one
             final String oldestTokenId = userTokens.iterator().next().getTokenId();
             log.generalInfoMessage(String.format(Locale.getDefault(), "Revoking %s's oldest token %s ...", userName, Tokens.getTokenIDDisplayText(oldestTokenId)));
-            revoke(oldestTokenId);
+            final Response revocationResponse = revoke(oldestTokenId);
+            if (Response.Status.OK.getStatusCode() != revocationResponse.getStatus()) {
+              return Response.status(Response.Status.BAD_REQUEST)

Review Comment:
   Yes, that's right. We moved on, and that was a bug. This is happening only when the token limit is exceeded -> if the oldest token could not be removed for whatever reason, the new token must not be created.



-- 
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-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org