Enable/Disable Mapping Rules¶
POST /api/v1/sso_mapping/set_disable
Overview¶
Turn the role mapping switch on or off for a single SSO configuration.
Before Calling and Usage Steps¶
This group maps the login attributes of a specific SSO provider to the roles of the current workspace. It differs from custom_login_mapping and the system mapping of LDAP/OIDC in the Deployment Plan. Creating rules does not automatically enable mapping: you must enable isOpenSAMLMapping for the corresponding SSO configuration (set_disable in this group), and the SSO configuration itself must also be enabled.
Attribute names are compared in lowercase; values are not matched as regex or contains. String arrays are matched value by value; non-array objects/numbers/null, etc. are first converted to strings via json.dumps, while array elements are not uniformly converted to strings, so prefer stable string attributes and string arrays from the identity source. Multiple matched roles are unioned. After mapping is enabled for SSO, having no rules/no matches can prevent accounts from entering this workspace, and old associations are removed in subsequent logins/switches; it is not a simple addition of the default role. After the write, the workspace and member caches are refreshed asynchronously, which may affect subsequent access by existing SSO sessions; we cannot promise that it takes effect only at the next login.
isDisable=true turns mapping off and returns to the provider's default role logic: on subsequent logins, existing old role associations are retained, and the default role is added only when there is no old role association; existing mapped roles are not uniformly reset to the default value. Before turning it off, validate the default role: general/readOnly or a valid custom role in this workspace is allowed; Owner/wsAdmin is not allowed. isDisable=false turns mapping on; the current implementation only checks whether the workspace has any active mapping and does not restrict to the target ssoUUID, so even true does not prove that this provider already has matchable rules. First use list?ssoUUID in this group to verify the rules and target roles, to avoid accounts having no permissions after enabling.
This operation only changes SSOSetting.isOpenSAMLMapping; it does not change SSOSetting.status and does not batch-disable mapping rows. When the SSO configuration itself is disabled, turning on mapping does not enable login at the same time. After submission, the workspace/member caches are refreshed asynchronously, and no SSO configuration change email is sent; success does not guarantee that all user authorizations are correct.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or enter: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| ssoUUID | string | Y | Required. This operation verifies that a non-deleted provider exists in this workspace (including disabled configurations). Example: sso_exampleHow to obtain or enter: Obtain the target provider UUID from the SSO configuration list in this workspace. |
| isDisable | boolean | Y | Required boolean; inversely controls isOpenSAMLMapping=1/0 and is not the provider's own enable/disable switch.Allow null: False Example: falseHow to obtain or enter: false enables mapping, true disables it. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/sso_mapping/set_disable' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"ssoUUID":"sso_example","isDisable":false}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | true on success; indicates only that the switch was submitted and the cache task was dispatched successfully. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | The request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The Body is not an object | Some json file format error | Submit a ssoUUID/isDisable object. |
| 406 | ft.NotFoundSAML | The target provider is not a non-deleted configuration in this workspace | sso configuration not found | Re-obtain a valid UUID from the SSO list. |
| 404 | ft.NotFoundSSOMappingEnableFailed | The workspace has no active mapping when enabling | Enable failed, no role mapping rules found | First create a mapping that is actually available for the target provider, then enable. |
| 400 | ft.InvalidSsoRoleCfg | The default role is Owner or wsAdmin when disabling | Administrator and owner role configurations are not supported | First change the SSO default role to an allowed value. |
| 400 | ft.InvalidCustomRole | When disabling, the default custom role is unavailable/not an active role visible in the current workspace | Invalid custom role | Select an available default role from the role list of this workspace. |
| 500 | ft.InternalServerError | An uncaught exception occurs in the saved JSON shape, the database, or task dispatch after submission | Internal error | The database may have committed while cache task dispatch failed; first read back the rules/SSO switch via list, then handle, and keep the traceId. |