Add API reference docs for identity / universal auth endpoints

This commit is contained in:
Tuan Dang
2023-12-12 13:42:17 +07:00
parent 5f29562fad
commit 93aeacc6b6
35 changed files with 2321 additions and 96 deletions

View File

@@ -1,4 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/workspace/{workspaceId}/environments"
openapi: "POST /api/v2/workspace/{workspaceId}/environments"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/identities/"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/identities/{identityId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/identities/{identityId}"
---

View File

@@ -1,4 +1,4 @@
---
title: "Delete Membership"
title: "Delete User Membership"
openapi: "DELETE /api/v2/organizations/{organizationId}/memberships/{membershipId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List Identity Memberships"
openapi: "GET /api/v2/organizations/{organizationId}/identity-memberships"
---

View File

@@ -1,4 +1,4 @@
---
title: "Get Memberships"
title: "Get User Memberships"
openapi: "GET /api/v2/organizations/{organizationId}/memberships"
---

View File

@@ -1,4 +1,4 @@
---
title: "Update Membership"
title: "Update User Membership"
openapi: "PATCH /api/v2/organizations/{organizationId}/memberships/{membershipId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Attach"
openapi: "POST /api/v1/auth/universal-auth/identities/{identityId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create Client Secret"
openapi: "POST /api/v1/auth/universal-auth/identities/{identityId}/client-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "List Client Secrets"
openapi: "GET /api/v1/auth/universal-auth/identities/{identityId}/client-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "Login"
openapi: "POST /api/v1/auth/universal-auth/login"
---

View File

@@ -0,0 +1,4 @@
---
title: "Renew Access Token"
openapi: "POST /api/v1/auth/token/renew"
---

View File

