customAuthenticationExtension の作成

名前空間: microsoft.graph

重要

Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。

新しい customAuthenticationExtension オブジェクトを作成します。 現在、次の派生型がサポートされています。

注:

最大 100 個のカスタム拡張ポリシーを使用できます。

この API は、次の国内クラウド展開で使用できます。

グローバル サービス 米国政府機関 L4 米国政府機関 L5 (DOD) 21Vianet が運営する中国
✅ ✅ ✅ ✅

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) CustomAuthenticationExtension.ReadWrite.All 注意事項なし。
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
アプリケーション CustomAuthenticationExtension.ReadWrite.All 注意事項なし。

重要

職場または学校アカウントを使用してアクセスを委任するには、サポートされている Microsoft Entra ロール、またはこの操作に必要なアクセス許可を付与するカスタム ロールが管理者に割り当てられている必要があります。 この操作では、必要最小限の特権のみを提供する次の組み込みロールがサポートされます。

  • 認証機能拡張管理者
  • アプリケーション管理者

HTTP 要求

POST /identity/customAuthenticationExtensions

要求ヘッダー

名前 説明
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。
Content-Type application/json. 必須です。

要求本文

要求本文には、 customAuthenticationExtension オブジェクトの JSON 表現を指定します。

customAuthenticationExtension を作成するときに、次のプロパティを指定できます。 作成する customAuthenticationExtension オブジェクト型の値で @odata.type プロパティを指定する必要があります。 たとえば、 onTokenIssuanceStartCustomExtensionオブジェクト を作成するには、 @odata.type を #microsoft.graph.onTokenIssuanceStartCustomExtensionに設定します。

プロパティ 型 説明
authenticationConfiguration customExtensionAuthenticationConfiguration このカスタム拡張機能の認証構成。 必須です。
behaviorOnError customExtensionBehaviorOnError カスタム認証拡張機能の呼び出しがエラーを返す場合の動作を構成しましょう。 省略可能。
clientConfiguration customExtensionClientConfiguration カスタム拡張機能の接続設定。 省略可能。
説明 String カスタム拡張機能の説明。 customCalloutExtension から継承されます。 省略可能。
displayName 文字列 カスタム拡張機能の表示名。 customCalloutExtension から継承されます。 省略可能。
endpointConfiguration customExtensionEndpointConfiguration カスタム拡張機能が呼び出す API エンドポイントの構成。 customCalloutExtension から継承されます。 省略可能。

応答

成功した場合、このメソッドは応答本文で 201 Created 応答コードと customAuthenticationExtension オブジェクトを返します。

例

例 1: onTokenIssuanceStartCustomExtension オブジェクトを作成する

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/beta/identity/customAuthenticationExtensions
Content-Type: application/json
Content-length: 468

{
    "@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtension",
    "displayName": "onTokenIssuanceStartCustomExtension",
    "description": "Fetch additional claims from custom user store",
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://authenticationeventsAPI.contoso.com"
    },
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4"
    },
    "clientConfiguration": {
        "timeoutInMilliseconds": 2000,
        "maximumRetries": 1
    },
    "claimsForTokenConfiguration": [
        {
            "claimIdInApiResponse": "DateOfBirth"
        },
        {
            "claimIdInApiResponse": "CustomRoles"
        }
    ]
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/customAuthenticationExtensions/$entity",
    "@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtension",
    "id": "6fc5012e-7665-43d6-9708-4370863f4e6e",
    "displayName": "onTokenIssuanceStartCustomExtension",
    "description": "Fetch additional claims from custom user store",
    "clientConfiguration": null,
    "behaviorOnError": null,
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4"
    },
    "clientConfiguration": {
        "timeoutInMilliseconds": 2000,
        "maximumRetries": 1
    },
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://authenticationeventsAPI.contoso.com"
    },
    "claimsForTokenConfiguration": [
        {
            "claimIdInApiResponse": "DateOfBirth"
        },
        {
            "claimIdInApiResponse": "CustomRoles"
        }
    ]
}

例 2: onAttributeCollectionStartCustomExtension オブジェクトを作成する

要求

次の例は要求を示しています。

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

{
  "@odata.type": "#microsoft.graph.onAttributeCollectionStartCustomExtension",
  "displayName": "attributeCollectionStartName",
  "description": "example description",
  "authenticationConfiguration": {
    "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
    "resourceId": "api://contoso.com/fb96de85-2abe-4b02-b45f-64ba122c509e"
  },
  "endpointConfiguration": {
    "@odata.type": "#microsoft.graph.httpRequestEndpoint",
    "targetUrl": "https://contoso.com"
  },
  "clientConfiguration": {
    "timeoutInMilliseconds": 2000,
    "maximumRetries": 1
  }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/customAuthenticationExtensions/$entity",
    "@odata.type": "#microsoft.graph.onAttributeCollectionStartCustomExtension",
    "id": "2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02",
    "displayName": "attributeCollectionStartName",
    "description": "example description",
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://contoso.com/fb96de85-2abe-4b02-b45f-64ba122c509e"
    },
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://contoso.com"
    },
    "clientConfiguration": {
        "timeoutInMilliseconds": 2000,
        "maximumRetries": 1
    }
}

