Partager via


customAuthenticationExtension : validateAuthenticationConfiguration

Espace de noms: microsoft.graph

Une API pour case activée validité du point de terminaison et de la configuration d’authentification pour une customAuthenticationExtension.

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

Service global Gouvernement des États-Unis L4 Us Government L5 (DOD) Chine gérée par 21Vianet

Autorisations

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

Type d’autorisation Autorisations avec privilèges minimum Autorisations privilégiées plus élevées
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

Requête HTTP

Pour valider le point de terminaison et la configuration d’authentification pour une customAuthenticationExtension par son ID.

POST /identity/customAuthenticationExtensions/{customAuthenticationExtensionId}/validateAuthenticationConfiguration

Pour valider le point de terminaison et la configuration d’authentification spécifiés dans le corps de la demande pour une customAuthenticationExtension. 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 l’autorisation.

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. Fournissez un endpointConfiguration et authenticationConfiguration si vous interrogez au niveau de la racine. Sinon, pour une extension personnalisée spécifique, ne fournissez pas de corps de demande 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

Si elle réussit, cette action renvoie 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/v1.0/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/v1.0/$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/v1.0/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/v1.0/$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"
        },
    ]
}