@@ -0,0 +1,4 @@
---
title: "Retrieve"
openapi: "GET /api/v1/auth/universal-auth/identities/{identityId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Revoke Client Secret"
openapi: "POST /api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId}/revoke"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/auth/universal-auth/identities/{identityId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete Identity Membership"
openapi: "DELETE /api/v2/workspace/{workspaceId}/identity-memberships/{identityId}"
---

View File

@@ -1,4 +1,4 @@
---
title: "Delete Membership"
title: "Delete User Membership"
openapi: "DELETE /api/v2/workspace/{workspaceId}/memberships/{membershipId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List Identity Memberships"
openapi: "GET /api/v2/workspace/{workspaceId}/identity-memberships"
---

View File

@@ -1,4 +1,4 @@
---
title: "Get Memberships"
title: "Get User Memberships"
openapi: "GET /api/v2/workspace/{workspaceId}/memberships"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update Identity Membership"
openapi: "PATCH /api/v2/workspace/{workspaceId}/identity-memberships/{identityId}"
---

View File

@@ -1,4 +1,4 @@
---
title: "Update Membership"
title: "Update User Membership"
openapi: "PATCH /api/v2/workspace/{workspaceId}/memberships/{membershipId}"
---

View File

@@ -3,7 +3,7 @@ title: "E2EE Enabled"
---
<Note>
E2EE enabled mode only works with Service Tokens and cannot be used with [Identities](/documentation/platform/identities/overview).
E2EE enabled mode only works with [Service Tokens](/documentation/platform/token) and cannot be used with [Identities](/documentation/platform/identities/overview).
</Note>
Using Infisical's API to read/write secrets with E2EE enabled allows you to create, update, and retrieve secrets

View File

@@ -42,7 +42,7 @@ using the Universal Auth authentication method.
Here's some more guidance on each field:
- Access Token TTL (default is `7200`): The incremental lifetime for an acccess token in seconds; a value of `0` implies an infinite incremental lifetime.
- Access Token Max TTL (default is `7200`): The maximum lifetime for an acccess token in seconds; a value of `0` implies an infinite maximum lifetime.
- Access Token Max TTL (default is `2592000`): The maximum lifetime for an acccess token in seconds; a value of `0` implies an infinite maximum lifetime.
- Access Token Max Number of Uses (default is `0`): The maximum number of times that an access token can be used; a value of `0` implies infinite number of uses.
- Client Secret Trusted IPs: The IPs or CIDR ranges that the **Client Secret** can be used from together with the **Client ID** to get back an access token. By default, **Client Secrets** are given the `0.0.0.0/0` entry representing all possible IPv4 addresses.
- Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0` entry representing all possible IPv4 addresses.

View File

@@ -336,12 +336,34 @@
"api-reference/endpoints/users/my-organizations"
]
},
{
"group": "Identities",
"pages": [
"api-reference/endpoints/identities/create",
"api-reference/endpoints/identities/update",
"api-reference/endpoints/identities/delete"
]
},
{
"group": "Universal Auth",
"pages": [
"api-reference/endpoints/universal-auth/login",
"api-reference/endpoints/universal-auth/attach",
"api-reference/endpoints/universal-auth/retrieve",
"api-reference/endpoints/universal-auth/update",
"api-reference/endpoints/universal-auth/create-client-secret",
"api-reference/endpoints/universal-auth/list-client-secrets",
"api-reference/endpoints/universal-auth/revoke-client-secret",
"api-reference/endpoints/universal-auth/renew-access-token"
]
},
{
"group": "Organizations",
"pages": [
"api-reference/endpoints/organizations/memberships",
"api-reference/endpoints/organizations/update-membership",
"api-reference/endpoints/organizations/delete-membership",
"api-reference/endpoints/organizations/list-identity-memberships",
"api-reference/endpoints/organizations/workspaces"
]
},
@@ -351,6 +373,9 @@
"api-reference/endpoints/workspaces/memberships",
"api-reference/endpoints/workspaces/update-membership",
"api-reference/endpoints/workspaces/delete-membership",
"api-reference/endpoints/workspaces/list-identity-memberships",
"api-reference/endpoints/workspaces/update-identity-membership",
"api-reference/endpoints/workspaces/delete-identity-membership",
"api-reference/endpoints/workspaces/workspace-key",
"api-reference/endpoints/workspaces/secret-snapshots",
"api-reference/endpoints/workspaces/rollback-snapshot"

View File

@@ -11,33 +11,104 @@ servers:
paths:
/api/v1/identities/:
post:
description: ''
summary: Create identity
description: Create identity
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identity:
$ref: '#/components/schemas/Identity'
description: Details of the created identity
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Name of entity to create
example: development
organizationId:
type: string
description: ID of organization where to create identity
example: dev-environment
role:
type: string
description: Role to assume for organization membership
example: no-access
required:
- name
- organizationId
- role
/api/v1/identities/{identityId}:
patch:
description: ''
summary: Update identity
description: Update identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity to update
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identity:
$ref: '#/components/schemas/Identity'
description: Details of the updated identity
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Name of entity to update to
example: development
role:
type: string
description: Role to update to for organization membership
example: no-access
delete:
description: ''
summary: Delete identity
description: Delete identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identity:
$ref: '#/components/schemas/Identity'
description: Details of the deleted identity
security:
- bearerAuth: []
/api/v1/secret/{secretId}/secret-versions:
get:
summary: Return secret versions
@@ -757,13 +828,40 @@ paths:
description: OK
/api/v1/auth/token/renew:
post:
description: ''
summary: Renew access token
description: Renew access token
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
accessToken:
type: string
description: (Same) Access token after successful renewal
expiresIn:
type: number
description: TTL of access token in seconds
tokenType:
type: string
description: Type of access token (e.g. Bearer)
description: Access token and its details
requestBody:
content:
application/json:
schema:
type: object
properties:
accessToken:
type: string
description: Access token to renew
example: ...
/api/v1/auth/universal-auth/login:
post:
description: ''
summary: Login with Universal Auth
description: Login with Universal Auth
parameters:
- name: user-agent
in: header
@@ -772,84 +870,330 @@ paths:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
accessToken:
type: string
description: Access token issued after successful login
expiresIn:
type: number
description: TTL of access token in seconds
tokenType:
type: string
description: Type of access token (e.g. Bearer)
description: Access token and its details
requestBody:
content:
application/json:
schema:
type: object
properties:
clientId:
type: string
description: Client ID for identity to login with Universal Auth
example: ...
clientSecret:
type: string
description: Client Secret for identity to login with Universal Auth
example: ...
/api/v1/auth/universal-auth/identities/{identityId}:
post:
description: ''
summary: Attach Universal Auth configuration onto identity
description: Attach Universal Auth configuration onto identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity to attach Universal Auth onto
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityUniversalAuth:
$ref: '#/components/schemas/IdentityUniversalAuth'
description: Details of attached Universal Auth
'400':
description: Bad Request
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
clientSecretTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
description: IP address to trust
default: 0.0.0.0/0
description: >-
List of IPs or CIDR ranges that the Client Secret can be
used from together with the Client ID to get back an access
token. By default, Client Secrets are given the 0.0.0.0/0
entry representing all possible IPv4 addresses.
example: ...
default:
- ipAddress: 0.0.0.0/0
accessTokenTTL:
type: number
description: >-
The incremental lifetime for an acccess token in seconds; a
value of 0 implies an infinite incremental lifetime.
example: ...
default: 100
accessTokenMaxTTL:
type: number
description: >-
The maximum lifetime for an acccess token in seconds; a
value of 0 implies an infinite maximum lifetime.
example: ...
default: 2592000
accessTokenNumUsesLimit:
type: number
description: >-
The maximum number of times that an access token can be
used; a value of 0 implies infinite number of uses.
example: ...
default: 0
accessTokenTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
description: IP address to trust
default: 0.0.0.0/0
description: >-
List of IPs or CIDR ranges that access tokens can be used
from. By default, each token is given the 0.0.0.0/0 entry
representing all possible IPv4 addresses.
example: ...
default:
- ipAddress: 0.0.0.0/0
patch:
description: ''
summary: Update Universal Auth configuration on identity
description: Update Universal Auth configuration on identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity to update Universal Auth on
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityUniversalAuth:
$ref: '#/components/schemas/IdentityUniversalAuth'
description: Details of updated Universal Auth
'400':
description: Bad Request
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
clientSecretTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
description: IP address to trust
description: >-
List of IPs or CIDR ranges that the Client Secret can be
used from together with the Client ID to get back an access
token. By default, Client Secrets are given the 0.0.0.0/0
entry representing all possible IPv4 addresses.
example: ...
accessTokenTTL:
type: number
description: >-
The incremental lifetime for an acccess token in seconds; a
value of 0 implies an infinite incremental lifetime.
example: ...
accessTokenMaxTTL:
type: number
description: >-
The maximum lifetime for an acccess token in seconds; a
value of 0 implies an infinite maximum lifetime.
example: ...
accessTokenNumUsesLimit:
type: number
description: >-
The maximum number of times that an access token can be
used; a value of 0 implies infinite number of uses.
example: ...
accessTokenTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
description: IP address to trust
description: >-
List of IPs or CIDR ranges that access tokens can be used
from. By default, each token is given the 0.0.0.0/0 entry
representing all possible IPv4 addresses.
example: ...
get:
description: ''
summary: Retrieve Universal Auth configuration on identity
description: Retrieve Universal Auth configuration on identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity to retrieve Universal Auth on
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityUniversalAuth:
$ref: '#/components/schemas/IdentityUniversalAuth'
description: Details of retrieved Universal Auth
security:
- bearerAuth: []
/api/v1/auth/universal-auth/identities/{identityId}/client-secrets:
post:
description: ''
summary: Create Universal Auth Client Secret for identity
description: Create Universal Auth Client Secret for identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity to create Universal Auth Client Secret for
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
clientSecret:
type: string
description: The created Client Secret
clientSecretData:
$ref: '#/components/schemas/IdentityUniversalAuthClientSecretData'
description: Details of the created Client Secret
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
description:
type: string
description: A description for the Client Secret to create.
example: ...
ttl:
type: number
description: >-
The time-to-live for the Client Secret to create. By
default, the TTL will be set to 0 which implies that the
Client Secret will never expire; a value of 0 implies an
infinite lifetime.
example: ...
default: 0
numUsesLimit:
type: number
description: >-
The maximum number of times that the Client Secret can be
used together with the Client ID to get back an access
token; a value of 0 implies infinite number of uses.
example: ...
default: 0
get:
description: ''
summary: List Universal Auth Client Secrets for identity
description: List Universal Auth Client Secrets for identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity for which to get Client Secrets for
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
clientSecretData:
type: array
items:
$ref: >-
#/components/schemas/IdentityUniversalAuthClientSecretData
description: Details of the Client Secrets
security:
- bearerAuth: []
/api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId}/revoke:
post:
description: ''
summary: Revoke Universal Auth Client Secret for identity
description: Revoke Universal Auth Client Secret for identity
parameters:
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity under which Client Secret was issued for
- name: clientSecretId
in: path
required: true
schema:
type: string
description: ID of Client Secret to revoke
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
clientSecretData:
$ref: '#/components/schemas/IdentityUniversalAuthClientSecretData'
description: Details of the revoked Client Secret
security:
- bearerAuth: []
/api/v1/admin/config:
get:
description: ''
@@ -2809,16 +3153,30 @@ paths:
description: OK
/api/v2/organizations/{organizationId}/identity-memberships:
get:
description: ''
summary: Return organization identity memberships
description: Return organization identity memberships
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
description: ID of organization
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityMemberships:
type: array
items:
$ref: '#/components/schemas/IdentityMembershipOrg'
description: Identity memberships of organization
security:
- bearerAuth: []
/api/v2/workspace/{workspaceId}/memberships:
post:
description: ''
@@ -3190,7 +3548,7 @@ paths:
properties:
role:
type: string
description: Role of membership - either admin or member
description: Role to update to for project membership
delete:
summary: Delete project user membership
description: Delete project user membership
@@ -3251,49 +3609,99 @@ paths:
'200':
description: OK
patch:
description: ''
summary: Update project identity membership
description: Update project identity membership
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
description: ID of project
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity whose membership to update in project
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityMembership:
$ref: '#/components/schemas/IdentityMembership'
description: Updated identity membership
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
role:
type: string
description: Role to update to for identity project membership
delete:
description: ''
summary: Delete project identity membership
description: Delete project identity membership
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
description: ID of project
- name: identityId
in: path
required: true
schema:
type: string
description: ID of identity whose membership to delete in project
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityMembership:
$ref: '#/components/schemas/IdentityMembership'
description: Deleted identity membership
security:
- bearerAuth: []
/api/v2/workspace/{workspaceId}/identity-memberships:
get:
description: ''
summary: Return project identity memberships
description: Return project identity memberships
parameters:
- name: workspaceId
in: path
required: true
schema:
type: string
description: ID of project
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
identityMemberships:
type: array
items:
$ref: '#/components/schemas/IdentityMembership'
description: Identity memberships of project
security:
- bearerAuth: []
/api/v2/secret/batch-create/workspace/{workspaceId}/environment/{environment}:
post:
description: ''
@@ -4092,6 +4500,100 @@ components:
createdAt:
type: string
example: '2023-01-13T14:16:12.210Z'
Identity:
type: object
properties:
_id:
type: string
example: ''
name:
type: string
example: Machine 1
authMethod:
type: string
example: universal-auth
IdentityUniversalAuth:
type: object
properties:
_id:
type: string
example: ''
identity:
type: string
example: ''
clientId:
type: string
example: ...
clientSecretTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
example: 0.0.0.0
type:
type: string
example: ipv4
prefix:
type: string
example: '0'
accessTokenTTL:
type: number
example: 7200
accessTokenMaxTTL:
type: number
example: 2592000
accessTokenNumUsesLimit:
type: number
example: 0
accessTokenTrustedIps:
type: array
items:
type: object
properties:
ipAddress:
type: string
example: 0.0.0.0
type:
type: string
example: ipv4
prefix:
type: string
example: '0'
IdentityUniversalAuthClientSecretData:
type: object
properties:
_id:
type: string
example: ''
identityUniversalAuth:
type: string
example: ''
isClientSecretRevoked:
type: boolean
example: false
description:
type: string
example: ''
clientSecretPrefix:
type: string
example: abc
clientSecretNumUses:
type: number
example: 0
clientSecretNumUsesLimit:
type: number
example: 0
clientSecretTTL:
type: number
example: 0
createdAt:
type: string
example: '2023-01-13T14:16:12.210Z'
updatedAt:
type: string
example: '2023-01-13T14:16:12.210Z'
Membership:
type: object
properties:
@@ -4161,6 +4663,51 @@ components:
status:
type: string
example: accepted
IdentityMembership:
type: object
properties:
identity:
type: object
properties:
_id:
type: string
example: ''
name:
type: string
example: Machine 1
authMethod:
type: string
example: universal-auth
workspace:
type: string
example: ''
role:
type: string
example: member
IdentityMembershipOrg:
type: object
properties:
identity:
type: object
properties:
_id:
type: string
example: ''
name:
type: string
example: Machine 1
authMethod:
type: string
example: universal-auth
organization:
type: string
example: ''
role:
type: string
example: member
status:
type: string
example: accepted
Organization:
type: object
properties: