-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To send confirmation email to user after register on WSO2 API Manager Store #4070
Comments
This is possible with the use of user signup workflow in APIM [1]. As explains in [2], you can send an email when a user sign up request comes or when a user sign up request completes. [1] - https://docs.wso2.com/display/AM260/Adding+a+User+Signup+Workflow Thank you! |
Hi @pubudu538 I have an issue related to @pcalero 's one. As you've said above in your reply to @pcalero, it's in fact possible to send an email to any custom email address, however it's no possible get the email address provided at user registration even though email address is required in order to complete user registration. I've successfully implemented user signup workflow with Azure Flow by writing a custom implementation, but as explained before, there's no way to get registered-user's email address and send them back an email confirmation for their user-registration approval status. Here is an excerpt with default WSO2 user signup workflow implementation attributes carried by String tenantDomain = workflowDTO.getTenantDomain();
String tenantAwareUserName = MultitenantUtils
.getTenantAwareUsername(workflowDTO.getWorkflowReference());
String externalRef = workflowDTO.getExternalWorkflowReference();
String callBackURL = workflowDTO.getCallbackUrl(); Do you know any possible way to programmatically get the user email from username? Thank you! |
You can use APIMgtDAO and do as follows. In this way, you can access any DAO layer.
Probably you can try the following method to get the email address of a user. https://github.com/wso2/carbon-apimgt/blob/master/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java#L1198 |
Hi @pubudu538 thanks for your quick reply. Unfortunately this approach is for retrieve a Subscriber from it's username. At the time users sign up their requested user is completely new and has no subscriptions. I've tried follow query targeted to UM_USER_ATTRIBUTE table but seems that getting the connection object as in ApiMgtDAO points to WSO2AM DB. SELECT UM_ATTR_NAME AS EMAIL_ADDRESS
FROM UM_USER_ATTRIBUTE
WHERE LOWER(UM_USER_ID) = ?
AND UM_TENANT_ID = ?
AND UM_ATTR_NAME = 'mail' I wonder whether there's a similar way to get a connection pointing to WSO2UM DB. I've looked at code but couldn't find any User DTO or something similar. Thanks in advance. |
Hi @pubudu538 private static final String EMAIL_CLAIM_ADDRESS = "http://wso2.org/claims/emailaddress";
....
/* Getting user claims for tenantAwareUserName*/
private Map<String, String> getUserClaims(String tenantAwareUserName) {
/* Getting user claims */
Map<String, String> claims = new HashMap<>();
try {
ClaimsRetriever claimsRetriever = new DefaultClaimsRetriever();
claimsRetriever.init();
claims = claimsRetriever.getClaims(tenantAwareUserName);
log.debug("Begin user claims =================");
claims.entrySet().stream()
.forEach(c -> log.debug(String.format("%s=%s%n", c.getKey(), c.getValue())));
log.debug("End user claims =================");
} catch (APIManagementException e) {
log.error("Error getting user claims");
}
return claims;
}
....
/* Looking for email claim for tenantAwareUserName*/
private String getUserEmail (String tenantAwareUserName){
String userEmail;
Map<String, String> claims = getUserClaims(tenantAwareUserName);
userEmail = claims.entrySet().stream()
.filter(c -> EMAIL_CLAIM_ADDRESS.equals(c.getKey()))
.findFirst()
.map(f -> f.getValue())
.orElse("");
log.debug(String.format("%s=%s%n", EMAIL_CLAIM_ADDRESS, userEmail));
return userEmail;
} Thanks for your support. |
Answered, hence resolving. Please reopen if you need further help on this. |
Hi @pubudu538 |
Description:
It is not possible to send confirmation email to user after register (sign up) on API Store (of WSO2 API Manager).
Suggested Labels:
Type/Bug
Severity/Major
product-apim
Suggested Assignees:
Affected Product Version:
WSO2 API Manager 2.5.0
OS, DB, other environment details and versions:
Cluster of two nodes with load balancer. High availability
Steps to reproduce:
Related Issues:
https://stackoverflow.com/questions/53308357/how-to-send-account-confirmation-e-mail-after-self-sign-up-on-wso2-api-manager/
#2265
https://stackoverflow.com/questions/41828554/wso2-api-manager-user-authencation-email
The text was updated successfully, but these errors were encountered: