OAuth JWT 전달자 권한 유형에 대한 템플릿 구성

  • 릴리스 버전: Xanadu
  • 업데이트 날짜 2024년 08월 01일
  • 읽기9분
  • 이 예제 구성 템플릿은 Docusign에 대한 요청을 인증하기 위해 JWT 전달자 권한 유형을 사용하여 자격 증명 및 연결 기록을 설정합니다.

    기본 데이터 템플릿

    기본 데이터 템플릿의 각 최상위 항목은 연결된 기록을 생성합니다. 템플릿에는 다음 섹션이 포함되어 있습니다.

    • 자격 증명: 자격 증명 테이블에 기록을 만듭니다.
    • 연결: 연결 [sys_connection] 테이블에 기록을 만들고 연결된 연결 기록을 만듭니다.
    • 추가: 필요에 따라 사용자 지정 테이블에 기록을 생성합니다. 후처리 스크립트는 이러한 기록으로 수행할 작업을 시스템에 지시합니다.

    다음 예에서는 OAuth JWT 전달자 권한 부여 유형 인증에 필요한 레코드를 생성합니다.

    {
      "credential": {
        "oauth_entity": {
          "oauth_entity_profile": [
            {
              "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
              "name": "Docusign Profile",
              "default": true,
              "oauth_entity_profile_scope": [
                "users:read.email"
              ]
            }
          ],
          "code_challenge_method": "S256",
          "type": "consumer",
          "oauth_entity_scope": [
            {
              "oauth_entity_scope": "users:read.email",
              "name": "email"
            }
          ],
          "client_id": "<provider-client-id>",
          "use_mutual_auth": false,
          "revoke_token_url": "https://<provider-domain-name>.com/oauth2/revoke",
          "default_grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
          "public_client": false,
          "oauth_api_script": "3e3a3a11c333210016194ffe5bba8f70",
          "name": "Docusign Spoke OAuth",
          "client_secret": "<provider-client-secret>",
          "auth_url": "https://<provider-domain-name>.com/oauth2/auth",
          "token_url": "https://<provider-domain-name>.com/oauth2/token",
          "redirect_url": "https://<instance-name>.service-now.com/oauth_redirect.do"
        },
        "jwt_provider": {
          "jwt_keystore_aliases": {
            "kid": "<provider-key-id>",
            "name": "Docusign Spoke JWT Key",
            "signing_keystore": "<signing-keystore-sys-id>",
            "signing_algorithm": "rsa_256",
            "signing_key_password": "password"
          },
          "jwt_claim_validation" : [ {
            "name" : "iss",
            "is_standard" : true,
            "data_type" : "string",
            "value":"<docusign-iss-claim>"
          }, {
            "name" : "sub",
            "is_standard" : true,
            "data_type" : "string",
            "value":"<docusign-sub-claim>"
          }, {
            "name" : "aud",
            "is_standard" : true,
            "data_type" : "string",
            "value":"<docusign-aud-claim>"
          }, {
            "name" : "scope",
            "is_standard" : false,
            "data_type" : "string",
            "value" : "signature impersonation"
          } ],
          "name": "Docusign Spoke JWT Provider",
          "jwt_api_script": "9ef6af86ff10330001d3cd6bd53bf144"
        },
        "name": "Docusign Spoke Credential",
        "table": "oauth_2_0_credentials"
      },
      "connection": {
        "use_mid": false,
        "connection_url": "https://<provider-domain-name>.com",
        "name": "Docusign Spoke Connection",
        "table": "http_connection"
      },
    "additional":{
        "docusign_account_name": "<docusign-account-name>",
        "docusign_account_email": "<docusign-account-email>"
    }
    }

    동적 데이터 스키마

    동적 데이터 스키마는 사용자가 연결 및 자격 증명 별칭을 만들고 입력을 수집할 때 표시되는 내용을 정의합니다. 닷워킹 구문을 사용하여 기본 데이터 템플릿에서 생성된 필드에 사용자 입력을 매핑합니다. 예를 들어, connection_fields 기본 데이터 템플릿으로 만든 연결 객체의 connection_url 필드에 사용자 입력을 매핑합니다.

    {
      "connection_fields": [
        {
          "name": "connection.connection_url",
          "label": "Connection URL",
          "type": "text",
          "defaultValue": "https://demo.docusign.net",
          "hint": "Connection URL for Docusign"
        }],
    "additional_fields":[
        {
          "name": "additional.docusign_account_id",
          "label": "Docusign Account Number",
          "type": "text",
          "hint": "Docusign Account Number"
        },
        {
          "name": "additional.docusign_account_name",
          "label": "Docusign Account Name",
          "type": "text",
          "hint": "Name to identify the Docusign account"
        },
        {
          "name": "additional.docusign_account_email",
          "label": "Docusign Account Email",
          "type": "text",
          "hint": "Docusign Account Email"
        }
      ],
      "credential_fields": [
        {
          "name": "credential.oauth_entity.client_id",
          "label": "OAuth Client ID",
          "type": "text",
          "hint": "Client ID for Docusign"
        },
        {
          "name": "credential.oauth_entity.redirect_url",
          "label": "OAuth Redirect URL",
          "type": "text",
          "defaultValue": "https://<instance-name>.service-now.com/oauth_redirect.do",
          "hint": "Callback URL for Docusign"
        },
     {
          "name": "credential.jwt_provider.jwt_claim_validation[0].value",
          "label": "Issuer (iss) Claim value",
          "type": "text",
          "hint": "The integrator key (also known as client ID) of the application"
        },
     {
          "name": "credential.jwt_provider.jwt_claim_validation[1].value",
          "label": "Subject (sub) Claim value",
          "type": "text",
          "hint": "The user ID of the user to be impersonated"
        },
     {
          "name": "credential.jwt_provider.jwt_claim_validation[2].value",
          "label": "Audience (aud) Claim value",
          "type": "text",
          "defaultValue": "account-d.docusign.com",
          "hint": "The URI of the authentication service instance to be used e.g. account.docusign.com"
        },
        {
          "name": "credential.jwt_provider.jwt_keystore_aliases.kid",
          "label": "Key ID (kid)",
          "type": "text",
          "hint": "Indicates which key was used to secure the JWS"
        },
        {
          "name": "credential.jwt_provider.jwt_keystore_aliases.signing_keystore",
          "label": "Key Store",
          "type": "file"
        }
      ]
    }

    후처리 중인 스크립트

    다음 후처리 스크립트는 사용자 입력을 sn_docusign_spoke_accounts 테이블의 필드에 매핑합니다.

    (function execute(aliasId, connectionSysId, jsonDefaultData, jsonDynamicData) {
    	var jsonDynamicDataP = JSON.parse(jsonDynamicData);
    	var accountGR = new GlideRecord("sn_docusign_spoke_accounts");
        accountGR.setValue("account_name", jsonDynamicDataP["additional.docusign_account_name"]);
        accountGR.setValue("alias", aliasId);
        accountGR.setValue("email", jsonDynamicDataP["additional.docusign_account_email"]);
        accountGR.setValue("id", jsonDynamicDataP["additional.docusign_account_id"]);
        accountGR.insert();
    })(aliasId, connectionSysId, jsonDefaultData, jsonDynamicData);

    Docusign 연결 및 자격 증명 구성 결과 양식

    사용자가 연결된 Docusign 연결 및 자격 증명 별칭으로 이동하고 새 연결 및 자격 증명 생성을 선택하면 다음 대화 상자가 나타납니다.

    사용자 입력이 필요한 Docusign 양식입니다.