Skip to content

Commit 8facdfc

Browse files
stevsmitSteven Smith
andauthored
Adds superuser-AllAppTokens API endpoint (quay#1472)
Co-authored-by: Steven Smith <[email protected]>
1 parent 300edb7 commit 8facdfc

File tree

4 files changed

+93
-1
lines changed

4 files changed

+93
-1
lines changed

api_reference/master.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ include::modules/api-superuser-listAllLogs.adoc[leveloffset=+2]
216216
include::modules/api-superuser-listAllOrganizations.adoc[leveloffset=+2]
217217
include::modules/api-superuser-createServiceKey.adoc[leveloffset=+2]
218218
include::modules/api-superuser-listServiceKeys.adoc[leveloffset=+2]
219+
include::modules/api-superuser-listAllAppTokens.adoc[leveloffset=+2]
219220
include::modules/api-superuser-changeUserQuotaSuperUser.adoc[leveloffset=+2]
220221
include::modules/api-superuser-deleteUserQuotaSuperUser.adoc[leveloffset=+2]
221222
include::modules/api-superuser-createUserQuotaSuperUser.adoc[leveloffset=+2]
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
= listAllAppTokens
3+
Returns a list of all app specific tokens in the system.
4+
5+
This endpoint is for system-wide auditing by superusers and global read-only superusers.
6+
7+
[discrete]
8+
== GET /api/v1/superuser/apptokens
9+
10+
11+
12+
**Authorizations: **oauth2_implicit (**super:user**)
13+
14+
15+
16+
[discrete]
17+
== Query parameters
18+
19+
[options="header", width=100%, cols=".^2a,.^3a,.^9a,.^4a"]
20+
|===
21+
|Type|Name|Description|Schema
22+
|query|**expiring** +
23+
_optional_|If true, only returns those tokens expiring soon|boolean
24+
|===
25+
26+
27+
[discrete]
28+
== Responses
29+
30+
[options="header", width=100%, cols=".^2a,.^14a,.^4a"]
31+
|===
32+
|HTTP Code|Description|Schema
33+
|200|Successful invocation|
34+
|400|Bad Request|&lt;&lt;_apierror,ApiError&gt;&gt;
35+
|401|Session required|&lt;&lt;_apierror,ApiError&gt;&gt;
36+
|403|Unauthorized access|&lt;&lt;_apierror,ApiError&gt;&gt;
37+
|404|Not found|&lt;&lt;_apierror,ApiError&gt;&gt;
38+
|===
39+
40+
[discrete]
41+
== Example command
42+
43+
.Example: List all app-specific tokens
44+
[source,terminal]
45+
----
46+
$ curl -X GET \
47+
"https://quay-server.example.com/api/v1/superuser/apptokens" \
48+
-H "Authorization: Bearer <superuser_access_token>" \
49+
-H "Accept: application/json"
50+
----
51+
52+
.Example: List app-specific tokens expiring soon
53+
[source,terminal]
54+
----
55+
$ curl -X GET \
56+
"https://quay-server.example.com/api/v1/superuser/apptokens?expiring=true" \
57+
-H "Authorization: Bearer <superuser_access_token>" \
58+
-H "Accept: application/json"
59+
----

modules/managing-service-keys-api.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ $ curl -X GET \
5959
{"keys":[{"approval":{"approval_type":"ServiceKeyApprovalType.AUTOMATIC","approved_date":"Mon, 20 Jan 2025 14:46:01 GMT","approver":null,"notes":""},"created_date":"Mon, 20 Jan 2025 14:46:01 GMT","expiration_date":"Wed, 05 Feb 2025 22:03:37 GMT","jwk":{"e":"AQAB","kid":"<example>","kty":"RSA","n":"<example>"},"kid":"7fr8soqXGgea8JqjwgItjjJT9GKlt-bMyMCDmvzy6WQ","metadata":{"created_by":"CLI tool"},"name":"http://quay-server.example.com:80","rotation_duration":null,"service":"quay"}]}
6060
----
6161

62+
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.16/html-single/red_hat_quay_api_reference/index#listAllAppTokens[`GET /api/v1/superuser/apptokens`] endpoint to return a list of service account keys:
63+
+
64+
[source,terminal]
65+
----
66+
$ curl -X GET \
67+
"https://quay-server.example.com/api/v1/superuser/apptokens?expiring=true" \
68+
-H "Authorization: Bearer <superuser_access_token>" \
69+
-H "Accept: application/json"
70+
----
71+
+
72+
Alternatively, you can include the `expiring=true` option. For example:
73+
+
74+
[source,terminal]
75+
----
76+
$ curl -X GET \
77+
"https://quay-server.example.com/api/v1/superuser/apptokens?expiring=true" \
78+
-H "Authorization: Bearer <superuser_access_token>" \
79+
-H "Accept: application/json"
80+
----
81+
6282
* Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_reference/index#getservicekey[`GET /api/v1/superuser/keys/{kid}`] endpoint to retrieve information about a service account by its kid:
6383
+
6484
[source,terminal]

modules/new-api-endpoints-316.adoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,16 @@ New tag API parameters, `getTagPullStatistics` and `getManifestPullStatistics`,
1717

1818
|===
1919

20-
See link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html/red_hat_quay_api_reference/tag[Chapter 22. tag] for more information, including example commands.
20+
See link:https://docs.redhat.com/en/documentation/red_hat_quay/3.16/html/red_hat_quay_api_reference/tag[Chapter 22. tag] for more information, including example commands.
21+
22+
[id="app-token-api"]
23+
== App token API endpoint
24+
25+
A new API parameter, `listAllAppTokens`, has been added to the {productname} API. This endpoint enables superusers to manage and audit application-specific tokens.
26+
27+
|===
28+
| Name | Description | Schema
29+
|*listAllAppTokens* |List all application tokens across all users in the system. Requires superuser or global read-only superuser privileges. | object
30+
|===
31+
32+
See link:https://docs.redhat.com/en/documentation/red_hat_quay/3.16/html-single/red_hat_quay_api_reference/index#superuser[Chapter 22. superuser] for more information, including example commands.

0 commit comments

Comments
 (0)