GithubHelp home page GithubHelp logo

Comments (6)

omeshp avatar omeshp commented on May 17, 2024

yes you can create a custom service endpoint using extensions. To do that you will need to add a new contribution that targets ms.vss-endpoint.endpoint-types. Here is an example of chef endpoint type contribution that uses basic authentication:

"contributions": [
  {
    "id": "custom-chef-endpoint-type",
    "description": "Service Endpoint type for all Chef connections",
    "type": "ms.vss-endpoint.service-endpoint-type",
    "targets": [ "ms.vss-endpoint.endpoint-types" ],
    "properties": {
      "name": "customchef",
      "displayName": "Custom Chef",
      "authenticationSchemes": [
        {
          "type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
          "inputDescriptors": [
            {
              "id": "username",
              "name": "Node Name (Username)",
              "description": "Chef username",
              "inputMode": "textbox",
              "isConfidential": false,
              "validation": {
                "isRequired": true,
                "dataType": "string"
              }
            },
            {
              "id": "password",
              "name": "Client Key",
              "description": "Client key specified in the .pem file",
              "inputMode": "textarea",
              "isConfidential": false,
              "validation": {
                "isRequired": true,
                "dataType": "string"
              }
            }
          ]
        }
      ],
      "helpMarkDown": "Learn More"
    }
  }
]

from vsts-extension-samples.

omeshp avatar omeshp commented on May 17, 2024

For token based authentication, the autheticationSchemes field will look like:

"authenticationSchemes": [
  {
    "type": "ms.vss-endpoint.endpoint-auth-scheme-token",
    "inputDescriptors": [
      {
        "id": "apitoken",
        "name": "API Key",
        "description": "API key for connection",
        "inputMode": "textbox",
        "isConfidential": false,
        "validation": {
          "isRequired": true,
          "dataType": "string"
        }
      }
    ],
    "headers": [
      {
        "name": "Authorization",
        "value": "api_key {{endpoint.apitoken}}"
      }
    ]
  }
]

from vsts-extension-samples.

mmajcica avatar mmajcica commented on May 17, 2024

Thank you very much!
That's precisely what I was searching, although I thought it may be that I should somewhere implement ITaskEndpoint interface. The dictionary that this interface exposes, called Data, contains all of the information about the username and password. The password is however passed as a string. Is there a way to have it persisted as a SecureString?

What does isConfidential property on inputDescriptors do?
For the validation, what sort of dataType's do we have at our disposition?

I'll jump right away on it and check how it works.
Mario

from vsts-extension-samples.

omeshp avatar omeshp commented on May 17, 2024

Hi Mario,

All the authentication data belonging to an endpoint(i.e all the fields belonging to authentication scheme) are encrypted and persisted using strongbox service. In memory they are represented as strings, values for which are fetched and unencrypted only when required.

isConfidential false means that input will be visible after typing, if you set it to true that we will mask the input using ******.

For different dataTypes have a look at https://www.visualstudio.com/en-us/integrate/extensions/reference/client/api/vss/common/contracts/forminput/inputdatatype

from vsts-extension-samples.

mmajcica avatar mmajcica commented on May 17, 2024

Thank you for the detailed answers!

from vsts-extension-samples.

JoshuaTheMiller avatar JoshuaTheMiller commented on May 17, 2024

In case folks come across this Issue first, another Issue exists that discusses consuming Service Connections in a TypeScript extension: #135

from vsts-extension-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.