Admin API to list upstream OAuth 2.0 providers

This commit is contained in:
Quentin Gliech
2025-09-19 11:12:48 +02:00
parent cf23688939
commit c1c76177bd
6 changed files with 891 additions and 0 deletions

View File

@@ -3222,6 +3222,143 @@
}
}
}
},
"/api/admin/v1/upstream-oauth-providers": {
"get": {
"tags": [
"upstream-oauth-provider"
],
"summary": "List upstream OAuth 2.0 providers",
"operationId": "listUpstreamOAuthProviders",
"parameters": [
{
"in": "query",
"name": "page[before]",
"description": "Retrieve the items before the given ID",
"schema": {
"description": "Retrieve the items before the given ID",
"$ref": "#/components/schemas/ULID",
"nullable": true
},
"style": "form"
},
{
"in": "query",
"name": "page[after]",
"description": "Retrieve the items after the given ID",
"schema": {
"description": "Retrieve the items after the given ID",
"$ref": "#/components/schemas/ULID",
"nullable": true
},
"style": "form"
},
{
"in": "query",
"name": "page[first]",
"description": "Retrieve the first N items",
"schema": {
"description": "Retrieve the first N items",
"type": "integer",
"format": "uint",
"minimum": 1.0,
"nullable": true
},
"style": "form"
},
{
"in": "query",
"name": "page[last]",
"description": "Retrieve the last N items",
"schema": {
"description": "Retrieve the last N items",
"type": "integer",
"format": "uint",
"minimum": 1.0,
"nullable": true
},
"style": "form"
},
{
"in": "query",
"name": "filter[enabled]",
"description": "Retrieve providers that are (or are not) enabled",
"schema": {
"description": "Retrieve providers that are (or are not) enabled",
"type": "boolean",
"nullable": true
},
"style": "form"
}
],
"responses": {
"200": {
"description": "Paginated response of upstream OAuth 2.0 providers",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaginatedResponse_for_UpstreamOAuthProvider"
},
"example": {
"meta": {
"count": 42
},
"data": [
{
"type": "upstream-oauth-provider",
"id": "01040G2081040G2081040G2081",
"attributes": {
"issuer": "https://accounts.google.com",
"human_name": "Google",
"brand_name": "google",
"created_at": "1970-01-01T00:00:00Z",
"disabled_at": null
},
"links": {
"self": "/api/admin/v1/upstream-oauth-providers/01040G2081040G2081040G2081"
}
},
{
"type": "upstream-oauth-provider",
"id": "02081040G2081040G2081040G2",
"attributes": {
"issuer": "https://appleid.apple.com",
"human_name": "Apple ID",
"brand_name": "apple",
"created_at": "1970-01-01T00:00:00Z",
"disabled_at": "1970-01-01T00:00:00Z"
},
"links": {
"self": "/api/admin/v1/upstream-oauth-providers/02081040G2081040G2081040G2"
}
},
{
"type": "upstream-oauth-provider",
"id": "030C1G60R30C1G60R30C1G60R3",
"attributes": {
"issuer": null,
"human_name": "Custom OAuth Provider",
"brand_name": null,
"created_at": "1970-01-01T00:00:00Z",
"disabled_at": null
},
"links": {
"self": "/api/admin/v1/upstream-oauth-providers/030C1G60R30C1G60R30C1G60R3"
}
}
],
"links": {
"self": "/api/admin/v1/upstream-oauth-providers?page[first]=3",
"first": "/api/admin/v1/upstream-oauth-providers?page[first]=3",
"last": "/api/admin/v1/upstream-oauth-providers?page[last]=3",
"next": "/api/admin/v1/upstream-oauth-providers?page[after]=030C1G60R30C1G60R30C1G60R3&page[first]=3"
}
}
}
}
}
}
}
}
},
"components": {
@@ -4717,6 +4854,105 @@
"$ref": "#/components/schemas/SelfLinks"
}
}
},
"UpstreamOAuthProviderFilter": {
"type": "object",
"properties": {
"filter[enabled]": {
"description": "Retrieve providers that are (or are not) enabled",
"type": "boolean",
"nullable": true
}
}
},
"PaginatedResponse_for_UpstreamOAuthProvider": {
"description": "A top-level response with a page of resources",
"type": "object",
"required": [
"data",
"links",
"meta"
],
"properties": {
"meta": {
"description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta"
},
"data": {
"description": "The list of resources",
"type": "array",
"items": {
"$ref": "#/components/schemas/SingleResource_for_UpstreamOAuthProvider"
}
},
"links": {
"description": "Related links",
"$ref": "#/components/schemas/PaginationLinks"
}
}
},
"SingleResource_for_UpstreamOAuthProvider": {
"description": "A single resource, with its type, ID, attributes and related links",
"type": "object",
"required": [
"attributes",
"id",
"links",
"type"
],
"properties": {
"type": {
"description": "The type of the resource",
"type": "string"
},
"id": {
"description": "The ID of the resource",
"$ref": "#/components/schemas/ULID"
},
"attributes": {
"description": "The attributes of the resource",
"$ref": "#/components/schemas/UpstreamOAuthProvider"
},
"links": {
"description": "Related links",
"$ref": "#/components/schemas/SelfLinks"
}
}
},
"UpstreamOAuthProvider": {
"description": "An upstream OAuth 2.0 provider",
"type": "object",
"required": [
"created_at"
],
"properties": {
"issuer": {
"description": "The OIDC issuer of the provider",
"type": "string",
"nullable": true
},
"human_name": {
"description": "A human-readable name for the provider",
"type": "string",
"nullable": true
},
"brand_name": {
"description": "A brand identifier, e.g. \"apple\" or \"google\"",
"type": "string",
"nullable": true
},
"created_at": {
"description": "When the provider was created",
"type": "string",
"format": "date-time"
},
"disabled_at": {
"description": "When the provider was disabled. If null, the provider is enabled.",
"type": "string",
"format": "date-time",
"nullable": true
}
}
}
}
},
@@ -4768,6 +5004,10 @@
{
"name": "upstream-oauth-link",
"description": "Manage links between local users and identities from upstream OAuth 2.0 providers"
},
{
"name": "upstream-oauth-provider",
"description": "Manage upstream OAuth 2.0 providers"
}
]
}