customAuthenticationExtension : validateAuthenticationConfiguration

Espace de noms: microsoft.graph

Importante

Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .

API permettant de case activée validité du point de terminaison et de la configuration d’authentification d’un objet customAuthenticationExtension, qui peut représenter l’un des types dérivés suivants :

Cette API est disponible dans les déploiements cloud nationaux suivants.

Service global Gouvernement américain L4 Gouvernement américain L5 (DOD) Chine exploitée par 21Vianet
✅ ✅ ✅ ✅

Autorisations

Choisissez l’autorisation ou les autorisations marquées comme étant les moins privilégiées pour cette API. Utilisez une ou plusieurs autorisations privilégiées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, voir Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez la référence des autorisations.

Type d’autorisation Autorisations les moins privilégiées Autorisations à privilèges plus élevés
Déléguée (compte professionnel ou scolaire) CustomAuthenticationExtension.Read.All CustomAuthenticationExtension.ReadWrite.All
Déléguée (compte Microsoft personnel) Non prise en charge. Non prise en charge.
Application CustomAuthenticationExtension.Read.All CustomAuthenticationExtension.ReadWrite.All

Importante

Pour l’accès délégué à l’aide de comptes professionnels ou scolaires, l’administrateur doit disposer d’un rôle Microsoft Entra pris en charge ou d’un rôle personnalisé qui accorde les autorisations requises pour cette opération. Cette opération prend en charge les rôles intégrés suivants, qui n’offrent que le moindre privilège nécessaire :

  • Administrateur d’extensibilité d’authentification
  • Administrateur de l'application

Requête HTTP

Valider la configuration du point de terminaison et de l’authentification d’une extension customAuthenticationExtension par son ID.

POST /identity/customAuthenticationExtensions/{customAuthenticationExtensionId}/validateAuthenticationConfiguration

Pour valider la configuration du point de terminaison et de l’authentification spécifiée dans le corps de la demande pour une extension customAuthentication. L’objet d’extension d’authentification personnalisée n’existe peut-être pas encore et vous pouvez utiliser ce point de terminaison pour valider la configuration avant de créer l’extension d’authentification personnalisée.

POST /identity/customAuthenticationExtensions/validateAuthenticationConfiguration

En-têtes de demande

Nom Description
Autorisation Porteur {token}. Obligatoire. En savoir plus sur l’authentification et les autorisations.

Corps de la demande

Dans le corps de la demande, fournissez une représentation JSON des paramètres.

Le tableau suivant indique les paramètres utilisables avec cette action. Fournir un point de terminaisonConfiguration et authenticationConfiguration si l’interrogation est effectuée au niveau racine. Dans le cas contraire, pour une extension personnalisée spécifique, ne fournissez pas de corps de requête pour cette méthode.

Paramètre Type Description
endpointConfiguration customExtensionEndpointConfiguration Point de terminaison HTTP pour l’extension d’authentification personnalisée à valider.
authenticationConfiguration customExtensionEndpointConfiguration Configuration de l’authentification pour l’extension d’authentification personnalisée à valider.

Réponse

En cas de succès, cette action retourne un 200 OK code de réponse et une authenticationConfigurationValidation dans le corps de la réponse.

Exemples

Exemple 1 : Fournir et valider une configuration d’extension d’authentification personnalisée potentielle

Demande

L’exemple suivant illustre une demande.

POST https://graph.microsoft.com/beta/customAuthenticationExtensions/validateAuthenticationConfiguration
Content-Type: application/json

{
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://australia.contoso.com/users"
    },
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://extensibilityapi.azurwebsites.net/f9c5dc6b-d72b-4226-8ccd-801f7a290428"
    }
}

Réponse

L’exemple suivant illustre la réponse.

Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#microsoft.graph.authenticationConfigurationValidation",
    "errors": [
        {
            "code": "IncorrectResourceIdFormat",
            "message": "ResourceId should be in the format of 'api://{fully qualified domain name}/{appid}'"
        },
        {
            "code": "DomainNameDoesNotMatch",
            "message": "The fully qualified domain name in resourceId should match that of the targetUrl"
        },
        {
            "code": "ServicePrincipalNotFound",
            "message": "The appId of the resourceId should correspond to a real service principal in the tenant"
        }
    ],
    "warnings": [
        {
            "code": "PermissionNotGrantedToServicePrincipal",
            "message": "The permission CustomAuthenticationExtensions.Receive.Payload is not granted to the service principal of the resource app"
        },
    ]
}

Exemple 2 : Valider la configuration d’une extension d’authentification personnalisée existante spécifique

Demande

L’exemple suivant illustre une demande.

POST https://graph.microsoft.com/beta/identity/customAuthenticationExtensions/9f39f3bb-457c-4a2a-8099-0e480e7ea142/validateAuthenticationConfiguration

Réponse

L’exemple suivant illustre la réponse.

Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité.

HTTP/1.1 200 OK
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#microsoft.graph.authenticationConfigurationValidation",
    "errors": [
        {
            "code": "IncorrectResourceIdFormat",
            "message": "ResourceId should be in the format of 'api://{fully qualified domain name}/{appid}'"
        },
        {
            "code": "DomainNameDoesNotMatch",
            "message": "The fully qualified domain name in resourceId should match that of the targetUrl"
        },
        {
            "code": "ServicePrincipalNotFound",
            "message": "The appId of the resourceId should correspond to a real service principal in the tenant"
        }
    ],
    "warnings": [
        {
            "code": "PermissionNotGrantedToServicePrincipal",
            "message": "The permission CustomAuthenticationExtensions.Receive.Payload is not granted to the service principal of the resource app"
        },
    ]
}