Create SSO Configuration¶
POST /api/v1/sso/saml_create
Overview¶
Create a SAML or OIDC identity provider for a workspace.
Before You Call and Usage Steps¶
This is a legacy-address compatibility API, and it is still actually registered in the current source code; the historical "removed on 2026-05-31" comment does not mean requests are currently prohibited. For new integrations, prefer Create SSO Configuration. The legacy path uses the same controller/request fields/response, and OIDC is not excluded because of the saml prefix.
Before creation, register the client/application for Guance in the IdP and confirm the production endpoints and the default role for this workspace. For SAML, submit real complete metadata XML; for OIDC, submit the Base64-encoded clientSecret and the complete configuration. By default, creation uses status=0 and isOpenSAMLMapping=0. After success, the provider may be immediately available for login discovery; do not pass enable/disable fields in this Body. To control access by role mapping, configure the mapping separately and enable it.
This creation does not perform full SSO login acceptance. When wellKnowURL is provided, a real GET service discovery is performed synchronously (TLS verification is enabled by default during the save phase). Without that address, you can use explicit auth/token/userinfo endpoints. Other authentication, code-for-token, and JWT/UserInfo protocol details are only consumed at login. Currently, non-get userinfo still sends GET + Body, so POST endpoints are not guaranteed to work. For OIDC, the default scope is only openid and the user source is origin; if email/profile are needed, specify them explicitly according to IdP permissions and test them in practice. Beyond declared field types, many dynamic fields are not strictly validated when saved; a 200 response does not mean the entire flow can log in.
After the database commit, workspace/member cache refresh tasks are dispatched, which may cause existing SSO access to be re-authenticated; the configuration response does not mean all caches have been refreshed. needNotify defaults to true and sends a configuration reminder to the workspace Owner/administrators; false only suppresses emails, while auditing/caching still proceed. Email delivery failures are logged but do not roll back the configuration. The create response contains the emails whitelist and a snapshot of the data at the creation stage; call get again to verify the actually saved configuration. The secret in the write response is stored ciphertext; only the details get returns the asterisk mask that can be used for retention.
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 fill in: Obtain an OpenAPI Key with the required operation permissions from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| emailDomains[*] | string | Non-empty strings are recommended; the public array does not strictly validate email format item by item, malformed objects/nested arrays may cause 500, and length is controlled by storage at 256. Example: example.comHow to obtain or fill in: Use a single real email/domain identifier and keep it consistent with the email returned by the identity source. |
|
| config.modeType | string | Optional easy/expert, default easy; this field mainly preserves the editing mode and does not automatically validate any expert configuration as executable. Example: expertHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.wellKnowURL | string | Optional HTTP(S) discovery URL. When provided, the save phase performs a real GET and parses JSON (not offline validation); request failures/SSL/HTTP errors return the errors on this page. If omitted, the three endpoints auth/token/userinfo must be explicit; you cannot specify only modeType=expert. Example: https://idp.example.com/.well-known/openid-configurationHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.sslVerify | boolean | TLS verification switch for discovery requests. Defaults to true during the save phase; at runtime the SDK defaults to true for HTTPS and false for HTTP. It is not a master switch for the verify setting of each endpoint. Example: trueHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.clientId | string | Required for OIDC, must be a non-empty string without leading or trailing whitespace; obtained from the IdP client registration, not a Studio API Key. Example: client_exampleHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.clientSecret | string | The OIDC client secret, UTF-8 plaintext, must first be Base64-encoded (the example is the encoding of placeholder plaintext, not the actual secret). For creation, it must be non-empty after decoding and must not be all asterisks; Base64 is not encrypted transport, so HTTPS must be used. When modifying a non-empty config, retain the old secret by taking the Base64 asterisk mask returned by get; omission/empty string will still be rejected by subsequent configuration validation, not treated as a retain instruction. Do not send back the stored ciphertext from create/modify responses. Example: U0VDUkVULVBMQUNFSE9MREVSHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.grantType | string | Optional authorization_code/code; if omitted, runtime defaults to authorization_code. This is not client_credentials or password authorization. Example: authorization_codeHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.scope | array | Optional string array; at runtime the SDK defaults to only [openid], not openid/profile/email as stated in older documentation. Ensure the IdP actually provides claims such as email required by the account; an empty array generates an empty scope, so clients should explicitly configure it reasonably. Example: ["openid", "profile", "email"]How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.scope[*] | string | A scope allowed by a single IdP; this is not a permission point in this workspace. Example: emailHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.authSet | json | Authorization redirect parameter object; may be omitted so that the address is populated from the discovery document. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet | json | Code-for-token request object; the endpoint may be omitted and taken from the discovery document. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet | json | JWK object for id_token signature verification; this does not immediately initiate token authentication for saving the configuration. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet | json | User information source/request object, default origin, not id_token as stated in older documentation. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.claimMapping | json | Mapping from account fields to actual IdP attribute names, not role mapping rules. OIDC does not strictly validate each item when saving, so the callback must be tested in practice; for SAML, a non-empty mapping must provide non-empty username/email at the same time, and mobile is an optional string. An empty object is compatible with old defaults. Example: {"username": "preferred_username", "email": "email", "mobile": "phone_number"}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.authSet.url | string | Optional explicit HTTP(S) URL; if not provided, authorization_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. Example: https://idp.example.com/authorizeHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.authSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.authSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. Example: $client_idHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.url | string | Optional explicit HTTP(S) URL; if not provided, token_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. Example: https://idp.example.com/tokenHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. Example: trueHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. Example: $client_idHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.url | string | Optional explicit HTTP(S) URL; if not provided, jwks_uri is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. Example: https://idp.example.com/jwksHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. Example: trueHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.url | string | Optional explicit HTTP(S) URL; if not provided, userinfo_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. Example: https://idp.example.com/userinfoHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. Example: trueHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. Example: $client_idHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.method | string | Optional get/post, default post; runtime supports only these two. Saving does not enforce this enumeration, and other values will cause errors during subsequent login. Example: postHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getTokenSet.authMethod | string | Optional basic/client_secret_basic (default Basic header), client_secret_post (default form containing ID and secret), none (default only client_id, without automatically including secret). When a custom paramMapping exists, parameters are generated according to the complete mapping; the Basic header still follows the selected authentication method. Example: client_secret_basicHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.method | string | Default get. The current SDK's non-get branch still sends GET but places parameters in the Body, which is not a true POST; for an IdP that requires POST, do not assume support based solely on a successful save. Use a verified GET endpoint. Example: getHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.authMethod | string | Default bearer header; client_secret_basic uses the Basic header; none places access_token in parameters by default. Do not treat the basic alias or any other value as equally effective. Example: bearerHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.source | string | origin calls userinfo (default); id_token verifies and reads id_token; merge reads id_token first and then userinfo, overriding keys with the same name. Saving does not enforce the enumeration, and other values may ultimately result in no user information. Example: originHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.getUserInfoSet.responseInfoPath | string | Optional dot path to the user object in the response, extracted only from origin results; an empty string takes the entire response. This is different from the attribute name in claimMapping. Example: data.userHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.keys | array | Optional array of IdP public JWKs; if non-empty, it is used directly for signature verification; otherwise, at runtime GET verifyTokenSet.url and take keys. These are not private keys; do not treat example placeholder material as real signature verification configuration. Example: []How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.keys[*] | json | A single public JWK; retain the complete structure according to the kty/alg/kid and public key parameters published by the IdP. Example: {}How to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.keys[*].kty | string | Public key type, such as RSA/EC; follow the IdP JWK. Example: RSAHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].kid | string | Identifier used to select the public key. Example: KEY-IDHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].use | string | Key usage. Example: sigHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].alg | string | Signature verification algorithm identifier. Example: RS256How to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].n | string | RSA modulus in Base64url. Example: PUBLIC-MODULUSHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].e | string | RSA public exponent in Base64url. Example: AQABHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].crv | string | EC curve, only for the corresponding type. Example: P-256How to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].x | string | EC public x coordinate. Example: PUBLIC-XHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].y | string | EC public y coordinate. Example: PUBLIC-YHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].x5c | array | Optional array of Base64 DER public certificate chains. Example: ["PUBLIC-CERTIFICATE"]How to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].x5c[*] | string | A single public certificate, containing no private key. Example: PUBLIC-CERTIFICATEHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.verifyTokenSet.keys[*].otherPublicFields | JSON | IdP JWK extensions are retained according to the library protocol; do not add private key material such as d/p/q. Example: VALUEHow to obtain or fill in: Obtain the complete public value from the IdP's production JWKS; do not guess or construct it manually. |
|
| config.claimMapping.username | string | OIDC default preferred_username; SAML default username. For SAML, when claimMapping is explicitly non-empty, this must be a non-empty string. Example: preferred_usernameHow to obtain or fill in: Ask the IdP administrator for the real attribute name; field mapping does not mean fixing a phone number/email as the value. |
|
| config.claimMapping.email | string | Default email; actual login must obtain a valid email. For SAML, required when claimMapping is explicitly non-empty; OIDC does not validate the value/source when saving, but the callback still requires an email. Example: emailHow to obtain or fill in: Ask the IdP administrator for the real attribute name; field mapping does not mean fixing a phone number/email as the value. |
|
| config.claimMapping.name | string | Optional OIDC display name attribute, default name; SAML currently always reads name, and this mapping key does not change its display name extraction. Example: nameHow to obtain or fill in: Ask the IdP administrator for the real attribute name; field mapping does not mean fixing a phone number/email as the value. |
|
| config.claimMapping.mobile | string | OIDC default phone_number; SAML default mobile; an explicit empty string means no extraction. If there is no number, it is not added; existing phone numbers and area codes are retained, and it is added only when the original account has no number and the IdP number is valid. Example: phone_numberHow to obtain or fill in: Ask the IdP administrator for the real attribute name; field mapping does not mean fixing a phone number/email as the value. |
|
| config.authSet.verify | boolean | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. Example: trueHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.method | string | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. Example: getHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| config.verifyTokenSet.authMethod | string | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. Example: getHow to obtain or fill in: Obtain from the production OIDC configuration assigned by the identity provider for the current client and the actual protocol documentation. |
|
| type | string | Y | Required for creation; when modifying, the type follows the original configuration, and type is not accepted to change the protocol. Allowed null: False Allowed values: ['saml', 'oidc'] Example: oidcHow to obtain or fill in: Choose saml or oidc according to the identity provider protocol. |
| idpData | string | Required for SAML creation by business logic; must contain entityID, SSO service address, and key description. Omitting/empty string on modification keeps the old XML. When SAML submits a non-empty config, valid XML must also be provided. Do not pass for OIDC; for OIDC, if only idpData changes and there is no config, the identity digest may be written as None and cause 500. Allowed null: False Example: <IdP_METADATA_XML>How to obtain or fill in: Download the complete valid IdP metadata XML from the SAML identity provider administrator and submit it as the original string. |
|
| config | json | Dynamic complete configuration object, required for OIDC creation. If omitted or {} on modification, the old config is kept; a non-empty object replaces it entirely rather than recursively merging, and OIDC must include clientId/clientSecret/valid URLs, etc. SAML cannot submit only a non-empty config while omitting idpData. Not all internal field types are strongly validated; a successful save does not prove the callback works. Allowed null: False Example: {}How to obtain or fill in: For OIDC, construct it from the provider client/discovery document and protocol parameters; for SAML, it is used only for optional claimMapping. |
|
| emailDomains | array | Y | Required array; can be [], and the server deduplicates with a set. It is not a URL, regex, or wildcard with @; initial entry discovery matches by exact full email or domain, and existing SSO identities have separate namespace/workspace relationship rules. It cannot replace general access control. On modification, the whitelist is replaced entirely; [] clears it. Example: ["example.com"]How to obtain or fill in: Use the complete email or email domain allowed to discover this provider, such as user@guance.com or example.com. |
| idpName | string | Y | Required, ≤64 characters, declared regex [a-zA-Z_一-龥-]*; it is recommended to use only letters/Chinese characters/underscores/hyphens, without digits/spaces. The current regex is not fully anchored, which does not mean arbitrary trailing characters are reliably rejected. Non-deleted provider names in the same workspace must be unique; only a non-empty value on modification overwrites the old name. Maximum length: 64 $matchRegExp: [a-zA-Z_一-龥-]* Example: ExampleIdPHow to obtain or fill in: A name that distinguishes the identity provider in the current workspace from a business perspective. |
| role | string | Y | Required; general/readOnly or an active custom role visible in this workspace; owner/wsAdmin are prohibited. When mapping is disabled, it is used to create role relationships and does not guarantee overriding all old roles of existing members; when role mapping is enabled, access is determined by mapping matches. Allowed null: False Allowed empty string: False Example: generalHow to obtain or fill in: Select the default login role from the Role List in this workspace. |
| remark | string | Optional, empty string allowed; when omitted on creation, the constructed response may be null, and the database column has an empty string default; explicitly provide an empty string or valid text. Omitting on modification clears it to "", not retains it; the storage column is 512, and no unified public upper limit is declared. Allowed null: False Allowed empty string: True Example: 企业登录How to obtain or fill in: The business party fills in a purpose remark. |
|
| tokenHoldTime | integer | Optional, 60..604800 seconds; if omitted on creation, the site default is used (repository baseline 604800 = 7 days); if omitted on modification, the old value is kept. This is not the cache code validity period; do not use this value to expand the one-time authentication code consumption window. Allowed null: False $minValue: 60 $maxValue: 604800 Example: 604800How to obtain or fill in: Choose the number of seconds according to the organization's inactivity session retention policy. |
|
| tokenMaxValidDuration | integer | Optional, 60..2592000 seconds; if omitted on creation, the site default is used (repository baseline 2592000 = 30 days); if omitted on modification, it is kept. The old statement "30 days = 604800" is incorrect; this does not replace the inactivity hold duration. Allowed null: False $minValue: 60 $maxValue: 2592000 Example: 2592000How to obtain or fill in: Choose the number of seconds according to the organization's maximum login session lifetime. |
|
| needNotify | boolean | Optional on create/modify, default true; false only suppresses configuration reminder emails and does not prevent configuration saving, cache refresh, or auditing. It does not disable SSO or prohibit user login. Allowed null: False Example: falseHow to obtain or fill in: Whether to notify the workspace Owner/administrators of configuration changes; for batch rehearsals, you can explicitly set false according to the process. |
Additional Parameter Notes¶
OIDC custom parameter mappings are used by stage:
| Stage | Supported variable values |
|---|---|
| authSet | $state, $client_id, $client_secret, $redirect_uri, $scope, $response_type (code), $grant_type; do not put secret in the browser URL |
| getTokenSet | $state, $code, $client_id, $client_secret, $redirect_uri, $scope, $grant_type; if other keys match callback parameter names, their values may be taken; otherwise they are treated as fixed text |
| getUserInfoSet | $client_id, $client_secret, $redirect_uri, $scope, $access_token |
A non-empty mapping object replaces default request parameters and does not automatically fill in missing required items such as redirect_uri/code/scope. Saving validates only some URL/client fields and does not execute the complete authentication flow; verify the actual callback and final workspace access on a dedicated test identity.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/sso/saml_create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"emailDomains":["example.com"],"idpName":"ExampleIdP","role":"general","remark":"企业登录","config":{"modeType":"expert","clientId":"client_example","clientSecret":"U0VDUkVULVBMQUNFSE9MREVS","scope":["openid","profile","email"],"grantType":"authorization_code","authSet":{"url":"https://idp.example.com/authorize"},"getTokenSet":{"url":"https://idp.example.com/token","method":"post","authMethod":"client_secret_basic"},"verifyTokenSet":{"url":"https://idp.example.com/jwks"},"getUserInfoSet":{"url":"https://idp.example.com/userinfo","method":"get","authMethod":"bearer","source":"origin"},"claimMapping":{"username":"preferred_username","email":"email","mobile":"phone_number"}},"tokenHoldTime":604800,"tokenMaxValidDuration":2592000,"needNotify":false,"type":"oidc"}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Current record number; the constructed result may be null before a new record is submitted. |
| content.uuid | string | SSO configuration UUID. |
| content.type | string | saml/oidc. |
| content.workspaceUUID | string | Workspace to which it belongs. |
| content.idpName | string | Provider display name. |
| content.remark | string or null | Remark; may be null for old/new historical records. |
| content.role | string | Default role identifier. |
| content.idpMd5 | string | Provider identity/account namespace digest, not a client secret or writable ID. |
| content.tokenHoldTime | integer | Number of seconds to retain an inactive session. |
| content.tokenMaxValidDuration | integer | Maximum number of seconds for a login session. |
| content.isOpenSAMLMapping | integer or boolean | Role mapping switch 1/0; not the same as SSO configuration status. |
| content.status | integer | 0 enabled, 2 disabled; reads for non-deleted records may contain other historical statuses. |
| content.creator | string | Creator identity. |
| content.updator | string | Updater identity. |
| content.createAt | integer | Creation Unix seconds. |
| content.updateAt | integer | Update Unix seconds; may be -1 if not updated. |
| content.deleteAt | integer | Deletion Unix seconds; -1 if not deleted. |
| content.uploadData | string | Complete IdP metadata XML saved for SAML; usually an empty string for OIDC. |
| content.config | object | Complete configuration after saving; the OIDC write response still contains stored ciphertext, not the Base64 asterisk mask from get, and cannot be used directly for authentication or to fill back in. |
| content.config.modeType | string | Optional easy/expert, default easy; this field mainly preserves the editing mode and does not automatically validate any expert configuration as executable. |
| content.config.wellKnowURL | string | Optional HTTP(S) discovery URL. When provided, the save phase performs a real GET and parses JSON (not offline validation); request failures/SSL/HTTP errors return the errors on this page. If omitted, the three endpoints auth/token/userinfo must be explicit; you cannot specify only modeType=expert. |
| content.config.sslVerify | boolean | TLS verification switch for discovery requests. Defaults to true during the save phase; at runtime the SDK defaults to true for HTTPS and false for HTTP. It is not a master switch for the verify setting of each endpoint. |
| content.config.clientId | string | Required for OIDC, must be a non-empty string without leading or trailing whitespace; obtained from the IdP client registration, not a Studio API Key. |
| content.config.clientSecret | string | For OIDC, the write response is server-side stored ciphertext and cannot be sent back as Base64 plaintext/mask; to retain the secret on modification, first call get to obtain the mask. |
| content.config.grantType | string | Optional authorization_code/code; if omitted, runtime defaults to authorization_code. This is not client_credentials or password authorization. |
| content.config.scope | array | Optional string array; at runtime the SDK defaults to only [openid], not openid/profile/email as stated in older documentation. Ensure the IdP actually provides claims such as email required by the account; an empty array generates an empty scope, so clients should explicitly configure it reasonably. |
| content.config.scope[] | string | A scope allowed by a single IdP; this is not a permission point in this workspace. |
| content.config.authSet | json | Authorization redirect parameter object; may be omitted so that the address is populated from the discovery document. |
| content.config.getTokenSet | json | Code-for-token request object; the endpoint may be omitted and taken from the discovery document. |
| content.config.verifyTokenSet | json | JWK object for id_token signature verification; this does not immediately initiate token authentication for saving the configuration. |
| content.config.getUserInfoSet | json | User information source/request object, default origin, not id_token as stated in older documentation. |
| content.config.claimMapping | json | Mapping from account fields to actual IdP attribute names, not role mapping rules. OIDC does not strictly validate each item when saving, so the callback must be tested in practice; for SAML, a non-empty mapping must provide non-empty username/email at the same time, and mobile is an optional string. An empty object is compatible with old defaults. |
| content.config.authSet.url | string | Optional explicit HTTP(S) URL; if not provided, authorization_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. |
| content.config.authSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. |
| content.config.authSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. |
| content.config.getTokenSet.url | string | Optional explicit HTTP(S) URL; if not provided, token_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. |
| content.config.getTokenSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. |
| content.config.getTokenSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. |
| content.config.getTokenSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. |
| content.config.verifyTokenSet.url | string | Optional explicit HTTP(S) URL; if not provided, jwks_uri is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. |
| content.config.verifyTokenSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. |
| content.config.getUserInfoSet.url | string | Optional explicit HTTP(S) URL; if not provided, userinfo_endpoint is taken from the discovery document. If provided, it overrides the runtime endpoint; when there is no discovery document, auth/token/userinfo are all required, and the signature verification source must separately ensure JWK availability. |
| content.config.getUserInfoSet.verify | boolean | Optional; for this endpoint, HTTPS defaults to true and HTTP defaults to false. Configure it separately; sslVerify does not uniformly replace it. |
| content.config.getUserInfoSet.paramMapping | json | Optional mapping of non-standard request parameters. When non-empty, it replaces the corresponding default parameter set and must fully retain required items; keys are IdP parameter names, and values can be $ variables allowed on this page or fixed strings. Do not map clientSecret into the authorization redirect URL. |
| content.config.getUserInfoSet.paramMapping.targetParameterName | string | Dynamic IdP parameter value. The allowed variable range varies by stage; see the table below. Unknown strings are retained as constants and are not automatically taken from arbitrary internal context. |
| content.config.getTokenSet.method | string | Optional get/post, default post; runtime supports only these two. Saving does not enforce this enumeration, and other values will cause errors during subsequent login. |
| content.config.getTokenSet.authMethod | string | Optional basic/client_secret_basic (default Basic header), client_secret_post (default form containing ID and secret), none (default only client_id, without automatically including secret). When a custom paramMapping exists, parameters are generated according to the complete mapping; the Basic header still follows the selected authentication method. |
| content.config.getUserInfoSet.method | string | Default get. The current SDK's non-get branch still sends GET but places parameters in the Body, which is not a true POST; for an IdP that requires POST, do not assume support based solely on a successful save. Use a verified GET endpoint. |
| content.config.getUserInfoSet.authMethod | string | Default bearer header; client_secret_basic uses the Basic header; none places access_token in parameters by default. Do not treat the basic alias or any other value as equally effective. |
| content.config.getUserInfoSet.source | string | origin calls userinfo (default); id_token verifies and reads id_token; merge reads id_token first and then userinfo, overriding keys with the same name. Saving does not enforce the enumeration, and other values may ultimately result in no user information. |
| content.config.getUserInfoSet.responseInfoPath | string | Optional dot path to the user object in the response, extracted only from origin results; an empty string takes the entire response. This is different from the attribute name in claimMapping. |
| content.config.verifyTokenSet.keys | array | Optional array of IdP public JWKs; if non-empty, it is used directly for signature verification; otherwise, at runtime GET verifyTokenSet.url and take keys. These are not private keys; do not treat example placeholder material as real signature verification configuration. |
| content.config.verifyTokenSet.keys[] | json | A single public JWK; retain the complete structure according to the kty/alg/kid and public key parameters published by the IdP. |
| content.config.verifyTokenSet.keys[].kty | string | Public key type, such as RSA/EC; follow the IdP JWK. |
| content.config.verifyTokenSet.keys[].kid | string | Identifier used to select the public key. |
| content.config.verifyTokenSet.keys[].use | string | Key usage. |
| content.config.verifyTokenSet.keys[].alg | string | Signature verification algorithm identifier. |
| content.config.verifyTokenSet.keys[].n | string | RSA modulus in Base64url. |
| content.config.verifyTokenSet.keys[].e | string | RSA public exponent in Base64url. |
| content.config.verifyTokenSet.keys[].crv | string | EC curve, only for the corresponding type. |
| content.config.verifyTokenSet.keys[].x | string | EC public x coordinate. |
| content.config.verifyTokenSet.keys[].y | string | EC public y coordinate. |
| content.config.verifyTokenSet.keys[].x5c | array | Optional array of Base64 DER public certificate chains. |
| content.config.verifyTokenSet.keys[].x5c[] | string | A single public certificate, containing no private key. |
| content.config.verifyTokenSet.keys[].otherPublicFields | JSON | IdP JWK extensions are retained according to the library protocol; do not add private key material such as d/p/q. |
| content.config.claimMapping.username | string | OIDC default preferred_username; SAML default username. For SAML, when claimMapping is explicitly non-empty, this must be a non-empty string. |
| content.config.claimMapping.email | string | Default email; actual login must obtain a valid email. For SAML, required when claimMapping is explicitly non-empty; OIDC does not validate the value/source when saving, but the callback still requires an email. |
| content.config.claimMapping.name | string | Optional OIDC display name attribute, default name; SAML currently always reads name, and this mapping key does not change its display name extraction. |
| content.config.claimMapping.mobile | string | OIDC default phone_number; SAML default mobile; an explicit empty string means no extraction. If there is no number, it is not added; existing phone numbers and area codes are retained, and it is added only when the original account has no number and the IdP number is valid. |
| content.config.authSet.verify | boolean | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. |
| content.config.verifyTokenSet.method | string | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. |
| content.config.verifyTokenSet.authMethod | string | Compatible existing configurations can be saved, but the current OIDC SDK does not consume this key and it cannot be used to control requests/TLS; use the corresponding field actually read on this page. |
| content.loginURL | string | Login entry for this provider, returned by the deployment site; this is not the current OpenAPI path accessed with DF-API-KEY. |
| content.callbackURL | string | OIDC callback URL only; must be registered in the IdP's allowed callback list. |
| content.metadataURL | string | SAML SP metadata address only. |
| content.entiryID | string | SAML SP entity ID only; retain the protocol's actual spelling entiryID and do not change it to entityID. |
| content.assertionURL | string | SAML ACS/assertion callback address only; register according to the actual returned value. |
| content.emails | array<string> | Array of deduplicated whitelist values after creation. |
| content.emails[] | string | Complete email or domain value. |
| content.declaration | object or null | Workspace public declaration attached to a non-empty business object; when not configured, it may be null or an empty object; an empty object is not added. The exact position in pagination is subject to the structure on this page. |
{
"code": 200,
"content": {
"id": null,
"uuid": "sso_example",
"type": "oidc",
"workspaceUUID": "wksp_example",
"idpName": "ExampleIdP",
"remark": "企业登录",
"role": "general",
"idpMd5": "IDP-IDENTITY-HASH",
"tokenHoldTime": 604800,
"tokenMaxValidDuration": 2592000,
"isOpenSAMLMapping": 0,
"status": 0,
"creator": "wsak_example",
"updator": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427200,
"deleteAt": -1,
"config": {
"modeType": "expert",
"clientId": "client_example",
"clientSecret": "STORED-CIPHERTEXT-PLACEHOLDER",
"scope": [
"openid",
"profile",
"email"
],
"grantType": "authorization_code",
"authSet": {
"url": "https://idp.example.com/authorize"
},
"getTokenSet": {
"url": "https://idp.example.com/token",
"method": "post",
"authMethod": "client_secret_basic"
},
"verifyTokenSet": {
"url": "https://idp.example.com/jwks"
},
"getUserInfoSet": {
"url": "https://idp.example.com/userinfo",
"method": "get",
"authMethod": "bearer",
"source": "origin"
},
"claimMapping": {
"username": "preferred_username",
"email": "email",
"mobile": "phone_number"
}
},
"uploadData": "",
"loginURL": "https://sso.example.com/oidc/login/sso_example",
"callbackURL": "https://sso.example.com/oidc/callback/sso_example",
"declaration": {},
"emails": [
"example.com"
]
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
SAML request example: first replace <IdP_METADATA_XML> with the complete valid XML provided by the administrator (do not save directly with this placeholder text). The modification target must originally be SAML.
curl --request POST '<Endpoint>/api/v1/sso/saml_create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"emailDomains":["example.com"],"idpName":"ExampleSAML","role":"general","remark":"SAML登录","idpData":"<IdP_METADATA_XML>","config":{"claimMapping":{"username":"uid","email":"mail","mobile":"telephone"}},"needNotify":false,"type":"saml"}'
Example OIDC successful configuration response (secret is a stored ciphertext placeholder and cannot be filled back in):
{
"code": 200,
"content": {
"id": null,
"uuid": "sso_example",
"type": "oidc",
"workspaceUUID": "wksp_example",
"idpName": "ExampleIdP",
"remark": "企业登录",
"role": "general",
"idpMd5": "IDP-IDENTITY-HASH",
"tokenHoldTime": 604800,
"tokenMaxValidDuration": 2592000,
"isOpenSAMLMapping": 0,
"status": 0,
"creator": "wsak_example",
"updator": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427200,
"deleteAt": -1,
"config": {
"modeType": "expert",
"clientId": "client_example",
"clientSecret": "STORED-CIPHERTEXT-PLACEHOLDER",
"scope": [
"openid",
"profile",
"email"
],
"grantType": "authorization_code",
"authSet": {
"url": "https://idp.example.com/authorize"
},
"getTokenSet": {
"url": "https://idp.example.com/token",
"method": "post",
"authMethod": "client_secret_basic"
},
"verifyTokenSet": {
"url": "https://idp.example.com/jwks"
},
"getUserInfoSet": {
"url": "https://idp.example.com/userinfo",
"method": "get",
"authMethod": "bearer",
"source": "origin"
},
"claimMapping": {
"username": "preferred_username",
"email": "email",
"mobile": "phone_number"
}
},
"uploadData": "",
"loginURL": "https://sso.example.com/oidc/login/sso_example",
"callbackURL": "https://sso.example.com/oidc/callback/sso_example",
"declaration": {},
"emails": [
"example.com"
]
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
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 | Request field missing, or field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | Body top level is not a JSON object | Some JSON file format error | Submit a complete object containing the fields on this page. |
| 406 | ft.ParameterValidationFailed | SAML claimMapping structure is invalid, or declared field type/enum/range does not match | Parameter parsing failed | For a non-empty SAML mapping, provide non-empty username/email at the same time, and mobile must be a string; fix according to the public parameter table. |
| 400 | ft.InvalidSsoRoleCfg | Default role is owner/wsAdmin | Administrator and owner role configurations are not supported | Use general/readOnly or an active custom role in this workspace. |
| 400 | ft.InvalidCustomRole | Default custom role does not exist, is disabled/deleted, or is not visible in the current workspace | Invalid custom role | Take a valid role from the current workspace role list; do not use the display name. |
| 406 | ft.InvalidOIDC | OIDC creation has no non-empty config | Invalid OIDC configuration | Submit the complete client and endpoint configuration. |
| 406 | ft.InvalidSAML | SAML is missing valid XML, metadata lacks entity/service/key description, or a non-empty config is modified without providing valid idpData | Invalid SAML configuration | Download the real complete metadata XML from the IdP; when updating field mappings, provide the original valid XML at the same time. |
| 400 | ft.SsoModeTypeInvalid | OIDC modeType is not easy/expert | Invalid modeType parameter | Choose according to the enumeration on this page. |
| 400 | ft.SsoClientIdInvalid | clientId is empty/not a string or has leading/trailing whitespace | Invalid clientId parameter | Use the original client ID assigned by the IdP. |
| 400 | ft.SsoClientSecretInvalid | clientSecret is not valid Base64 UTF-8, is empty/all asterisks after decoding during creation, or a non-empty config lacks a valid clientSecret string | Invalid clientSecret parameter | Encode the real secret for creation; to retain the old value on modification, use the Base64 asterisk mask returned by get, and do not fill back the stored ciphertext. |
| 400 | ft.SsoSSLVerifyInvalid | SSL verification failed for the discovery document request during saving | SSL verification exception: {} | Check the certificate chain/domain and trust, and configure sslVerify according to organizational policy. |
| 400 | ft.SsoWellKnowURLInvalid | wellKnowURL is not a valid HTTP(S) address or the discovery request returns HTTP>=400 | Invalid identity provider URL (wellKnowURL) parameter | Check the production discovery address and service response; do not use a login page URL instead. |
| 400 | ft.SsoVerifyWellKnowURLInvalid | Discovery request connection/JSON parsing failed, etc. | Failed to verify identity provider URL (wellKnowURL) parameter, err:{} | Check the address, network, and JSON response, retain traceId, and do not repeatedly submit the same incorrect configuration. |
| 400 | ft.SsoAuthSetInvalid | Explicit authSet.url is not a valid HTTP(S) address | {} parameter invalid | Use the production authorization_endpoint. |
| 400 | ft.SsoTokenEndPointInvalid | Explicit getTokenSet.url is invalid | {} parameter invalid | Use the production token_endpoint. |
| 400 | ft.SsoVerifyTokenSetInvalid | Explicit verifyTokenSet.url is invalid | {} parameter invalid | Use the production JWKS address. |
| 400 | ft.SsoUserInfoEndPointInvalid | Explicit getUserInfoSet.url is invalid | {} parameter invalid | Use the production userinfo_endpoint. |
| 400 | ft.SsoOIDCUrlsInvalid | No wellKnowURL and the three endpoints auth/token/userinfo are incomplete | Invalid url parameter | Provide all three production addresses; a successful save does not mean the entire protocol has been accepted. |
| 400 | ft.SsoGrantTypeInvalid | grantType is not authorization_code/code | Invalid grantType; currently only code and authorization_code are supported | Change to a supported authorization method. |
| 400 | ft.SSOEsistsSameSupplier | Duplicate non-deleted provider name in the same workspace; exclude itself on modification | A provider with the same name already exists | Modify using the existing UUID or choose a unique name. |
| 400 | ft.SSOEsistsSameIdp | A non-deleted configuration in the same workspace has the same IdP identity digest; exclude itself on modification | A configuration with the same metadata file already exists | Check the existing provider; do not create the same identity again by changing the display name. |
| 500 | ft.InternalServerError | Unhandled exception in dynamic config or email element shape, storage, key encryption, XML tooling, or post-submit cache tasks/auditing | Internal error | The creation may have been submitted. First locate it by idpName in this workspace's SSO list, then get to verify the configuration and whitelist; if it already exists, handle the incomplete steps and do not blindly create it again. Retain traceId. |
| 400 | ft.SSOCfgExceedQuantityLimit | After the addition, the number of configurations for the corresponding protocol exceeds the site limit (disabled but not deleted configurations are also counted) | The number of SSO configurations exceeds the limit | Check the count and deletable historical configurations from the SSO list; the site default is 10 per type, subject to the actual upper limit configuration. |