Delete Mapping Configuration¶
POST /api/v1/login_mapping/field/{lgmp_uuid}/delete
Overview¶
Soft-deletes the specified system login mapping rule.
Before Calling and Usage Steps¶
First, verify the uuid, source attribute, and target workspace from the System Login Mapping List. This API has no body and deletes only one active system rule. Repeated deletion or passing a workspace custom rule UUID returns 404. Deleting the configuration does not mean immediately revoking granted user roles or existing sessions. How subsequent related logins change permissions depends on the current mode: GlobalValid may clean up unmatched direct relationships, while Append usually retains existing system-granted relationships; when workspace custom mapping is enabled, it is also controlled by its priority rules. When permissions need to be revoked immediately, verify and handle this through the member/role and session management processes.
Route Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| lgmp_uuid | string | Y | Active system mapping UUID, not Workspace UUID. Example: lgmp_example001How to obtain or enter: Obtain from content.data[].uuid in the System Login Mapping List. |
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Signature version for the original path and request body; cannot be omitted and then continue using the algorithm on this page. Example: v20240417How to obtain or enter: The example on this page uses this fixed version, which is paired with the example signing algorithm. |
|
| X-Df-Access-Key | string | Y | Read endpoints can use r or w credentials; write endpoints require w credentials. Example: <external-access-key>How to obtain or enter: External API AK assigned by the site administrator; the Workspace OpenAPI Key cannot be used. |
| X-Df-Signature | string | Y | Concatenate the uppercase method, nonce, original full path, timestamp, and original UTF-8 request body with spaces, then compute HMAC-SHA256 and take the hex digest. Example: <hmac-sha256-hex>How to obtain or enter: Compute using the paired SK according to External API Signature Authentication; see below for a complete runnable template. |
| X-Df-Timestamp | string | Y | Must be within the signature validity window configured for the site; do not reuse the example time. Example: 1785427200How to obtain or enter: When sending, use str(int(time.time())) to generate the current Unix seconds string. |
| X-Df-Nonce | string | Y | Temporary serial number; when resending after a failure, also generate a new value and recompute the signature. Example: 97d275ee9f774315a7885ba7347acbd9How to obtain or enter: Generate uuid.uuid4().hex again for each request. |
Additional Parameter Notes¶
Authentication method: see External API Signature Authentication. This module manages site system login mappings (isSystem=1), which are used by third-party logins such as OIDC/LDAP that use the shared login mapping flow; it is not a workspace custom mapping or an independent SAML settings API. Saving the configuration does not immediately batch-recalculate all existing user permissions; subsequent related logins are handled according to the mode.
When system mapping is enabled and custom mapping is disabled for the target workspace: ValidOnFirstLogin applies system rules only to accounts with no historical direct workspace associations (history includes deleted associations), and is not equivalent to only determining whether an account is newly created this time; GlobalValid replaces direct roles according to the rules on each related login, and can remove direct member/role relationships when unmatched; Append only appends matching system roles and does not clear original direct relationships when unmatched. If custom mapping is enabled for a workspace, that workspace preferentially executes replacement/unmatched cleanup according to custom rules and cannot apply the retention semantics of system Append or first-login mode. Disabling the system switch does not simultaneously disable workspace custom rules. Existing direct Owner roles are retained during matching and are not newly granted Owner through this module.
Request Example¶
import hashlib
import hmac
import json
import time
import uuid
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
# Replace with the target site address and the External API AK/SK assigned by the administrator.
server = "https://external-api.guance.com"
access_key = "<external-access-key>"
secret_key = "<external-secret-key>"
method = 'POST'
path = '/api/v1/login_mapping/field/lgmp_example001/delete'
query = {}
data = None
full_path = path + ("?" + urlencode(query) if query else "")
body = "" if data is None else json.dumps(data, ensure_ascii=False, separators=(",", ":"))
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
string_to_sign = " ".join([method, nonce, full_path, timestamp, body])
signature = hmac.new(secret_key.encode("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha256).hexdigest()
headers = {
"X-Df-Access-Key": access_key,
"X-Df-Timestamp": timestamp,
"X-Df-Nonce": nonce,
"X-Df-Signature": signature,
"X-Df-SVersion": "v20240417",
}
if data is not None:
headers["Content-Type"] = "application/json"
request = Request(server + full_path, data=None if data is None else body.encode("utf-8"), headers=headers, method=method)
try:
with urlopen(request, timeout=30) as result:
payload = json.loads(result.read().decode("utf-8"))
except HTTPError as error:
print("HTTP", error.code, error.read().decode("utf-8")) # Handle according to errorCode, content, and traceId; do not output AK/SK.
raise SystemExit(1)
except (URLError, TimeoutError):
print('请求结果未知,请先核对目标当前状态及是否已经写入,再决定是否重新签名重试;不要自动重复写请求。')
raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))
Response¶
HTTP 200, application/json unified envelope; External does not automatically inject declaration; list pagination is in content.pageInfo.
| Field | Type | Description |
|---|---|---|
| content | boolean | true when configuration deletion is complete; does not return the affected user list, nor does it mean user permissions have been immediately recalculated. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
Authentication, rate limiting, and common request errors: see Common Error Definitions.
Confirmed rule and request errors are listed in the table. Ordinary database/cache/audit exceptions ultimately result in 500 ft.InternalServerError; a subsequent error may occur only after the configuration has been committed; read the current state before retrying.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling Method |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field missing, or field value violates declared validation conditions | Parameter parsing failed | Check parameter location, field name, type, and value. |
| 404 | ft.LoginMappingNoExists | UUID does not exist, has been deleted, is not active status=0, or is not a system mapping | Specified Login Mapping not found | Reselect a valid uuid from this module's system mapping list; do not use a workspace custom rule UUID. |
| 500 | ft.InternalServerError | Database, site configuration cache, audit, or unhandled historical data exception | Internal error | Retain traceId and first read the rule or switch to confirm the current state; database and cache/audit are not in the same transaction, and an error does not prove that nothing was saved. |