- package com.oimacademy.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.oimacademy.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) is the Provisioning Solution from oracle. This page contains an index with references to all OIM related posts in the oracle identity manager Academy blog. The posts included herein are intended to provide oracle identity management customers and developers with technical information about best practices for implementing OIM based solutions.
OIM API To Grant/Provision Role to User using Request API
Subscribe to:
Post Comments (Atom)
-
Connection Related API's : OIM DB Connection/ Data Source connection OIMClient API / OIMConnection API OIM Platform API to getSer...
-
Error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframewor...
-
In this post, we set the middle name as “MiddleName” if user does not provide middle name during user create operation. Below are high...
No comments:
Post a Comment