mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-29 05:34:15 +00:00
feat: add deploy tokens (#37306)
Deploy keys only work over SSH. A deploy token is their counterpart for HTTPS: a repository scoped credential, used as the password of a Git request, with read or read and write access. It covers Git operations and LFS, and can be regenerated in place. Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Claude Mythos <noreply@anthropic.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: bircni <bircni@icloud.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
+87
-5
@@ -3973,6 +3973,26 @@
|
||||
"type": "object",
|
||||
"x-go-package": "gitea.dev/modules/structs"
|
||||
},
|
||||
"CreateDeployKeyTokenOption": {
|
||||
"properties": {
|
||||
"read_only": {
|
||||
"description": "Describe if the token has only read access or read/write",
|
||||
"type": "boolean",
|
||||
"x-go-name": "ReadOnly"
|
||||
},
|
||||
"title": {
|
||||
"description": "Title of the token to add",
|
||||
"type": "string",
|
||||
"uniqueItems": true,
|
||||
"x-go-name": "Title"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-package": "gitea.dev/modules/structs"
|
||||
},
|
||||
"CreateEmailOption": {
|
||||
"description": "CreateEmailOption options when creating email addresses",
|
||||
"properties": {
|
||||
@@ -4227,7 +4247,6 @@
|
||||
"x-go-package": "gitea.dev/modules/structs"
|
||||
},
|
||||
"CreateKeyOption": {
|
||||
"description": "CreateKeyOption options when creating a key",
|
||||
"properties": {
|
||||
"key": {
|
||||
"description": "An armored SSH key to add",
|
||||
@@ -5195,10 +5214,9 @@
|
||||
"x-go-package": "gitea.dev/modules/structs"
|
||||
},
|
||||
"DeployKey": {
|
||||
"description": "DeployKey a deploy key",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"description": "Created is the time when the deploy key was added",
|
||||
"description": "Created is the time when the deploy-key was added",
|
||||
"format": "date-time",
|
||||
"type": "string",
|
||||
"x-go-name": "Created"
|
||||
@@ -5209,7 +5227,7 @@
|
||||
"x-go-name": "Fingerprint"
|
||||
},
|
||||
"id": {
|
||||
"description": "ID is the unique identifier for the deploy key",
|
||||
"description": "ID is the unique identifier for the deploy-key",
|
||||
"format": "int64",
|
||||
"type": "integer",
|
||||
"x-go-name": "ID"
|
||||
@@ -5225,6 +5243,15 @@
|
||||
"type": "integer",
|
||||
"x-go-name": "KeyID"
|
||||
},
|
||||
"key_type": {
|
||||
"description": "Type tells whether the key authenticates over SSH or with a token over HTTPS",
|
||||
"enum": [
|
||||
"ssh",
|
||||
"token"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-name": "KeyType"
|
||||
},
|
||||
"read_only": {
|
||||
"description": "ReadOnly indicates if the key has read-only access",
|
||||
"type": "boolean",
|
||||
@@ -5238,8 +5265,13 @@
|
||||
"type": "string",
|
||||
"x-go-name": "Title"
|
||||
},
|
||||
"token": {
|
||||
"description": "Token is the plaintext token of an HTTPS key, only returned when it is created",
|
||||
"type": "string",
|
||||
"x-go-name": "Token"
|
||||
},
|
||||
"url": {
|
||||
"description": "URL is the API URL for this deploy key",
|
||||
"description": "URL is the API URL for this deploy-key",
|
||||
"format": "uri",
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
@@ -26543,6 +26575,56 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/keys/tokens": {
|
||||
"post": {
|
||||
"operationId": "repoCreateDeployToken",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "owner of the repo",
|
||||
"in": "path",
|
||||
"name": "owner",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "name of the repo",
|
||||
"in": "path",
|
||||
"name": "repo",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDeployKeyTokenOption"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-originalParamName": "body"
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"$ref": "#/components/responses/DeployKey"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/components/responses/validationError"
|
||||
}
|
||||
},
|
||||
"summary": "Add a deploy token to a repository, it authenticates git over HTTPS",
|
||||
"tags": [
|
||||
"repository"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/keys/{id}": {
|
||||
"delete": {
|
||||
"operationId": "repoDeleteKey",
|
||||
|
||||
Reference in New Issue
Block a user