Self-service user registration using CyberArk Identity APIs
This guide helps the client application integrate self-service user registration using CyberArk Identity APIs into their Java application using the Java SDK.
The Java SDK provides a User Management module that helps the client applications to integrate the user registration.
Prerequisite
Install the CyberArk Identity Java SDK
Configure User Management Instance
Create a UserManagement
object instance by providing the CyberArk Identity Application URL as shown below:
// import
import com.cyberark.client.UserManagement;
UserManagement userMgmt = new UserManagement(tenantURL);
The sign-up can be configured in two ways:
- Sign-up with Captcha - In this approach, google re-captcha is used for verifying valid user registration requests.
- Sign-up with Bearer Token - In this approach, the user sends a bearer token generated through the OAuth client credentials flow. Note: This flow is only recommended for web apps and not for SPAs and mobile apps.
Sign-up with Captcha
For more information on how to setup google reCaptcha refer: https://docs.cyberark.com/Product-Doc/OnlineHelp/Idaptive/Latest/en/Content/CoreServices/Authenticate/CAPTCHA.htm
Create a Sign-up request to create the user in the CyberArk Identity cloud directory by passing Google reCaptcha Token for verification as shown below:
try {
SignUpResponse result = userManagement.signUpWithCaptcha("YOUR_RECAPTCHA_TOKEN")
.setUserName("sample user")
.setDisplayName("sample username")
.setPassword("xxxxxx")
.setEmail("[email protected]")
.setMobileNumber("xxxx")
.execute();
} catch (IdentityException e) {
//Something happened
}
Sign-up with bearer token
Create a Sign-up request to create the user in the CyberArk Identity cloud directory using bearer token as shown below:
try {
Map<String, Object> attributes = new HashMap<>();
attributes.put("Mail", "YOUR_EMAIL");
attributes.put("MobileNumber", "YOUR_MOBILE_NUMBER");
attributes.put("DisplayName", "user display name");
SignUpResponse result = userManagement.signUpWithBearerToken("YOUR_BEARER_TOKEN")
.setPassword("xxxxxx")
.setEmail("[email protected]")
.setAdditionalAttributes(attributes)
.execute();
} catch (IdentityException e) {
//Something happened
}
Self-service user registration in Java-angular sample app
Prerequisite
The Java angular sample app contains examples of how the client application can integrate the CyberArk Identity self-service registration APIs to provide strong registration to their apps.
To try out the Signup API integration on the sample app, Click the "Signup" link on the APIs tile as shown below:
The signup form is displayed as below:
Once the user enters the details on the signup form and clicks on signup, the user is created in the CyberArk Identity successfully.
Updated 9 months ago