mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: add ability to name tokens (#6365)
* add tokens switch * reorged TokensPage * using Trans component for description * using Trans component on DeleteDialog * add owner col * simplify hook return * lint * type for response * added flag for name * fixed auth * lint, prettier, tests * added unique index for login type token * remove tokens by name * better check for unique constraint * docs * test: Fix dbfake to insert token name * fix doc tests * Update cli/tokens.go Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> * Update coderd/database/migrations/000102_add_apikey_name.down.sql Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> * add more specificity to IsUniqueViolation check * fix tests * Fix AutorizeAllEndpoints * rename migration --------- Co-authored-by: Steven Masley <stevenmasley@coder.com> Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
This commit is contained in:
53
coderd/apidoc/docs.go
generated
53
coderd/apidoc/docs.go
generated
@ -3337,6 +3337,48 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/{user}/keys/tokens/{keyname}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"summary": "Get API key by token name",
|
||||
"operationId": "get-api-key-by-token-name",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID, name, or me",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"format": "string",
|
||||
"description": "Key Name",
|
||||
"name": "keyname",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.APIKey"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/{user}/keys/{keyid}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -3350,8 +3392,8 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"summary": "Get API key",
|
||||
"operationId": "get-api-key",
|
||||
"summary": "Get API key by ID",
|
||||
"operationId": "get-api-key-by-id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -5342,6 +5384,7 @@ const docTemplate = `{
|
||||
"lifetime_seconds",
|
||||
"login_type",
|
||||
"scope",
|
||||
"token_name",
|
||||
"updated_at",
|
||||
"user_id"
|
||||
],
|
||||
@ -5388,6 +5431,9 @@ const docTemplate = `{
|
||||
}
|
||||
]
|
||||
},
|
||||
"token_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@ -6003,6 +6049,9 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/codersdk.APIKeyScope"
|
||||
}
|
||||
]
|
||||
},
|
||||
"token_name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user