命名空间:microsoft.graph
创建新的 authenticationEventListener 对象。 可以创建派生自 authenticationEventListener 的以下子类型之一。
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
EventListener.ReadWrite.All |
不可用。 |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
EventListener.ReadWrite.All |
不可用。 |
重要
对于使用工作或学校帐户的委派访问,必须为管理员分配受支持的Microsoft Entra角色或授予此操作所需权限的自定义角色。 此操作支持以下内置角色,这些角色仅提供所需的最小特权:
HTTP 请求
POST /identity/authenticationEventListeners
| 名称 |
说明 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| Content-Type |
application/json. 必需。 |
请求正文
在请求正文中,提供 authenticationEventListener 对象的 JSON 表示形式。
创建 authenticationEventListener 时,可以指定以下属性。 必须指定 @odata.type 属性才能指定要创建的 authenticationEventListener 的类型;例如 。 @odata.type": "microsoft.graph.onTokenIssuanceStartListener"
响应
如果成功,此方法在 201 Created 响应正文中返回响应代码和 authenticationEventListener 对象。
@odata.type 属性指定所创建对象的类型。
示例
示例 1:创建 authenticationEventListener
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/v1.0/identity/authenticationEventListeners
Content-Type: application/json
Content-length: 312
{
"@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
"customExtension": {
"id": "6fc5012e-7665-43d6-9708-4370863f4e6e"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnTokenIssuanceStartListener
{
OdataType = "#microsoft.graph.onTokenIssuanceStartListener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
},
},
},
},
Handler = new OnTokenIssuanceStartCustomExtensionHandler
{
OdataType = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
CustomExtension = new OnTokenIssuanceStartCustomExtension
{
Id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnTokenIssuanceStartCustomExtensionHandler()
customExtension := graphmodels.NewOnTokenIssuanceStartCustomExtension()
id := "6fc5012e-7665-43d6-9708-4370863f4e6e"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnTokenIssuanceStartListener authenticationEventListener = new OnTokenIssuanceStartListener();
authenticationEventListener.setOdataType("#microsoft.graph.onTokenIssuanceStartListener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("a13d0fc1-04ab-4ede-b215-63de0174cbb4");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnTokenIssuanceStartCustomExtensionHandler handler = new OnTokenIssuanceStartCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler");
OnTokenIssuanceStartCustomExtension customExtension = new OnTokenIssuanceStartCustomExtension();
customExtension.setId("6fc5012e-7665-43d6-9708-4370863f4e6e");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationEventListener = {
'@odata.type': '#microsoft.graph.onTokenIssuanceStartListener',
conditions: {
applications: {
includeApplications: [
{
appId: 'a13d0fc1-04ab-4ede-b215-63de0174cbb4'
}
]
}
},
handler: {
'@odata.type': '#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler',
customExtension: {
id: '6fc5012e-7665-43d6-9708-4370863f4e6e'
}
}
};
await client.api('/identity/authenticationEventListeners')
.post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OnTokenIssuanceStartListener;
use Microsoft\Graph\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Generated\Models\OnTokenIssuanceStartCustomExtensionHandler;
use Microsoft\Graph\Generated\Models\OnTokenIssuanceStartCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnTokenIssuanceStartListener();
$requestBody->setOdataType('#microsoft.graph.onTokenIssuanceStartListener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('a13d0fc1-04ab-4ede-b215-63de0174cbb4');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnTokenIssuanceStartCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler');
$handlerCustomExtension = new OnTokenIssuanceStartCustomExtension();
$handlerCustomExtension->setId('6fc5012e-7665-43d6-9708-4370863f4e6e');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.onTokenIssuanceStartListener"
conditions = @{
applications = @{
includeApplications = @(
@{
appId = "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
}
)
}
}
handler = @{
"@odata.type" = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler"
customExtension = @{
id = "6fc5012e-7665-43d6-9708-4370863f4e6e"
}
}
}
New-MgIdentityAuthenticationEventListener -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.on_token_issuance_start_listener import OnTokenIssuanceStartListener
from msgraph.generated.models.authentication_conditions import AuthenticationConditions
from msgraph.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph.generated.models.on_token_issuance_start_custom_extension_handler import OnTokenIssuanceStartCustomExtensionHandler
from msgraph.generated.models.on_token_issuance_start_custom_extension import OnTokenIssuanceStartCustomExtension
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnTokenIssuanceStartListener(
odata_type = "#microsoft.graph.onTokenIssuanceStartListener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
),
],
),
),
handler = OnTokenIssuanceStartCustomExtensionHandler(
odata_type = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
custom_extension = OnTokenIssuanceStartCustomExtension(
id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
),
),
)
result = await graph_client.identity.authentication_event_listeners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/authenticationEventListeners/$entity",
"@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",
"id": "990d94e5-cc8f-4c4b-97b4-27e2678aac28",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
"customExtension": {
"id": "6fc5012e-7665-43d6-9708-4370863f4e6e"
}
}
}
示例 2:在 Arkose Labs 注册期间启用欺诈防护
请求
以下示例演示了使用 Arkose Labs 在注册期间启用欺诈保护的请求。
POST https://graph.microsoft.com/v1.0/identity/authenticationEventListeners
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartListener",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "0001111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type":
"#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
"signUp": {
"@odata.type": "#microsoft.graph.fraudProtectionProviderConfiguration",
"fraudProtectionProvider": {
"@odata.type": "#microsoft.graph.arkoseFraudProtectionProvider",
"id": "6fedd01b-0afb-4a07-967f-d1ccbd81102b"
}
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnFraudProtectionLoadStartListener
{
OdataType = "#microsoft.graph.onFraudProtectionLoadStartListener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "0001111-aaaa-2222-bbbb-3333cccc4444",
},
},
},
},
Handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler
{
OdataType = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
SignUp = new FraudProtectionProviderConfiguration
{
OdataType = "#microsoft.graph.fraudProtectionProviderConfiguration",
FraudProtectionProvider = new ArkoseFraudProtectionProvider
{
OdataType = "#microsoft.graph.arkoseFraudProtectionProvider",
Id = "6fedd01b-0afb-4a07-967f-d1ccbd81102b",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "0001111-aaaa-2222-bbbb-3333cccc4444"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnFraudProtectionLoadStartExternalUsersAuthHandler()
signUp := graphmodels.NewFraudProtectionProviderConfiguration()
fraudProtectionProvider := graphmodels.NewArkoseFraudProtectionProvider()
id := "6fedd01b-0afb-4a07-967f-d1ccbd81102b"
fraudProtectionProvider.SetId(&id)
signUp.SetFraudProtectionProvider(fraudProtectionProvider)
handler.SetSignUp(signUp)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnFraudProtectionLoadStartListener authenticationEventListener = new OnFraudProtectionLoadStartListener();
authenticationEventListener.setOdataType("#microsoft.graph.onFraudProtectionLoadStartListener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("0001111-aaaa-2222-bbbb-3333cccc4444");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnFraudProtectionLoadStartExternalUsersAuthHandler handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler();
handler.setOdataType("#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler");
FraudProtectionProviderConfiguration signUp = new FraudProtectionProviderConfiguration();
signUp.setOdataType("#microsoft.graph.fraudProtectionProviderConfiguration");
ArkoseFraudProtectionProvider fraudProtectionProvider = new ArkoseFraudProtectionProvider();
fraudProtectionProvider.setOdataType("#microsoft.graph.arkoseFraudProtectionProvider");
fraudProtectionProvider.setId("6fedd01b-0afb-4a07-967f-d1ccbd81102b");
signUp.setFraudProtectionProvider(fraudProtectionProvider);
handler.setSignUp(signUp);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationEventListener = {
'@odata.type': '#microsoft.graph.onFraudProtectionLoadStartListener',
conditions: {
applications: {
includeApplications: [
{
appId: '0001111-aaaa-2222-bbbb-3333cccc4444'
}
]
}
},
handler: {
'@odata.type':
'#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler',
signUp: {
'@odata.type': '#microsoft.graph.fraudProtectionProviderConfiguration',
fraudProtectionProvider: {
'@odata.type': '#microsoft.graph.arkoseFraudProtectionProvider',
id: '6fedd01b-0afb-4a07-967f-d1ccbd81102b'
}
}
}
};
await client.api('/identity/authenticationEventListeners')
.post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OnFraudProtectionLoadStartListener;
use Microsoft\Graph\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Generated\Models\OnFraudProtectionLoadStartExternalUsersAuthHandler;
use Microsoft\Graph\Generated\Models\FraudProtectionProviderConfiguration;
use Microsoft\Graph\Generated\Models\ArkoseFraudProtectionProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnFraudProtectionLoadStartListener();
$requestBody->setOdataType('#microsoft.graph.onFraudProtectionLoadStartListener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('0001111-aaaa-2222-bbbb-3333cccc4444');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler();
$handler->setOdataType('#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler');
$handlerSignUp = new FraudProtectionProviderConfiguration();
$handlerSignUp->setOdataType('#microsoft.graph.fraudProtectionProviderConfiguration');
$handlerSignUpFraudProtectionProvider = new ArkoseFraudProtectionProvider();
$handlerSignUpFraudProtectionProvider->setOdataType('#microsoft.graph.arkoseFraudProtectionProvider');
$handlerSignUpFraudProtectionProvider->setId('6fedd01b-0afb-4a07-967f-d1ccbd81102b');
$handlerSignUp->setFraudProtectionProvider($handlerSignUpFraudProtectionProvider);
$handler->setSignUp($handlerSignUp);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.onFraudProtectionLoadStartListener"
conditions = @{
applications = @{
includeApplications = @(
@{
appId = "0001111-aaaa-2222-bbbb-3333cccc4444"
}
)
}
}
handler = @{
"@odata.type" = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler"
signUp = @{
"@odata.type" = "#microsoft.graph.fraudProtectionProviderConfiguration"
fraudProtectionProvider = @{
"@odata.type" = "#microsoft.graph.arkoseFraudProtectionProvider"
id = "6fedd01b-0afb-4a07-967f-d1ccbd81102b"
}
}
}
}
New-MgIdentityAuthenticationEventListener -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.on_fraud_protection_load_start_listener import OnFraudProtectionLoadStartListener
from msgraph.generated.models.authentication_conditions import AuthenticationConditions
from msgraph.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph.generated.models.on_fraud_protection_load_start_external_users_auth_handler import OnFraudProtectionLoadStartExternalUsersAuthHandler
from msgraph.generated.models.fraud_protection_provider_configuration import FraudProtectionProviderConfiguration
from msgraph.generated.models.arkose_fraud_protection_provider import ArkoseFraudProtectionProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnFraudProtectionLoadStartListener(
odata_type = "#microsoft.graph.onFraudProtectionLoadStartListener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "0001111-aaaa-2222-bbbb-3333cccc4444",
),
],
),
),
handler = OnFraudProtectionLoadStartExternalUsersAuthHandler(
odata_type = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
sign_up = FraudProtectionProviderConfiguration(
odata_type = "#microsoft.graph.fraudProtectionProviderConfiguration",
fraud_protection_provider = ArkoseFraudProtectionProvider(
odata_type = "#microsoft.graph.arkoseFraudProtectionProvider",
id = "6fedd01b-0afb-4a07-967f-d1ccbd81102b",
),
),
),
)
result = await graph_client.identity.authentication_event_listeners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/authenticationEventListeners/$entity",
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartListener",
"id": "49eb23d9-998b-47df-a462-aa12a20ae5fb",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "0001111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
"signUp": {
"fraudProtectionProvider": {
"@odata.type": "#microsoft.graph.arkoseFraudProtectionProvider",
"id": "fabe5100-cc02-46c1-bd0e-ce885fe367fd"
}
}
}
}
示例 3:使用 HUMAN Security 注册期间启用欺诈防护
请求
以下示例演示了使用 HUMAN Security 在注册期间启用欺诈保护的请求。
POST https://graph.microsoft.com/v1.0/identity/authenticationEventListeners
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartListener",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "0001111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type":
"#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
"signUp": {
"@odata.type": "#microsoft.graph.fraudProtectionProviderConfiguration",
"fraudProtectionProvider": {
"@odata.type": "#microsoft.graph.humanSecurityFraudProtectionProvider",
"id": "fabe5100-cc02-46c1-bd0e-ce885fe367fd"
}
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnFraudProtectionLoadStartListener
{
OdataType = "#microsoft.graph.onFraudProtectionLoadStartListener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "0001111-aaaa-2222-bbbb-3333cccc4444",
},
},
},
},
Handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler
{
OdataType = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
SignUp = new FraudProtectionProviderConfiguration
{
OdataType = "#microsoft.graph.fraudProtectionProviderConfiguration",
FraudProtectionProvider = new HumanSecurityFraudProtectionProvider
{
OdataType = "#microsoft.graph.humanSecurityFraudProtectionProvider",
Id = "fabe5100-cc02-46c1-bd0e-ce885fe367fd",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "0001111-aaaa-2222-bbbb-3333cccc4444"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnFraudProtectionLoadStartExternalUsersAuthHandler()
signUp := graphmodels.NewFraudProtectionProviderConfiguration()
fraudProtectionProvider := graphmodels.NewHumanSecurityFraudProtectionProvider()
id := "fabe5100-cc02-46c1-bd0e-ce885fe367fd"
fraudProtectionProvider.SetId(&id)
signUp.SetFraudProtectionProvider(fraudProtectionProvider)
handler.SetSignUp(signUp)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnFraudProtectionLoadStartListener authenticationEventListener = new OnFraudProtectionLoadStartListener();
authenticationEventListener.setOdataType("#microsoft.graph.onFraudProtectionLoadStartListener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("0001111-aaaa-2222-bbbb-3333cccc4444");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnFraudProtectionLoadStartExternalUsersAuthHandler handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler();
handler.setOdataType("#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler");
FraudProtectionProviderConfiguration signUp = new FraudProtectionProviderConfiguration();
signUp.setOdataType("#microsoft.graph.fraudProtectionProviderConfiguration");
HumanSecurityFraudProtectionProvider fraudProtectionProvider = new HumanSecurityFraudProtectionProvider();
fraudProtectionProvider.setOdataType("#microsoft.graph.humanSecurityFraudProtectionProvider");
fraudProtectionProvider.setId("fabe5100-cc02-46c1-bd0e-ce885fe367fd");
signUp.setFraudProtectionProvider(fraudProtectionProvider);
handler.setSignUp(signUp);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationEventListener = {
'@odata.type': '#microsoft.graph.onFraudProtectionLoadStartListener',
conditions: {
applications: {
includeApplications: [
{
appId: '0001111-aaaa-2222-bbbb-3333cccc4444'
}
]
}
},
handler: {
'@odata.type':
'#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler',
signUp: {
'@odata.type': '#microsoft.graph.fraudProtectionProviderConfiguration',
fraudProtectionProvider: {
'@odata.type': '#microsoft.graph.humanSecurityFraudProtectionProvider',
id: 'fabe5100-cc02-46c1-bd0e-ce885fe367fd'
}
}
}
};
await client.api('/identity/authenticationEventListeners')
.post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OnFraudProtectionLoadStartListener;
use Microsoft\Graph\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Generated\Models\OnFraudProtectionLoadStartExternalUsersAuthHandler;
use Microsoft\Graph\Generated\Models\FraudProtectionProviderConfiguration;
use Microsoft\Graph\Generated\Models\HumanSecurityFraudProtectionProvider;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnFraudProtectionLoadStartListener();
$requestBody->setOdataType('#microsoft.graph.onFraudProtectionLoadStartListener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('0001111-aaaa-2222-bbbb-3333cccc4444');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnFraudProtectionLoadStartExternalUsersAuthHandler();
$handler->setOdataType('#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler');
$handlerSignUp = new FraudProtectionProviderConfiguration();
$handlerSignUp->setOdataType('#microsoft.graph.fraudProtectionProviderConfiguration');
$handlerSignUpFraudProtectionProvider = new HumanSecurityFraudProtectionProvider();
$handlerSignUpFraudProtectionProvider->setOdataType('#microsoft.graph.humanSecurityFraudProtectionProvider');
$handlerSignUpFraudProtectionProvider->setId('fabe5100-cc02-46c1-bd0e-ce885fe367fd');
$handlerSignUp->setFraudProtectionProvider($handlerSignUpFraudProtectionProvider);
$handler->setSignUp($handlerSignUp);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.onFraudProtectionLoadStartListener"
conditions = @{
applications = @{
includeApplications = @(
@{
appId = "0001111-aaaa-2222-bbbb-3333cccc4444"
}
)
}
}
handler = @{
"@odata.type" = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler"
signUp = @{
"@odata.type" = "#microsoft.graph.fraudProtectionProviderConfiguration"
fraudProtectionProvider = @{
"@odata.type" = "#microsoft.graph.humanSecurityFraudProtectionProvider"
id = "fabe5100-cc02-46c1-bd0e-ce885fe367fd"
}
}
}
}
New-MgIdentityAuthenticationEventListener -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.on_fraud_protection_load_start_listener import OnFraudProtectionLoadStartListener
from msgraph.generated.models.authentication_conditions import AuthenticationConditions
from msgraph.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph.generated.models.on_fraud_protection_load_start_external_users_auth_handler import OnFraudProtectionLoadStartExternalUsersAuthHandler
from msgraph.generated.models.fraud_protection_provider_configuration import FraudProtectionProviderConfiguration
from msgraph.generated.models.human_security_fraud_protection_provider import HumanSecurityFraudProtectionProvider
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnFraudProtectionLoadStartListener(
odata_type = "#microsoft.graph.onFraudProtectionLoadStartListener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "0001111-aaaa-2222-bbbb-3333cccc4444",
),
],
),
),
handler = OnFraudProtectionLoadStartExternalUsersAuthHandler(
odata_type = "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
sign_up = FraudProtectionProviderConfiguration(
odata_type = "#microsoft.graph.fraudProtectionProviderConfiguration",
fraud_protection_provider = HumanSecurityFraudProtectionProvider(
odata_type = "#microsoft.graph.humanSecurityFraudProtectionProvider",
id = "fabe5100-cc02-46c1-bd0e-ce885fe367fd",
),
),
),
)
result = await graph_client.identity.authentication_event_listeners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/authenticationEventListeners/$entity",
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartListener",
"id": "49eb23d9-998b-47df-a462-aa12a20ae5fb",
"conditions": {
"applications": {
"includeApplications": [
{
"appId": "0001111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onFraudProtectionLoadStartExternalUsersAuthHandler",
"signUp": {
"isContinueOnProviderErrorEnabled": false,
"fraudProtectionProvider": {
"@odata.type": "#microsoft.graph.humanSecurityFraudProtectionProvider",
"id": "fabe5100-cc02-46c1-bd0e-ce885fe367fd"
}
}
}
}
示例 4:创建 onPasswordSubmitListener 对象
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/v1.0/identity/authenticationEventListeners
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.onPasswordSubmitListener",
"displayName": "JIT migration listener",
"conditions": {
"applications": {
"includeAllApplications": false,
"includeApplications": [
{
"appId": "00011111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onPasswordMigrationCustomExtensionHandler",
"migrationPropertyId": "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration",
"customExtension": {
"id": "6fc5012e-7665-43d6-9708-4370863f4e6e"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnPasswordSubmitListener
{
OdataType = "#microsoft.graph.onPasswordSubmitListener",
DisplayName = "JIT migration listener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "00011111-aaaa-2222-bbbb-3333cccc4444",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"includeAllApplications" , false
},
},
},
},
Handler = new OnPasswordMigrationCustomExtensionHandler
{
OdataType = "#microsoft.graph.onPasswordMigrationCustomExtensionHandler",
MigrationPropertyId = "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration",
CustomExtension = new OnPasswordSubmitCustomExtension
{
Id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
displayName := "JIT migration listener"
requestBody.SetDisplayName(&displayName)
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "00011111-aaaa-2222-bbbb-3333cccc4444"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
additionalData := map[string]interface{}{
includeAllApplications := false
applications.SetIncludeAllApplications(&includeAllApplications)
}
applications.SetAdditionalData(additionalData)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnPasswordMigrationCustomExtensionHandler()
migrationPropertyId := "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration"
handler.SetMigrationPropertyId(&migrationPropertyId)
customExtension := graphmodels.NewOnPasswordSubmitCustomExtension()
id := "6fc5012e-7665-43d6-9708-4370863f4e6e"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnPasswordSubmitListener authenticationEventListener = new OnPasswordSubmitListener();
authenticationEventListener.setOdataType("#microsoft.graph.onPasswordSubmitListener");
authenticationEventListener.setDisplayName("JIT migration listener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("00011111-aaaa-2222-bbbb-3333cccc4444");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("includeAllApplications", false);
applications.setAdditionalData(additionalData);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnPasswordMigrationCustomExtensionHandler handler = new OnPasswordMigrationCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onPasswordMigrationCustomExtensionHandler");
handler.setMigrationPropertyId("extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration");
OnPasswordSubmitCustomExtension customExtension = new OnPasswordSubmitCustomExtension();
customExtension.setId("6fc5012e-7665-43d6-9708-4370863f4e6e");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationEventListener = {
'@odata.type': '#microsoft.graph.onPasswordSubmitListener',
displayName: 'JIT migration listener',
conditions: {
applications: {
includeAllApplications: false,
includeApplications: [
{
appId: '00011111-aaaa-2222-bbbb-3333cccc4444'
}
]
}
},
handler: {
'@odata.type': '#microsoft.graph.onPasswordMigrationCustomExtensionHandler',
migrationPropertyId: 'extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration',
customExtension: {
id: '6fc5012e-7665-43d6-9708-4370863f4e6e'
}
}
};
await client.api('/identity/authenticationEventListeners')
.post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OnPasswordSubmitListener;
use Microsoft\Graph\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Generated\Models\OnPasswordMigrationCustomExtensionHandler;
use Microsoft\Graph\Generated\Models\OnPasswordSubmitCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnPasswordSubmitListener();
$requestBody->setOdataType('#microsoft.graph.onPasswordSubmitListener');
$requestBody->setDisplayName('JIT migration listener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('00011111-aaaa-2222-bbbb-3333cccc4444');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$additionalData = [
'includeAllApplications' => false,
];
$conditionsApplications->setAdditionalData($additionalData);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnPasswordMigrationCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onPasswordMigrationCustomExtensionHandler');
$handler->setMigrationPropertyId('extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration');
$handlerCustomExtension = new OnPasswordSubmitCustomExtension();
$handlerCustomExtension->setId('6fc5012e-7665-43d6-9708-4370863f4e6e');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.onPasswordSubmitListener"
displayName = "JIT migration listener"
conditions = @{
applications = @{
includeAllApplications = $false
includeApplications = @(
@{
appId = "00011111-aaaa-2222-bbbb-3333cccc4444"
}
)
}
}
handler = @{
"@odata.type" = "#microsoft.graph.onPasswordMigrationCustomExtensionHandler"
migrationPropertyId = "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration"
customExtension = @{
id = "6fc5012e-7665-43d6-9708-4370863f4e6e"
}
}
}
New-MgIdentityAuthenticationEventListener -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.on_password_submit_listener import OnPasswordSubmitListener
from msgraph.generated.models.authentication_conditions import AuthenticationConditions
from msgraph.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph.generated.models.on_password_migration_custom_extension_handler import OnPasswordMigrationCustomExtensionHandler
from msgraph.generated.models.on_password_submit_custom_extension import OnPasswordSubmitCustomExtension
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnPasswordSubmitListener(
odata_type = "#microsoft.graph.onPasswordSubmitListener",
display_name = "JIT migration listener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "00011111-aaaa-2222-bbbb-3333cccc4444",
),
],
additional_data = {
"include_all_applications" : False,
}
),
),
handler = OnPasswordMigrationCustomExtensionHandler(
odata_type = "#microsoft.graph.onPasswordMigrationCustomExtensionHandler",
migration_property_id = "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration",
custom_extension = OnPasswordSubmitCustomExtension(
id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
),
),
)
result = await graph_client.identity.authentication_event_listeners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/authenticationEventListeners/$entity",
"@odata.type": "#microsoft.graph.onPasswordSubmitListener",
"id": "4a6cb5f0-1234-5678-abcd-ef9012345678",
"displayName": "JIT migration listener",
"authenticationEventsFlowId": null,
"conditions": {
"applications": {
"includeAllApplications": false,
"includeApplications": [
{
"appId": "00011111-aaaa-2222-bbbb-3333cccc4444"
}
]
}
},
"handler": {
"@odata.type": "#microsoft.graph.onPasswordMigrationCustomExtensionHandler",
"migrationPropertyId": "extension_b7b1c57b532f40b8b5ed4b7a7ba67401_requiresMigration",
"configuration": null
}
}
示例 5:创建 onVerifiedIdClaimValidationListener 对象
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/v1.0/identity/authenticationEventListeners
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationListener",
"displayName": "Verified ID Claim Validation Listener",
"priority": 500,
"conditions": {
"applications": {
"includeAllApplications": false,
"includeApplications": [
{
"appId": "63856651-13d9-4784-9abf-20758d509e19"
}
]
}
},
"authenticationEventsFlowId": "5a8e8f57-82b2-4cbf-b145-3e6e0c154897",
"handler": {
"@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler",
"configuration": {
"@odata.type": "#microsoft.graph.customExtensionOverwriteConfiguration",
"clientConfiguration": {
"@odata.type": "#microsoft.graph.customExtensionClientConfiguration",
"maximumRetries": 1,
"timeoutInMilliseconds": 2000
},
"behaviorOnError": {
"@odata.type": "#microsoft.graph.customExtensionBehaviorOnError"
}
},
"customExtension": {
"id": "6a0a3429-be77-0aed-951e-1c8aed62bf8a"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OnVerifiedIdClaimValidationListener
{
OdataType = "#microsoft.graph.onVerifiedIdClaimValidationListener",
DisplayName = "Verified ID Claim Validation Listener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "63856651-13d9-4784-9abf-20758d509e19",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"includeAllApplications" , false
},
},
},
},
AuthenticationEventsFlowId = "5a8e8f57-82b2-4cbf-b145-3e6e0c154897",
Handler = new OnVerifiedIdClaimValidationCustomExtensionHandler
{
OdataType = "#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler",
Configuration = new CustomExtensionOverwriteConfiguration
{
OdataType = "#microsoft.graph.customExtensionOverwriteConfiguration",
ClientConfiguration = new CustomExtensionClientConfiguration
{
OdataType = "#microsoft.graph.customExtensionClientConfiguration",
MaximumRetries = 1,
TimeoutInMilliseconds = 2000,
},
BehaviorOnError = new CustomExtensionBehaviorOnError
{
OdataType = "#microsoft.graph.customExtensionBehaviorOnError",
},
},
CustomExtension = new OnVerifiedIdClaimValidationCustomExtension
{
Id = "6a0a3429-be77-0aed-951e-1c8aed62bf8a",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"priority" , 500
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
displayName := "Verified ID Claim Validation Listener"
requestBody.SetDisplayName(&displayName)
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "63856651-13d9-4784-9abf-20758d509e19"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
additionalData := map[string]interface{}{
includeAllApplications := false
applications.SetIncludeAllApplications(&includeAllApplications)
}
applications.SetAdditionalData(additionalData)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
authenticationEventsFlowId := "5a8e8f57-82b2-4cbf-b145-3e6e0c154897"
requestBody.SetAuthenticationEventsFlowId(&authenticationEventsFlowId)
handler := graphmodels.NewOnVerifiedIdClaimValidationCustomExtensionHandler()
configuration := graphmodels.NewCustomExtensionOverwriteConfiguration()
clientConfiguration := graphmodels.NewCustomExtensionClientConfiguration()
maximumRetries := int32(1)
clientConfiguration.SetMaximumRetries(&maximumRetries)
timeoutInMilliseconds := int32(2000)
clientConfiguration.SetTimeoutInMilliseconds(&timeoutInMilliseconds)
configuration.SetClientConfiguration(clientConfiguration)
behaviorOnError := graphmodels.NewCustomExtensionBehaviorOnError()
configuration.SetBehaviorOnError(behaviorOnError)
handler.SetConfiguration(configuration)
customExtension := graphmodels.NewOnVerifiedIdClaimValidationCustomExtension()
id := "6a0a3429-be77-0aed-951e-1c8aed62bf8a"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
additionalData := map[string]interface{}{
"priority" : int32(500) ,
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnVerifiedIdClaimValidationListener authenticationEventListener = new OnVerifiedIdClaimValidationListener();
authenticationEventListener.setOdataType("#microsoft.graph.onVerifiedIdClaimValidationListener");
authenticationEventListener.setDisplayName("Verified ID Claim Validation Listener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("63856651-13d9-4784-9abf-20758d509e19");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("includeAllApplications", false);
applications.setAdditionalData(additionalData);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
authenticationEventListener.setAuthenticationEventsFlowId("5a8e8f57-82b2-4cbf-b145-3e6e0c154897");
OnVerifiedIdClaimValidationCustomExtensionHandler handler = new OnVerifiedIdClaimValidationCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler");
CustomExtensionOverwriteConfiguration configuration = new CustomExtensionOverwriteConfiguration();
configuration.setOdataType("#microsoft.graph.customExtensionOverwriteConfiguration");
CustomExtensionClientConfiguration clientConfiguration = new CustomExtensionClientConfiguration();
clientConfiguration.setOdataType("#microsoft.graph.customExtensionClientConfiguration");
clientConfiguration.setMaximumRetries(1);
clientConfiguration.setTimeoutInMilliseconds(2000);
configuration.setClientConfiguration(clientConfiguration);
CustomExtensionBehaviorOnError behaviorOnError = new CustomExtensionBehaviorOnError();
behaviorOnError.setOdataType("#microsoft.graph.customExtensionBehaviorOnError");
configuration.setBehaviorOnError(behaviorOnError);
handler.setConfiguration(configuration);
OnVerifiedIdClaimValidationCustomExtension customExtension = new OnVerifiedIdClaimValidationCustomExtension();
customExtension.setId("6a0a3429-be77-0aed-951e-1c8aed62bf8a");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("priority", 500);
authenticationEventListener.setAdditionalData(additionalData1);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationEventListener = {
'@odata.type': '#microsoft.graph.onVerifiedIdClaimValidationListener',
displayName: 'Verified ID Claim Validation Listener',
priority: 500,
conditions: {
applications: {
includeAllApplications: false,
includeApplications: [
{
appId: '63856651-13d9-4784-9abf-20758d509e19'
}
]
}
},
authenticationEventsFlowId: '5a8e8f57-82b2-4cbf-b145-3e6e0c154897',
handler: {
'@odata.type': '#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler',
configuration: {
'@odata.type': '#microsoft.graph.customExtensionOverwriteConfiguration',
clientConfiguration: {
'@odata.type': '#microsoft.graph.customExtensionClientConfiguration',
maximumRetries: 1,
timeoutInMilliseconds: 2000
},
behaviorOnError: {
'@odata.type': '#microsoft.graph.customExtensionBehaviorOnError'
}
},
customExtension: {
id: '6a0a3429-be77-0aed-951e-1c8aed62bf8a'
}
}
};
await client.api('/identity/authenticationEventListeners')
.post(authenticationEventListener);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OnVerifiedIdClaimValidationListener;
use Microsoft\Graph\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Generated\Models\OnVerifiedIdClaimValidationCustomExtensionHandler;
use Microsoft\Graph\Generated\Models\CustomExtensionOverwriteConfiguration;
use Microsoft\Graph\Generated\Models\CustomExtensionClientConfiguration;
use Microsoft\Graph\Generated\Models\CustomExtensionBehaviorOnError;
use Microsoft\Graph\Generated\Models\OnVerifiedIdClaimValidationCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnVerifiedIdClaimValidationListener();
$requestBody->setOdataType('#microsoft.graph.onVerifiedIdClaimValidationListener');
$requestBody->setDisplayName('Verified ID Claim Validation Listener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('63856651-13d9-4784-9abf-20758d509e19');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$additionalData = [
'includeAllApplications' => false,
];
$conditionsApplications->setAdditionalData($additionalData);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$requestBody->setAuthenticationEventsFlowId('5a8e8f57-82b2-4cbf-b145-3e6e0c154897');
$handler = new OnVerifiedIdClaimValidationCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler');
$handlerConfiguration = new CustomExtensionOverwriteConfiguration();
$handlerConfiguration->setOdataType('#microsoft.graph.customExtensionOverwriteConfiguration');
$handlerConfigurationClientConfiguration = new CustomExtensionClientConfiguration();
$handlerConfigurationClientConfiguration->setOdataType('#microsoft.graph.customExtensionClientConfiguration');
$handlerConfigurationClientConfiguration->setMaximumRetries(1);
$handlerConfigurationClientConfiguration->setTimeoutInMilliseconds(2000);
$handlerConfiguration->setClientConfiguration($handlerConfigurationClientConfiguration);
$handlerConfigurationBehaviorOnError = new CustomExtensionBehaviorOnError();
$handlerConfigurationBehaviorOnError->setOdataType('#microsoft.graph.customExtensionBehaviorOnError');
$handlerConfiguration->setBehaviorOnError($handlerConfigurationBehaviorOnError);
$handler->setConfiguration($handlerConfiguration);
$handlerCustomExtension = new OnVerifiedIdClaimValidationCustomExtension();
$handlerCustomExtension->setId('6a0a3429-be77-0aed-951e-1c8aed62bf8a');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$additionalData = [
'priority' => 500,
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.onVerifiedIdClaimValidationListener"
displayName = "Verified ID Claim Validation Listener"
priority =
conditions = @{
applications = @{
includeAllApplications = $false
includeApplications = @(
@{
appId = "63856651-13d9-4784-9abf-20758d509e19"
}
)
}
}
authenticationEventsFlowId = "5a8e8f57-82b2-4cbf-b145-3e6e0c154897"
handler = @{
"@odata.type" = "#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler"
configuration = @{
"@odata.type" = "#microsoft.graph.customExtensionOverwriteConfiguration"
clientConfiguration = @{
"@odata.type" = "#microsoft.graph.customExtensionClientConfiguration"
maximumRetries =
timeoutInMilliseconds =
}
behaviorOnError = @{
"@odata.type" = "#microsoft.graph.customExtensionBehaviorOnError"
}
}
customExtension = @{
id = "6a0a3429-be77-0aed-951e-1c8aed62bf8a"
}
}
}
New-MgIdentityAuthenticationEventListener -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.on_verified_id_claim_validation_listener import OnVerifiedIdClaimValidationListener
from msgraph.generated.models.authentication_conditions import AuthenticationConditions
from msgraph.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph.generated.models.on_verified_id_claim_validation_custom_extension_handler import OnVerifiedIdClaimValidationCustomExtensionHandler
from msgraph.generated.models.custom_extension_overwrite_configuration import CustomExtensionOverwriteConfiguration
from msgraph.generated.models.custom_extension_client_configuration import CustomExtensionClientConfiguration
from msgraph.generated.models.custom_extension_behavior_on_error import CustomExtensionBehaviorOnError
from msgraph.generated.models.on_verified_id_claim_validation_custom_extension import OnVerifiedIdClaimValidationCustomExtension
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnVerifiedIdClaimValidationListener(
odata_type = "#microsoft.graph.onVerifiedIdClaimValidationListener",
display_name = "Verified ID Claim Validation Listener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "63856651-13d9-4784-9abf-20758d509e19",
),
],
additional_data = {
"include_all_applications" : False,
}
),
),
authentication_events_flow_id = "5a8e8f57-82b2-4cbf-b145-3e6e0c154897",
handler = OnVerifiedIdClaimValidationCustomExtensionHandler(
odata_type = "#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler",
configuration = CustomExtensionOverwriteConfiguration(
odata_type = "#microsoft.graph.customExtensionOverwriteConfiguration",
client_configuration = CustomExtensionClientConfiguration(
odata_type = "#microsoft.graph.customExtensionClientConfiguration",
maximum_retries = 1,
timeout_in_milliseconds = 2000,
),
behavior_on_error = CustomExtensionBehaviorOnError(
odata_type = "#microsoft.graph.customExtensionBehaviorOnError",
),
),
custom_extension = OnVerifiedIdClaimValidationCustomExtension(
id = "6a0a3429-be77-0aed-951e-1c8aed62bf8a",
),
),
additional_data = {
"priority" : 500,
}
)
result = await graph_client.identity.authentication_event_listeners.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/authenticationEventListeners/$entity",
"@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationListener",
"id": "6a7455ef-0906-bbc3-f902-0f9ab8903082",
"displayName": "Verified ID Claim Validation Listener",
"priority": 500,
"conditions": {
"applications": {
"includeAllApplications": false,
"includeApplications": [
{
"appId": "63856651-13d9-4784-9abf-20758d509e19"
}
]
}
},
"authenticationEventsFlowId": "5a8e8f57-82b2-4cbf-b145-3e6e0c154897",
"handler": {
"@odata.type": "#microsoft.graph.onVerifiedIdClaimValidationCustomExtensionHandler",
"configuration": {
"@odata.type": "#microsoft.graph.customExtensionOverwriteConfiguration",
"clientConfiguration": {
"@odata.type": "#microsoft.graph.customExtensionClientConfiguration",
"maximumRetries": 1,
"timeoutInMilliseconds": 2000
},
"behaviorOnError": {
"@odata.type": "#microsoft.graph.customExtensionBehaviorOnError"
}
},
"customExtension": {
"id": "6a0a3429-be77-0aed-951e-1c8aed62bf8a"
}
}
}