Reputation: 521467
In our current WSO2 setup, after a user performs a self creation, we place his account into a locked state, and send a confirmation email to the address specified during creation. This email has a link which allows the user to verify his account.
For development purposes, we are attempting to get the workflow down using the UserInformationRecoveryService
wsdl in SOAP UI. The service which we seem to want is called sendRecoveryNotification
. Here is the signature of this service:
sendRecoveryNotification(String username, String key, String notificationType)
The username
parameter is simply the username of the WSO2 user in question, which we have. For the notificationType
we have been using email
, which presumably would trigger an email to be sent to the user. The problem is with the key
parameter. It is not clear what value should be used as key
, and all our guesses always lead to this error response:
18001 invalid confirmation code for user : [email protected]@tenant.com
We also noticed that several other services also expect a key, and it is not clear how to get this value.
Can someone shed light on the workflow for user recovery in WSO2? It seems to be a Catch-22 with regard of requiring a token in order to generate a new token to be sent to a user.
Upvotes: 2
Views: 229
Reputation: 521467
The WSO2 documentation clearly spells out the workflow for recovery with notification. The key
which needs to be used is the return value from a call to the verifyUser()
SOAP web service. This service itself expects a Captcha which normally would be sent from the UI. Here is a code snippet showing how a recovery notification can be sent:
String cookies = client.login("[email protected]@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");
Upvotes: 1