Özel bağlayıcılarda çoklı kimlik doğrulaması

Çoklu kimlik doğrulaması (multi-auth) kullanıcıların yalnızca bir kimlik doğrulaması türüyle sınırlı olmasının aksine, bağlantılarını oluşturmak için hangi kimlik doğrulaması yöntemini kullanmak istediklerini belirtme seçeneği sunarak bağlantı oluşturmalarına olanak tanıyan bir özelliktir.

Bağlayıcı için kimlik doğrulaması türleri koleksiyonu apiProperties.json dosyasındaki connectionParameterSets üzerinden tanımlanır.

Önemli

Özel bağlayıcıda çoklu kimlik doğrulamasının etkinleştirilmesi henüz Özel Bağlayıcı Sihirbazı'nda desteklenmiyor. Çoklu kimlik doğrulamasıyla özel bir bağlayıcı oluşturmak için bunun yerine Microsoft Power Platform Connectors CLI'yı kullanın.

Çoklu kimlik doğrulamasını etkinleştirme

apiProperties.json dosyasına connectionParameterSets ekleyin ve connectionParameterSets.values koleksiyonunu bağlayıcı için gereken sayıda connectionParameters ile doldurun.

Not

Bağlantı parametreleri ve kimlik doğrulaması türleri hakkında daha fazla bilgi edinmek için Bağlantı Parametreleri'ni ziyaret edin.

Aşağıda connectionParameterSets yapısı verilmiştir:

"connectionParameterSets": {
  // uiDefinition for the parameter sets.
  "uiDefinition": {
    "displayname": "Select the authorization type",
    "description": "<<Enter here your description>>"
  },
  "values": [
    // Connection parameter set
    {
      "name": "<parameter set name>",
      // uiDefinition for this parameter set.
      "uiDefinition": {
        "displayname": "<display name>",
        "description": "<description text>"
      },
      "parameters": {
        // Schema matches existing "connectionParameters"
        "<parameter name>": {
          "type": "string | securestring | oauthsetting"
        },
        "<parameter name>:clientId": {
          "type": "string",
          "uiDefinition": {
            "schema": {
              // For string types, the description must be placed in
              // uiDefinition.schema.description to be shown in the description box
              "type": "string",
              "description": "<description text>"
            },
            "displayName": "<display name>",
          }
        }
      }
    },
    {
      "name": "<parameter set name 2>"
      // ...
    }
  ]
}

Örnekler

API anahtarı ve Temel Kimlik Doğrulaması ile yapılandırma

"connectionParameterSets": {
    "uiDefinition": {
        "displayName": "Authentication Type",
        "description": "Type of authentication to be used."
    },
    "values": [
        {
            "name": "basic-auth",
            "uiDefinition": {
                "displayName": "Use your X credentials",
                "description": "Log in using your username and password for X."
            },
            "parameters": {
                "username": {
                    "type": "string",
                    "uiDefinition": {
                        "displayName": "X username",
                        "schema":{
                            "description": "The username for X",
                            "type": "string"
                        },
                        "tooltip": "Provide your X username",
                        "constraints": {
                            "required": "true"
                        }
                    }
                },
                "password": {
                    "type": "securestring",
                    "uiDefinition": {
                        "displayName": "X password",
                        "schema":{
                            "description": "The password for X",
                            "type": "securestring"
                        },
                        "tooltip": "Provide your X password",
                        "constraints": {
                            "required": "true"
                        }
                    }
                }
            }
        },
        {
            "name": "api-auth",
            "uiDefinition": {
                "displayName": "Use X API Key",
                "description": "Log in using X's API Key."
            },
            "parameters": {
                "api_key": {
                    "type": "securestring",
                    "uiDefinition": {
                        "constraints": {
                            "clearText": false,
                            "required": "true",
                            "tabIndex": 3
                        },
                        "schema":{
                            "description": "Enter your API Key for X",
                            "type": "securestring"
                        },
                        "displayName": "API Key generated in X"
                    }
                },
                "environment": {
                    "type": "string",
                    "uiDefinition": {
                        "displayName": "Environment",
                        "schema":{
                            "description": "The API environment to use; either production or sandbox",
                            "type": "string"
                        },
                        "tooltip": "Select an API environment to use",
                        "constraints": {
                            "required": "true",
                            "allowedValues": [
                                {
                                    "text": "Sandbox",
                                    "value": "YOUR_SANDBOX_VALUE_HERE"
                                },
                                {
                                    "text": "Production",
                                    "value": "YOUR_PROD_VALUE_HERE"
                                }
                            ]
                        }
                    }
                }
            }
        }
    ]
}

AAD ve OAUTH 2.0 ile yapılandırma

Aynı türde iki connectionParameters'a sahip olmak mümkündür. Bu durumda, her iki yetkilendirme de oauthSetting türünü kullanır: Biri kullanıcının AAD kullanarak bağlantı oluşturmasına izin verirken, diğeri özel bir uç noktaya gider.

"connectionParameterSets": {
    "uiDefinition": {
        "displayName": "Authentication Type",
        "description": "Type of authentication to be used."
    },
    "values": [
        {
            "name": "aad-auth",
            "uiDefinition": {
                "displayName": "Use default shared application",
                "description": "Log in using the standard X app."
            },
            "parameters": {
                "token": {
                    "oAuthSettings": {
                        "clientId": "YOUR_AAD_APPLICATION_ID_HERE",
                        "customParameters": {
                            "loginUri": {
                                "value": "https://login.windows.net"
                            },
                            "resourceUri": {
                                "value": "https://graph.microsoft.com"
                            },
                            "tenantId": {
                                "value": "common"
                            }
                        },
                        "identityProvider": "aad",
                        "properties": {
                            "IsFirstParty": "False"
                        },
                        "redirectMode": "GlobalPerConnector",
                        "scopes": [
                            "Group.ReadWrite.All offline_access"
                        ]
                    },
                    "type": "oauthSetting"
                }
            }
        },
        {
            "name": "custom-app-auth",
            "uiDefinition": {
                "displayName": "Use the X authentication app",
                "description": "Log in using X app."
            },
            "parameters": {
                "token": {
                    "type": "oauthSetting",
                    "oAuthSettings": {
                        "clientId": "YOUR_CLIENT_ID_HERE",
                        "identityProvider": "oauth2",
                        "redirectMode": "GlobalPerConnector",
                        "customParameters": {
                            "authorizationUrl": {
                                "value": "https://login.dummy.net/request"
                            },
                            "refreshUrl": {
                                "value": "https://login.dummy.net/token"
                            },
                            "tokenUrl": {
                                "value": "https://login.dummy.net/token"
                            }
                        }
                    }
                }
            }
        }
    ]
}

Çoklu kimlik doğrulamasının nasıl uygulanılacağına ilişkin güncel bir örnek için buradan rescoCloud bağlayıcısına göz atın.