Compartir a través de


Creación de authenticationEventListener

Espacio de nombres: microsoft.graph

Importante

Las API de la versión /beta de Microsoft Graph están sujetas a cambios. No se admite el uso de estas API en aplicaciones de producción. Para determinar si una API está disponible en la versión 1.0, use el selector de Versión.

Cree un nuevo objeto authenticationEventListener . Puede crear uno de los subtipos siguientes que se derivan de authenticationEventListener.

Nota:

Puede tener un máximo de 250 agentes de escucha de eventos.

Esta API está disponible en las siguientes implementaciones nacionales de nube.

Servicio global Gobierno de EE. UU. L4 Us Government L5 (DOD) China operada por 21Vianet

Permissions

Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.

Tipo de permiso Permisos con privilegios mínimos Permisos con privilegios más altos
Delegado (cuenta profesional o educativa) EventListener.ReadWrite.All No disponible.
Delegado (cuenta personal de Microsoft) No admitida. No admitida.
Aplicación EventListener.ReadWrite.All No disponible.

Solicitud HTTP

POST /identity/authenticationEventListeners

Encabezados de solicitud

Nombre Descripción
Authorization {token} de portador. Obligatorio. Obtenga más información sobre la autenticación y la autorización.
Content-Type application/json. Obligatorio.

Cuerpo de la solicitud

En el cuerpo de la solicitud, proporcione una representación JSON del objeto authenticationEventListener .

Puede especificar las siguientes propiedades al crear un objeto authenticationEventListener. Debe especificar la propiedad @odata.type para especificar el tipo de authenticationEventListener que se va a crear; por ejemplo, @odata.type": "microsoft.graph.onTokenIssuanceStartListener".

Propiedad Tipo Descripción
authenticationEventsFlowId Cadena Identificador del flujo de eventos de autenticación. Opcional.
conditions authenticationConditions Condiciones en las que se debe desencadenar esta autenticaciónEventListener. Opcional.
handler onAttributeCollectionHandler Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onAttributeCollectionListener .
handler onAttributeCollectionStartListener Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onAttributeCollectionStartListener .
handler onAttributeCollectionSubmitListener Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onAttributeCollectionSubmitListener .
handler onAuthenticationMethodLoadStartHandler Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onAuthenticationMethodLoadStartListener .
handler onInteractiveAuthFlowStartHandler Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onInteractiveAuthFlowStartListener .
handler onTokenIssuanceStartHandler Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onTokenIssuanceStartListener .
handler onUserCreateStartHandler Controlador que se va a invocar cuando se cumplen las condiciones. Se puede establecer para el tipo de agente de escucha onUserCreateStartListener .
prioridad Int32 Prioridad de este controlador. Entre 0 (prioridad inferior) y 1000 (prioridad más alta). Obligatorio.

Respuesta

Si se ejecuta correctamente, este método devuelve un 201 Created código de respuesta y un objeto authenticationEventListener en el cuerpo de la respuesta. La propiedad @odata.type especifica el tipo del objeto creado.

Ejemplos

Ejemplo 1: Creación de un objeto onTokenIssuanceStartListener

Solicitud

En el ejemplo siguiente se muestra la solicitud.

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

{
    "@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",
    "conditions": {
        "applications": {
            "includeAllApplications": false,
            "includeApplications": [
                {
                    "appId": "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
                }
            ]
        }
    },
    "priority": 500,
    "handler": {
        "@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
        "customExtension": {
            "id": "6fc5012e-7665-43d6-9708-4370863f4e6e"
        }
    }
}

Respuesta

En el ejemplo siguiente se muestra la respuesta.

Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/authenticationEventListeners/$entity",
    "@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",
    "id": "990d94e5-cc8f-4c4b-97b4-27e2678aac28",
    "priority": 500,
    "authenticationEventsFlowId": null,
    "conditions": {
        "applications": {
            "includeAllApplications": false,
            "includeApplications": [
                {
                    "appId": "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
                }
            ]
        }
    },
    "handler": {
        "@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
        "customExtension": {
            "id": "6fc5012e-7665-43d6-9708-4370863f4e6e"
        }
    }
}

Ejemplo 2: Creación de un objeto onAttributeCollectionStartListener

Solicitud

En el ejemplo siguiente se muestra la solicitud.

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

{
    "@odata.type": "#microsoft.graph.onAttributeCollectionStartListener",
    "priority": 500,
    "conditions": {
        "applications": {
            "includeAllApplications": false,
            "includeApplications": [
                {
                    "appId": "a7eed01f-a333-4983-bc6b-d359ec9e5eef"
                }
            ]
        }
    },
    "handler": {
        "@odata.type": "#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler",
        "customExtension": {
            "id": "2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02"
        }
    }
}

Respuesta

En el ejemplo siguiente se muestra la respuesta.

Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/authenticationEventListeners/$entity",
    "@odata.type": "#microsoft.graph.onAttributeCollectionStartListener",
    "id": "1b025b34-6547-4714-b948-43f79b70c429",
    "priority": 500,
    "authenticationEventsFlowId": null,
    "conditions": {
        "applications": {
            "includeAllApplications": false
        }
    },
    "handler": {
        "@odata.type": "#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler",
        "configuration": null
    }
}

Ejemplo 3: Creación de un objeto onAttributeCollectionSubmitListener

Solicitud

En el ejemplo siguiente se muestra la solicitud.

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

{
    "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitListener",
    "priority": 500,
    "conditions": {
        "applications": {
            "includeAllApplications": false,
            "includeApplications": [
                {
                    "appId": "a7eed01f-a333-4983-bc6b-d359ec9e5eef"
                }
            ]
        }
    },
    "handler": {
        "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler",
        "customExtension": {
            "id": "66867d1f-7824-4f38-aad1-75da1ad09ee2"
        }
    }
}

Respuesta

En el ejemplo siguiente se muestra la respuesta.

Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.

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

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#identity/authenticationEventListeners/$entity",
    "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitListener",
    "id": "2066575e-fc31-4ac7-b07c-81b85f074441",
    "priority": 500,
    "authenticationEventsFlowId": null,
    "conditions": {
        "applications": {
            "includeAllApplications": false
        }
    },
    "handler": {
        "@odata.type": "#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler",
        "configuration": null
    }
}