-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial proposal for
/allow
endpoint
This creates an `/allow` endpoint which does the actual permission check. It takes three mandatory query parameters: * `tenant`: The tenant URN * `resource`: The resource URN * `action`: The action identifier tag It also adds a simple OpenAPI v3 spec document. The intent is to have an easy, general and fairly opinionated endpoint to do permission checks on. This can be taken programmatically without much logic in... say... an API Gateway, to do the needed checks without adding much logic other than gathering the mandatory parameters. Signed-off-by: Juan Antonio Osorio <[email protected]>
- Loading branch information
Showing
3 changed files
with
128 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
openapi: "3.1.0" | ||
info: | ||
version: 0.0.1 | ||
title: Permissions API | ||
description: Permissions API is an API to manage permissions for infratographer. | ||
contact: | ||
name: Infratographer Authors | ||
url: https://github.com/infratographer | ||
license: | ||
name: Apache 2.0 | ||
url: https://www.apache.org/licenses/LICENSE-2.0.html | ||
#servers: | ||
# - url: http://localhost/api/v1 | ||
paths: | ||
/allow: | ||
get: | ||
description: | ||
operationId: allow | ||
parameters: | ||
- $ref: '#/components/parameters/tenantParam' | ||
- $ref: '#/components/parameters/resourceParam' | ||
- $ref: '#/components/parameters/actionParam' | ||
responses: | ||
'200': | ||
description: allow response | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
'403': | ||
description: forbidden | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Error' | ||
default: | ||
description: unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Error' | ||
|
||
components: | ||
schemas: | ||
Error: | ||
type: object | ||
required: | ||
- message | ||
properties: | ||
message: | ||
type: string | ||
|
||
parameters: | ||
tenantParam: | ||
in: query | ||
name: tenant | ||
required: true | ||
schema: | ||
type: string | ||
resourceParam: | ||
in: query | ||
name: resource | ||
required: true | ||
schema: | ||
type: string | ||
actionParam: | ||
in: query | ||
name: action | ||
required: true | ||
schema: | ||
type: string |