Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new configuration-schema for salesforce adaptor #423

Closed
mtuchi opened this issue Oct 24, 2023 · 4 comments
Closed

Add new configuration-schema for salesforce adaptor #423

mtuchi opened this issue Oct 24, 2023 · 4 comments
Assignees

Comments

@mtuchi
Copy link
Collaborator

mtuchi commented Oct 24, 2023

Summary

Configuration schema for adaptor that support more than 2 authentication. For example Salesforce have basic auth credential but also you can setup a connected app in salesforce using OAuth 2.0.

Proposed configuration schema for salesforce Basic Auth or OAuth

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "authentication": {
      "type": "object",
      "title": "Authentication",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["basic", "oauth2"],
          "default": "basic"
        },
        "basic": {
          "type": "object",
          "properties": {
            "loginUrl": { /* ... */ },
            "username": { /* ... */ },
            "password": { /* ... */ },
            "securityToken": { /* ... */ }
          },
          "required": ["loginUrl", "username", "password", "securityToken"],
          "additionalProperties": true
        },
        "oauth2": {
          "type": "object",
          "properties": {
            "authorizationUrl": {
              "type": "string",
              "description": "OAuth2 Authorization URL",
              "minLength": 1
            },
            "scope": {
              "type": "string",
              "description": "OAuth2 Scope",
              "minLength": 1
            },
            "tokenUrl": {
              "type": "string",
              "description": "OAuth2 Token URL",
              "minLength": 1
            },
            "userInfoUrl": {
              "type": "string",
              "description": "OAuth2 User Info URL",
              "minLength": 1
            },
            "clientId": {
              "type": "string",
              "description": "OAuth2 Client ID",
              "minLength": 1
            },
            "clientSecret": {
              "type": "string",
              "description": "OAuth2 Client Secret",
              "writeOnly": true,
              "minLength": 1
            },
            "resourceUrl": {
              "type": "string",
              "description": "Optional: OAuth2 Resource URL",
              "minLength": 1
            },
            "apiVersion": {
              "type": "string",
              "description": "Optional: Salesforce API Version",
              "minLength": 1
            },
            "label": {
              "type": "string",
              "description": "Optional: Label for the configuration",
              "minLength": 1
            }
          },
          "required": ["authorizationUrl", "scope", "tokenUrl", "userInfoUrl", "clientId", "clientSecret"],
          "additionalProperties": true
        }
      },
      "required": ["type"],
      "additionalProperties": false
    },
    "apiVersion": {
      "title": "API Version",
      "type": "string",
      "placeholder": "52.0",
      "description": "Salesforce API Version",
      "minLength": 1,
      "examples": ["59.0"]
    }
  },
  "type": "object",
  "additionalProperties": true
}

Additional Information

@mtuchi mtuchi changed the title Configuration schema for adaptor that support more than 2 authentication Configuration Schema for Multi-Authentication Adaptors Jan 16, 2024
@josephjclark
Copy link
Collaborator

I don't think this is a big deal from the adaptor's point of view. It complicates the auth step a bit but you can just duck type config and decide which form of auth to use.

The Lightning UI is a bit harder because validation rules are very different depending on which auth type you want.

Options:

  • Loosen the schema so that all keys are optional. Users will input the values they need. If anything is missing they'll get an error (maybe we can make the adaptor report nice errors)
  • JSON Schema does support conditional dependent properties (this property is required if that property is set) and even dependent schemas (apply this schema if this property is set). We could use that in conjunction with a type field. Or even an oath checkbox (change validation rules depending on the value of this field)

@mtuchi mtuchi self-assigned this Jan 23, 2024
@mtuchi mtuchi changed the title Configuration Schema for Multi-Authentication Adaptors Add new configuration-schema for salesforce adaptor Jan 24, 2024
@mtuchi
Copy link
Collaborator Author

mtuchi commented Jan 24, 2024

Related #410

@taylordowns2000 taylordowns2000 moved this to Icebox in v2 Feb 3, 2024
@aleksa-krolls
Copy link
Member

@mtuchi is this merged? Can we close this issue?

@mtuchi
Copy link
Collaborator Author

mtuchi commented Mar 21, 2024

@aleksa-krolls yes this was worked on #470 and #473

@mtuchi mtuchi closed this as completed Mar 21, 2024
@github-project-automation github-project-automation bot moved this from Icebox to Done in v2 Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants