I am trying to create CyberArk Safe through the REST API and I am able to get the token from CyberArk after passing the username and password but when creating the safe after passing the token then its returning the response code 403. Anybody have the sample code or can provide the details about 403 response code.
If you have a connector set up already (of type āPrivileged Account Managementā) to communicate with CyberArk - you can actually use the SailPoint āProvisionerā class in your beanshell code to do this - an example would look like:
ProvisioningPlan safePlan = new ProvisioningPlan();
ObjectRequest safeReq = new ObjectRequest();
safeReq.setApplication("CyberArk Application Name");
safePlan.setTargetIntegration("CyberArk Application Name");
safeReq.setTargetIntegration("CyberArk Application Name");
safeReq.setNativeIdentity("The new Safe name");
safeReq.setOp(ProvisioningPlan.ObjectOperation.Create);
safeReq.setType("Container");
AttributeRequest aReq = new AttributeRequest("name", ProvisioningPlan.Operation.Set, "The new Safe name");
safeReq.add(aReq);
aReq = new AttributeRequest("location", ProvisioningPlan.Operation.Set, "\\");
safeReq.add(aReq);
aReq = new AttributeRequest("Description", ProvisioningPlan.Operation.Set, "A description about the safe");
safeReq.add(aReq);
safePlan.add(req);
Provisioner safeProvisioner = new Provisioner(context);
safeProvisioner.setDoRefresh(true);
ProvisioningProject createProj = safeProvisioner.compile(safePlan);
safeProvisioner.execute();