knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smol...@apache.org
Subject [knox] branch master updated: KNOX-2661 - Consolidated HTTP methods in TokenResource (#494)
Date Wed, 15 Sep 2021 07:32:08 GMT
This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new eb82cd9  KNOX-2661 - Consolidated HTTP methods in TokenResource (#494)
eb82cd9 is described below

commit eb82cd9fda9ea9ebf6a026f50d5134445debff52
Author: Sandor Molnar <smolnar@apache.org>
AuthorDate: Wed Sep 15 09:32:02 2021 +0200

    KNOX-2661 - Consolidated HTTP methods in TokenResource (#494)
---
 .../org/apache/knox/gateway/service/knoxtoken/TokenResource.java     | 5 +++--
 .../token-management/app/token.management.service.ts                 | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
b/gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
index ba73430..f204720 100644
--- a/gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
+++ b/gateway-service-knoxtoken/src/main/java/org/apache/knox/gateway/service/knoxtoken/TokenResource.java
@@ -39,6 +39,7 @@ import javax.annotation.PostConstruct;
 import javax.inject.Singleton;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
@@ -405,7 +406,7 @@ public class TokenResource {
     return Response.status(Response.Status.OK).entity(JsonUtils.renderAsJsonString(tokenStateServiceStatusMap)).build();
   }
 
-  @POST
+  @PUT
   @Path(RENEW_PATH)
   @Produces({APPLICATION_JSON})
   public Response renew(String token) {
@@ -474,7 +475,7 @@ public class TokenResource {
     return resp;
   }
 
-  @POST
+  @DELETE
   @Path(REVOKE_PATH)
   @Produces({APPLICATION_JSON})
   public Response revoke(String token) {
diff --git a/knox-token-management-ui/token-management/app/token.management.service.ts b/knox-token-management-ui/token-management/app/token.management.service.ts
index 0669c47..7fa1ab6 100644
--- a/knox-token-management-ui/token-management/app/token.management.service.ts
+++ b/knox-token-management-ui/token-management/app/token.management.service.ts
@@ -70,7 +70,7 @@ export class TokenManagementService {
     revokeToken(tokenId: string) {
         let xheaders = new HttpHeaders();
         xheaders = this.addJsonHeaders(xheaders);
-        return this.http.post(this.revokeKnoxTokenUrl, tokenId, {headers: xheaders, responseType:
'text'})
+        return this.http.request('DELETE', this.revokeKnoxTokenUrl, {headers: xheaders, body:
tokenId, responseType: 'text'})
             .toPromise()
             .then(response => response)
             .catch((err: HttpErrorResponse) => {

Mime
View raw message