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 2021/09/15 16:33:59 UTC
[GitHub] [knox] smolnar82 commented on a change in pull request #495: KNOX-2664 - Let end-users revoke their own tokens
smolnar82 commented on a change in pull request #495:
URL: https://github.com/apache/knox/pull/495#discussion_r709357669
##########
File path: gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
##########
@@ -527,6 +527,12 @@ public Response revoke(String token) {
return resp;
}
+ private boolean triesToRevokeOwnToken(String tokenId, String revoker) throws UnknownTokenException {
+ final TokenMetadata metadata = tokenStateService.getTokenMetadata(tokenId);
+ final String tokenUserName = metadata == null ? "" : metadata.getUserName();
+ return revoker != null && revoker.equals(tokenUserName);
Review comment:
In theory, it should always be set, but you are right: an additional emptiness checking does not hurt and could avoid weird issues.
I submitted a new PS.
--
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