diff --git a/pkg/services/ssosettings/api/api.go b/pkg/services/ssosettings/api/api.go index 9abbee0dc45..72ea3992854 100644 --- a/pkg/services/ssosettings/api/api.go +++ b/pkg/services/ssosettings/api/api.go @@ -105,6 +105,20 @@ func (api *Api) getProviderSettings(c *contextmodel.ReqContext) response.Respons return response.JSON(http.StatusOK, settings) } +// swagger:route PUT /v1/sso-settings/{key} sso_settings updateProviderSettings +// +// # Update SSO Settings +// +// Inserts or updates the SSO Settings for a provider. +// +// You need to have a permission with action `settings:write` and scope `settings:auth.:*`. +// +// Responses: +// 204: okResponse +// 400: badRequestError +// 401: unauthorisedError +// 403: forbiddenError +// 500: internalServerError func (api *Api) updateProviderSettings(c *contextmodel.ReqContext) response.Response { key, ok := web.Params(c.Req)[":key"] if !ok { @@ -133,9 +147,9 @@ func (api *Api) updateProviderSettings(c *contextmodel.ReqContext) response.Resp // // # Remove SSO Settings // -// # Remove an SSO Settings entry by Key +// Removes the SSO Settings for a provider. // -// You need to have a permission with action `settings:write` with scope `settings:auth.:*`. +// You need to have a permission with action `settings:write` and scope `settings:auth.:*`. // // Responses: // 204: okResponse @@ -160,9 +174,19 @@ func (api *Api) removeProviderSettings(c *contextmodel.ReqContext) response.Resp return response.JSON(http.StatusNoContent, nil) } +// swagger:parameters updateProviderSettings +type UpdateProviderSettingsParams struct { + // in:path + // required:true + Provider string `json:"key"` + // in:body + // required:true + Body models.SSOSettings `json:"body"` +} + // swagger:parameters removeProviderSettings type RemoveProviderSettingsParams struct { // in:path // required:true - Key string `json:"key"` + Provider string `json:"key"` } diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index 1e518971935..7ba4241aee7 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -5737,6 +5737,9 @@ "isEnabled": { "type": "boolean" }, + "slug": { + "type": "string" + }, "title": { "type": "string" }, @@ -6368,6 +6371,24 @@ } } }, + "SSOSettings": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "settings": { + "type": "object", + "additionalProperties": {} + }, + "source": { + "$ref": "#/definitions/SettingsSource" + } + } + }, "SaveDashboardCommand": { "type": "object", "properties": { @@ -6716,6 +6737,10 @@ } } }, + "SettingsSource": { + "type": "integer", + "format": "int64" + }, "ShareType": { "type": "string" }, diff --git a/public/api-merged.json b/public/api-merged.json index b8f0e72300b..9e03dcc5a9a 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -11017,8 +11017,49 @@ } }, "/v1/sso-settings/{key}": { + "put": { + "description": "Inserts or updates the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.", + "tags": [ + "sso_settings" + ], + "summary": "Update SSO Settings", + "operationId": "updateProviderSettings", + "parameters": [ + { + "type": "string", + "name": "key", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SSOSettings" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, "delete": { - "description": "# Remove an SSO Settings entry by Key\n\nYou need to have a permission with action `settings:write` with scope `settings:auth.\u003cprovider\u003e:*`.", + "description": "Removes the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.", "tags": [ "sso_settings" ], @@ -18512,6 +18553,24 @@ } } }, + "SSOSettings": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "settings": { + "type": "object", + "additionalProperties": false + }, + "source": { + "$ref": "#/definitions/SettingsSource" + } + } + }, "Sample": { "type": "object", "title": "Sample is a single sample belonging to a metric.", @@ -18888,6 +18947,10 @@ } } }, + "SettingsSource": { + "type": "integer", + "format": "int64" + }, "ShareType": { "type": "string" }, diff --git a/public/openapi3.json b/public/openapi3.json index f8d3e443373..40cbf3854bc 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -9404,6 +9404,24 @@ }, "type": "object" }, + "SSOSettings": { + "properties": { + "id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "settings": { + "additionalProperties": false, + "type": "object" + }, + "source": { + "$ref": "#/components/schemas/SettingsSource" + } + }, + "type": "object" + }, "Sample": { "properties": { "H": { @@ -9779,6 +9797,10 @@ }, "type": "object" }, + "SettingsSource": { + "format": "int64", + "type": "integer" + }, "ShareType": { "type": "string" }, @@ -24163,7 +24185,7 @@ }, "/v1/sso-settings/{key}": { "delete": { - "description": "# Remove an SSO Settings entry by Key\n\nYou need to have a permission with action `settings:write` with scope `settings:auth.\u003cprovider\u003e:*`.", + "description": "Removes the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.", "operationId": "removeProviderSettings", "parameters": [ { @@ -24196,6 +24218,52 @@ "tags": [ "sso_settings" ] + }, + "put": { + "description": "Inserts or updates the SSO Settings for a provider.\n\nYou need to have a permission with action `settings:write` and scope `settings:auth.\u003cprovider\u003e:*`.", + "operationId": "updateProviderSettings", + "parameters": [ + { + "in": "path", + "name": "key", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SSOSettings" + } + } + }, + "required": true, + "x-originalParamName": "body" + }, + "responses": { + "204": { + "$ref": "#/components/responses/okResponse" + }, + "400": { + "$ref": "#/components/responses/badRequestError" + }, + "401": { + "$ref": "#/components/responses/unauthorisedError" + }, + "403": { + "$ref": "#/components/responses/forbiddenError" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Update SSO Settings", + "tags": [ + "sso_settings" + ] } } },