从服务端点访问凭据

时间:2021-07-21 19:35:56

标签: azure-devops azure-pipelines

我正在构建一个 azure-pipelines-extension 我有一个带有基本身份验证的自定义端点。我需要将此端点凭据传递给我的数据源。

这是我的 vss-manifest.json

     "dataSources": [
       {
        "name": "AccessToken",
        "endpointUrl": "$(endpoint.url)",
        "requestVerb": "Post",
        "requestContent": "username={{{endpoint.username}}}&password={{{endpoint.password}}}&grant_type=password",
        "resultSelector": "jsonpath:$.access_token",
        "headers": [
          {
            "name": "Content-Type",
            "value": "application/x-www-form-urlencoded"
          }
        ]
      },
    "authenticationSchemes": [
      {
          "type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
          "displayName": "Azure Active Directory Credential",
          "inputDescriptors": [
              {
                  "id": "username",
                  "name": "Username",
                  "description": "E-mail address",
                  "inputMode": "textbox",
                  "isConfidential": false,
                  "validation": {
                      "isRequired": true,
                      "dataType": "string"
                  }
              },
              {
                  "id": "password",
                  "name": "Password",
                  "description": "Password",
                  "inputMode": "passwordbox",
                  "isConfidential": false,
                  "validation": {
                      "isRequired": true,
                      "dataType": "string"
                  }
              }
          ]
      }

然而,似乎用户名并没有通过。当我用

替换“requestContent”行时
       "requestContent": "username=my_username&password=my_password&grant_type=password",

它有效。 我在这里错过了什么?

0 个答案:

没有答案