package com.request; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import oracle.iam.api.OIMService; import oracle.iam.exception.OIMServiceException; import oracle.iam.request.vo.Beneficiary; import oracle.iam.request.vo.RequestBeneficiaryEntity; import oracle.iam.request.vo.RequestConstants; import oracle.iam.request.vo.RequestData; import oracle.iam.vo.OperationResult; import com.connection.Platform; public class RequestRoleToUser { private final OIMService oimService =Platform.getService(OIMService.class); public OperationResult requestRole() throws OIMServiceException{ List<String> users = new ArrayList<String>(); users.add(""); String roleKey=""; RequestData requestData = new RequestData(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 2); requestData.setJustification("This is a test"); requestData.setExecutionDate(calendar.getTime()); List<Beneficiary> beneficiaries = new ArrayList<Beneficiary>(); for (String userKey : users) { Beneficiary beneficiary = new Beneficiary(); beneficiary.setBeneficiaryKey(userKey); beneficiary.setBeneficiaryType(Beneficiary.USER_BENEFICIARY); beneficiaries.add(beneficiary); beneficiary.setTargetEntities(getTargeEntities(roleKey)); } requestData.setBeneficiaries(beneficiaries); OperationResult operationResult = oimService.doOperation(requestData, OIMService.Intent.REQUEST); System.out.println("Request submitted with ID: " + operationResult.getRequestID()); return operationResult; } private static List<RequestBeneficiaryEntity> getTargeEntities(String role) { RequestBeneficiaryEntity ent1 = new RequestBeneficiaryEntity(); String entityType = "Role"; String entitySubType = role; ent1.setEntityType(entityType); ent1.setEntitySubType(entitySubType); ent1.setEntityKey(role); ent1.setOperation(RequestConstants.MODEL_ASSIGN_ROLES_OPERATION); return new ArrayList<RequestBeneficiaryEntity>(java.util.Arrays.asList(ent1)); } }
Oracle Identity Manager (OIM R2PS2/PS3/12C) is a highly flexible and scalable enterprise identity administration system that provides operational and business efficiency by providing centralized administration & complete automation of identity and user provisioning events across enterprise as well as extranet applications.
OIM API To Grant/Provision Role to User using Request API
Subscribe to:
Posts (Atom)
About OIM
Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...
Popular Posts
-
OIM API's Sample Code : Videos: Massive Gaze Videos Connection Related API's : OIM DB Connection/ Data Source connection ...
-
Videos: Massive Gaze Videos 1. Basic OIM Information 2. MDS Export/Import 3. Steps For R2PS2 / R2PS3 Custom Pre-processor Ev...
-
Videos: Massive Gaze Videos 1. Query to get OIM Provsioned/provisioning Account details 2. Query to get usr keys For Rejected / ...
No comments:
Post a Comment