首页 文章

WSO2发送恢复通知

提问于
浏览
2

在我们当前的WSO2设置中,在用户执行自我创建后,我们将其帐户置于锁定状态,并将确认电子邮件发送到创建期间指定的地址 . 此电子邮件的链接允许用户验证其帐户 .

出于开发目的,我们尝试使用SOAP UI中的 UserInformationRecoveryService wsdl来关闭工作流 . 我们似乎想要的服务叫做 sendRecoveryNotification . 这是此服务的签名:

sendRecoveryNotification(String username, String key, String notificationType)

username 参数只是我们所讨论的WSO2用户的用户名 . 对于 notificationType ,我们一直在使用 email ,这可能会触发将电子邮件发送给用户 . 问题出在 key 参数上 . 目前尚不清楚应该使用什么值作为 key ,我们所有的猜测都会导致此错误响应:

18001用户无效确认码:tbiegeleisen @ abc.com @ tenant.com

我们还注意到其他一些服务也期望一个密钥,并且不清楚如何获得这个值 .

有人能否阐明WSO2中用户恢复的工作流程?它似乎是一个Catch-22,需要一个令牌才能生成一个新的令牌发送给用户 .

1 回答

  • 1

    WSO2 documentation清楚地说明了通知的恢复工作流程 . 需要使用的 key 是调用 verifyUser() SOAP Web服务的返回值 . 该服务本身需要一个通常从UI发送的Captcha . 以下是一段代码片段,展示了如何发送恢复通知:

    String cookies = client.login("admin@tenant.com@tenant.com", "admin");
    UserInformationRecoveryUtil userInfoutil = new UserInformationRecoveryUtil(webserviceUrl, cookies);
    CaptchaInfoBean captchaInfo = new CaptchaInfoBean();
    captchaInfo.setImagePath(captchaPath);
    captchaInfo.setSecretKey(captchaKey);
    captchaInfo.setUserAnswer(captcha);
    String username = emailId + "@" + tenantDomain;
    String key = userInfoutil.verifyUser(username, captchaInfo);
    
    // now pass the key based on the Captcha along with the type of recovery action
    userInfoutil.sendRecoveryNotification(username, key, "accountUnLock");
    

相关问题