Skip to content

Commit

Permalink
update doc openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
SelligtomGit86 committed Feb 5, 2025
1 parent 1f518ce commit 012d09b
Show file tree
Hide file tree
Showing 2 changed files with 278 additions and 298 deletions.
288 changes: 139 additions & 149 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -892,22 +892,46 @@
"schema": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"description": { "type": "string" },
"pubKey": { "type": "string" },
"privKey": { "type": "string" },
"tags": { "type": "array", "items": { "type": "string" } },
"kind": { "type": "string" }
"config": {
"type": "object",
"properties": {
"checks": {
"type": "array",
"items": {
"type": "string"
}
},
"facts": {
"type": "array",
"items": {
"type": "string"
}
},
"resources": {
"type": "array",
"items": {
"type": "string"
}
},
"rules": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"required": ["id", "name", "pubKey", "privKey", "kind"]
"required": ["pubKey", "privKey", "config"]
}
}
}
},
"responses": {
"200": {
"description": "Biscuit KeyPair successfully created.",
"description": "Token successfully created.",
"content": {
"application/json": {
"schema": {
Expand All @@ -930,102 +954,112 @@
"/api/extensions/biscuit/biscuit-forges/:id/_generate": {
"post": {
"tags": ["biscuit-admin-api"],
"summary": "Generate a biscuit token from a forge",
"description": "Generate a biscuit token from a forge"
}
},
"/api/extensions/biscuit/biscuit-attenuators/:id/_attenuate": {
"post": {
"tags": ["biscuit-admin-api"],
"summary": "Attenuate a biscuit token from an attenuator entity",
"description": "Attenuate a biscuit token from an attenuator entity"
"summary": "Generate a biscuit token from a forge entity",
"description": "Generate a biscuit token from a forge entity",
"operationId": "generateBiscuitFromForge",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" },
"description": "ID of the forge entity."
}
],
"responses": {
"200": {
"description": "Token successfully created.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"token": { "type": "string" }
}
}
}
}
},
"400": {
"description": "Unable to create the Token",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": { "type": "string" }
}
}
}
}
}
},
"security": [
{
"basicAuth": []
}
]
}
},
"/api/extensions/biscuit/tokens/_verify": {
"/api/extensions/biscuit/tokens/_verify": {
"post": {
"tags": ["biscuit-admin-api"],
"summary": "Attenuate a biscuit token from an attenuator entity",
"description": "Attenuate a biscuit token from an attenuator entity"
}
},
"/api/extensions/biscuit/tokens/_attenuate": {
"post": {
"tags": ["biscuit-admin-api"],
"summary": "Generate a Biscuit Token",
"description": "Generate a Biscuit token from provided public and private keys or a keypair reference.",
"operationId": "generateTokenFromBody",
"summary": "Verify a biscuit token",
"description": "Verify a biscuit token",
"operationId": "verifyBiscuitTokenFromBody",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the keypair."
},
"name": {
"type": "string",
"description": "Name for the Biscuit token."
"checks": {
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"type": "string",
"description": "Optional description for the token."
"facts": {
"type": "array",
"items": {
"type": "string"
}
},
"pubKey": {
"type": "string",
"description": "The public key in hexadecimal format."
"resources": {
"type": "array",
"items": {
"type": "string"
}
},
"privKey": {
"type": "string",
"description": "The private key in hexadecimal format."
"rules": {
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"policies": {
"type": "array",
"description": "An array of tags to categorize the token.",
"items": {
"type": "string"
}
},
"kind": {
"type": "string",
"description": "Type of key (for example, RSA, Ed25519, etc.)."
"revokedIds": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["id", "name", "pubKey", "privKey", "kind"]
}
},
{
"type": "object",
"properties": {
"keypair_ref": {
"type": "string",
"description": "Reference identifier for an existing Biscuit keypair."
}
},
"required": ["keypair_ref"]
}
]
},
"examples": {
"FullKeyPair": {
"summary": "Using full public and private keys",
"value": {
"id": "unique-id-1234",
"name": "My Biscuit Token",
"description": "A sample Biscuit token for demo purposes",
"pubKey": "56584fe8fc9bf847f26a0e37680c921bba58f9b4458f75b44f78b0942b75e34c",
"privKey": "5b1fdd8961c0f3a7ff6aa25ed3a329616643782fdd94ae25e507989e1ee68c99",
"tags": ["demo", "premium"],
"kind": "rsa"
}
},
"KeyPairReference": {
"summary": "Using a keypair reference",
"value": {
"keypair_ref": "biscuit-keypair_0b863987-65af-4ca4-8d38-73b742f7e8bd"
"keypair_ref": {
"type": "string"
},
"token": {
"type": "string"
}
}
}
Expand All @@ -1034,79 +1068,35 @@
},
"responses": {
"200": {
"description": "Biscuit token successfully generated.",
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"pubKey": {
"type": "string",
"description": "The public key that was used."
},
"privKey": {
"type": "string",
"description": "The private key that was used."
},
"token": {
"type": "string",
"description": "The generated Biscuit token."
},
"checks": {
"type": "array",
"description": "An array of check results or validations performed.",
"items": {
"type": "string"
}
}
}
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success"
},
{
"type": "object",
"properties": {
"keypair_ref": {
"type": "string",
"description": "The keypair reference used."
},
"token": {
"type": "string",
"description": "The generated Biscuit token."
},
"checks": {
"type": "array",
"description": "An array of check results or validations performed.",
"items": {
"type": "string"
}
}
}
}
]
},
"examples": {
"ResponseWithFullKeys": {
"summary": "Response when full key details are provided",
"value": {
"pubKey": "56584fe8fc9bf847f26a0e37680c921bba58f9b4458f75b44f78b0942b75e34c",
"privKey": "5b1fdd8961c0f3a7ff6aa25ed3a329616643782fdd94ae25e507989e1ee68c99",
"token": "EpUBCisKBGRlbW8KBHBsYW4KBGZyZWUYAyIJCgcIChIDGIAIIgoKCAiBCBIDGIIIEiQIABIgmlHlSBvxY66pQnFVXIY-685yLB5Sig8p1U5ur6dmYIUaQMt-8IHulfZKB8Vr1yGZRE86EZio-lUTdHKyA49WDDJrMKkahOFFmgcmTJwp3CLUHTc-w81MMuF2MfEKQrZ0Pg4iIgogPjlkYu2JumZdy5qvP5fi7ec2xnmY7wY2PMAZVvucUmQ=",
"checks": [
"check if user(\"demo\")",
"check if plan(\"premium\")"
]
"message": {
"type": "string",
"example": "Checked successfully"
}
},
"ResponseWithKeyPairRef": {
"summary": "Response when a keypair reference is used",
"value": {
"keypair_ref": "biscuit-keypair_0b863987-65af-4ca4-8d38-73b742f7e8bd",
"token": "EpUBCisKBGRlbW8KBHBsYW4KBGZyZWUYAyIJCgcIChIDGIAIIgoKCAiBCBIDGIIIEiQIABIgmlHlSBvxY66pQnFVXIY-685yLB5Sig8p1U5ur6dmYIUaQMt-8IHulfZKB8Vr1yGZRE86EZio-lUTdHKyA49WDDJrMKkahOFFmgcmTJwp3CLUHTc-w81MMuF2MfEKQrZ0Pg4iIgogPjlkYu2JumZdy5qvP5fi7ec2xnmY7wY2PMAZVvucUmQ=",
"checks": [
"check if user(\"demo\")",
"check if plan(\"premium\")"
]
}
}
}
}
},
"400": {
"description": "Error response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "error message"
}
}
}
Expand Down
Loading

0 comments on commit 012d09b

Please sign in to comment.