次の方法で共有


customAuthenticationExtension のCreate

名前空間: microsoft.graph

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

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

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

アクセス許可

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

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

HTTP 要求

POST /identity/customAuthenticationExtensions

要求ヘッダー

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

要求本文

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

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

プロパティ 説明
authenticationConfiguration customExtensionAuthenticationConfiguration このカスタム拡張機能の認証構成。 必須。
claimsForTokenConfiguration onTokenIssuanceStartReturnClaim コレクション このカスタム認証拡張機能によって呼び出された API によって返される要求のコレクション。 onTokenIssuanceStartCustomExtension オブジェクトにのみ設定できます。 Microsoft Entra 管理センターで要求マッピング エクスペリエンスを設定するために使用されます。 省略可能。
clientConfiguration customExtensionClientConfiguration カスタム拡張機能の接続設定。 省略可能。
説明 String カスタム拡張機能の説明。 省略可能。
displayName String カスタム拡張機能の表示名。 必須。
endpointConfiguration customExtensionEndpointConfiguration カスタム拡張機能が呼び出す API エンドポイントの構成。 必須。

応答

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

要求

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

POST https://graph.microsoft.com/v1.0/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/v1.0/$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,
    "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"
        }
    ]
}