首页 > 解决方案 > 在 wso2is 5.10.0 中添加/更新/删除用户角色后发送通知

问题描述

我使用的是 WSO2IS 5.10.0,所以我需要在添加、更新或删除任何用户的用户角色后发送通知电子邮件。为此,我参考了这个 wso2 文档12,但它没有按预期工作。有什么办法可以解决这个问题吗?

标签: wso2wso2is

解决方案


  1. 如本文档所述,首先您需要配置输出事件适配器来配置需要用于发送电子邮件通知的电子邮件帐户。
  2. 然后,您需要订阅电子邮件发送模块,以获取本文档中提到的用户操作事件。

例如,要为添加、更新或删除用户角色后配置电子邮件通知,identity-event.properties 文件中的示例配置如下所示:

module.name.2=emailSend
emailSend.subscription.1=TRIGGER_NOTIFICATION
emailSend.subscription.2=POST_ADD_ROLE
emailSend.subscription.3=POST_UPDATE_ROLE
emailSend.subscription.4=POST_DELETE_ROLE

但是由于 IS5.9.0 引入了新的配置模型,直接将此配置添加到identity-event.properties 中会被覆盖。

因此,您必须将以下配置直接添加到 deployment.toml文件中。

  [identity_mgt.events.schemes.emailSend]
subscriptions = [
       "TRIGGER_NOTIFICATION",
       "POST_ADD_ROLE",
       "POST_UPDATE_ROLE",
       "POST_DELETE_ROLE"
     ]

[identity_mgt.events.schemes.emailSend.properties]
'subscription.POST_ADD_ROLE.template' = "testDelete"

您可以在此处为属性下的每个订阅添加属性。

您可以参考此 identity-event.properties.j2 文件以供进一步参考。https://github.com/wso2/carbon-identity-framework/blob/master/features/identity-event/org.wso2.carbon.identity.event.server.feature/resources/identity-event.properties.j2

您可以参考此博客以获取更多信息。


推荐阅读