例 3: onAttributeCollectionSubmitCustomExtension オブジェクトを作成する

要求

次の例は要求を示しています。

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

{
    "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitCustomExtension",
    "displayName": "attributeCollectionSubmitName",
    "description": "example description",
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://contoso.com/fb96de85-2abe-4b02-b45f-64ba122c509e"
    },
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://contoso.com"
    },
    "clientConfiguration": {
        "timeoutInMilliseconds": 2000,
        "maximumRetries": 1
    }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/customAuthenticationExtensions/$entity",
    "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitCustomExtension",
    "id": "66867d1f-7824-4f38-aad1-75da1ad09ee2",
    "displayName": "attributeCollectionSubmitName",
    "description": "example description",
    "authenticationConfiguration": {
        "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
        "resourceId": "api://contoso.com/fb96de85-2abe-4b02-b45f-64ba122c509e"
    },
    "endpointConfiguration": {
        "@odata.type": "#microsoft.graph.httpRequestEndpoint",
        "targetUrl": "https://contoso.com"
    },
    "clientConfiguration": {
        "timeoutInMilliseconds": 2000,
        "maximumRetries": 1
    }
}

例 4: onOtpSendCustomExtension オブジェクトを作成する

要求

次の例は要求を示しています。

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

{
  "@odata.type": "#microsoft.graph.onOtpSendCustomExtension",
  "authenticationConfiguration": {
    "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
    "resourceId": "api://onotpsendcustomextension.b2c.expert/fb96de85-2abe-4b02-b45f-64ba122c509e"
  },
  "clientConfiguration": {
    "timeoutInMilliseconds": 2000,
    "maximumRetries": 1
  },
  "description": "Use an external Email provider to send OTP Codes.",
  "displayName": "onEmailOtpSendCustomExtension",
  "endpointConfiguration": {
    "@odata.type": "#microsoft.graph.httpRequestEndpoint",
    "targetUrl": "https://onotpsendcustomextension.b2c.expert/api/OnOTPCodeSendToTeamsDemo"
  },
  "behaviorOnError": {
    "@odata.type": "microsoft.graph.customExtensionBehaviorOnError"
  }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.onOtpSendCustomExtension",
  "authenticationConfiguration": {
    "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
    "resourceId": "api://onotpsendcustomextension.b2c.expert/fb96de85-2abe-4b02-b45f-64ba122c509e"
  },
  "clientConfiguration": {
    "timeoutInMilliseconds": 2000,
    "maximumRetries": 1
  },
  "description": "Use an external Email provider to send OTP Codes.",
  "displayName": "onEmailOtpSendCustomExtension",
  "endpointConfiguration": {
    "@odata.type": "#microsoft.graph.httpRequestEndpoint",
    "targetUrl": "https://onotpsendcustomextension.b2c.expert/api/OnOTPCodeSendToTeamsDemo"
  },
  "behaviorOnError": {
    "@odata.type": "microsoft.graph.customExtensionBehaviorOnError"
  }
}

例 5: onVerifiedIdClaimValidationCustomExtension オブジェクトを作成する

要求

次の例は要求を示しています。

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

{
  "@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationCustomExtension",
  "displayName": "Verified ID Claim Validation",
  "description": "Validate claims from a Verified ID presentation",
  "endpointConfiguration": {
    "@odata.type": "#microsoft.graph.httpRequestEndpoint",
    "targetUrl": "https://contoso.azurewebsites.net/api/verifiedIdClaimValidation"
  },
  "authenticationConfiguration": {
    "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
    "resourceId": "api://contoso.azurewebsites.net/verifiedIdClaimValidation"
  },
  "clientConfiguration": {
    "timeoutInMilliseconds": 2000,
    "maximumRetries": 1
  },
  "behaviorOnError": {
    "@odata.type": "#microsoft.graph.customExtensionBehaviorOnError"
  }
}

応答

次の例は応答を示しています。

注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/customAuthenticationExtensions/$entity",
  "@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationCustomExtension",
  "id": "6a0a3429-be77-0aed-951e-1c8aed62bf8a",
  "displayName": "Verified ID Claim Validation",
  "description": "Validate claims from a Verified ID presentation",
  "endpointConfiguration": {
    "@odata.type": "#microsoft.graph.httpRequestEndpoint",
    "targetUrl": "https://contoso.azurewebsites.net/api/verifiedIdClaimValidation"
  },
  "authenticationConfiguration": {
    "@odata.type": "#microsoft.graph.azureAdTokenAuthentication",
    "resourceId": "api://contoso.azurewebsites.net/verifiedIdClaimValidation"
  },
  "clientConfiguration": {
    "timeoutInMilliseconds": 2000,
    "maximumRetries": 1
  },
  "behaviorOnError": {
    "@odata.type": "#microsoft.graph.customExtensionBehaviorOnError"
  }
}