命名空间:microsoft.graph
创建新的 authenticationEventListener 对象。 可以创建派生自 authenticationEventListener 的以下子类型之一。
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
EventListener.ReadWrite.All |
不可用。 |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
EventListener.ReadWrite.All |
不可用。 |
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 属性指定所创建对象的类型。
示例
请求
以下示例显示了一个请求。
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"
}
}
}
示例 5:在注册 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"
}
}
}
}
示例 6:使用 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"
}
}
}
}