[
https://issues.apache.org/jira/browse/KNOX-2985?focusedWorklogId=889730&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-889730
]
ASF GitHub Bot logged work on KNOX-2985:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Nov/23 13:12
Start Date: 09/Nov/23 13:12
Worklog Time Spent: 10m
Work Description: 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"
}
```
Issue Time Tracking
-------------------
Worklog Id: (was: 889730)
Remaining Estimate: 0h
Time Spent: 10m
> Deprecate KNOXTOKEN API v1
> --------------------------
>
> Key: KNOX-2985
> URL: https://issues.apache.org/jira/browse/KNOX-2985
> Project: Apache Knox
> Issue Type: Task
> Components: Server, TokenGenerationUI, TokenManagementUI
> Affects Versions: 2.0.0, 2.1.0
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Major
> Fix For: 2.1.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> In KNOX-2661, the following REST API endpoint changes happened:
> * renew was updated from {{POST}} to {{PUT}}
> * revoke was updated from {{POST}} to {{DELETE}}
> Unfortunately, at that time I did not consider backward compatibility and I
> introduced a backward compatibility issue for clients using previous versions.
> The scope of this Jira is to revert that issue back in the following way:
> * change renew/revoke back to POST in '.../api/v1/token' in v1 (to fix the
> issue we introduced earlier)
> * introduce v2 that will match v1, except that v2 will match the above
> changes from KNOX-2661
> * mark v1 deprecated
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)