smolnar82 opened a new pull request, #818:
URL: https://github.com/apache/knox/pull/818

   ## What changes were proposed in this pull request?
   
   Two major changes:
   - introduced v2 in the KNOXTOKEN service REST API enpoints
   - deprecated `renew` and `revoke` in v1
   
   ## How was this patch tested?
   
   Manually tested the Token Generation and Token Management UIs (create, 
enable/disable, revoke tokens) and confirmed that `renew` and `revoke` work 
with different HTTP methods using different versions:
   
   ```
   $ curl -iku admin:admin-password -d $JWT -X POST 
https://localhost:8443/gateway/sandbox/knoxtoken/api/v1/token/renew
   HTTP/1.1 200 OK
   Date: Thu, 09 Nov 2023 10:31:46 GMT
   Set-Cookie: KNOXSESSIONID=node0f1emmld2e9jl1tpkwa87qmn800.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Wed, 08-Nov-2023 10:31:46 GMT; SameSite=lax
   Content-Type: application/json
   Content-Length: 54
   
   {
     "renewed": "true",
     "expires": "1699612307203"
   }
   
   
   $ curl -iku admin:admin-password -d $JWT -X PUT 
https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/renew
   HTTP/1.1 200 OK
   Date: Thu, 09 Nov 2023 10:32:14 GMT
   Set-Cookie: KNOXSESSIONID=node0m4890e208yz6u8kyw358gajq2.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Wed, 08-Nov-2023 10:32:14 GMT; SameSite=lax
   Content-Type: text/plain
   Content-Length: 54
   
   {
     "renewed": "true",
     "expires": "1699612334777"
   }
   ```
   
   ```
   $ curl -iku admin:admin-password -d '550c6963-24d8-43fb-94af-2dac7d4abaad' 
-X POST https://localhost:8443/gateway/sandbox/knoxtoken/api/v1/token/revoke
   HTTP/1.1 200 OK
   Date: Thu, 09 Nov 2023 10:35:33 GMT
   Set-Cookie: KNOXSESSIONID=node0an2jchc2tjph1eet774usk5hr3.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Wed, 08-Nov-2023 10:35:33 GMT; SameSite=lax
   Content-Type: application/json
   Content-Length: 24
   
   {
     "revoked": "true"
   }
   
   $  curl -iku admin:admin-password -d '1dc60396-9dea-4ff8-887f-521e08801555' 
-X DELETE https://localhost:8443/gateway/sandbox/knoxtoken/api/v2/token/revoke
   HTTP/1.1 200 OK
   Date: Thu, 09 Nov 2023 10:36:21 GMT
   Set-Cookie: KNOXSESSIONID=node01pez8nde6mmbq1g433vhta029x4.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Wed, 08-Nov-2023 10:36:21 GMT; SameSite=lax
   Content-Type: application/json
   Content-Length: 24
   
   {
     "revoked": "true"
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to