Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-2985 - Introduced KNOXTOKEN API v2 and deprecated v1 methods #818

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

smolnar82
Copy link
Contributor

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"
}

Copy link
Contributor

@moresandeep moresandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, few comments.

@smolnar82 smolnar82 merged commit c4f77c9 into apache:master Nov 10, 2023
2 checks passed
@smolnar82 smolnar82 deleted the KNOX-2985 branch November 10, 2023 07:28
stoty pushed a commit to stoty/knox that referenced this pull request May 14, 2024
…methods (apache#818)

Change-Id: Iace90f672930c45726851728f90b83d88c2fabaf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants