- package com.oimacademy.role;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.GregorianCalendar;
- import java.util.HashMap;
- import com.oimacademy.orgs.CreateOrganizations;
- import com.oimacademy.users.CreateUsers;
- import oracle.iam.identity.exception.ValidationFailedException;
- import oracle.iam.identity.rolemgmt.api.RoleManager;
- import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
- import oracle.iam.platform.Platform;
- public class GrantRoleWithDate {
- public static void main(String[] args) throws NumberFormatException, Exception {
- //local variables
- Date currentDate = new Date();
- String str_Date = "";
- SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
- Calendar cal = new GregorianCalendar();
- str_Date = formatter.format(cal.getTime());
- Date endDate = (Date) formatter.parse(str_Date);
- System.out.println("EndDate::::::" + endDate);
- //Create requester and role.
- String userKey=CreateUsers.createUsers(Long.parseLong(CreateOrganizations.createorg()));
- String roleKey = CreateRoles.createRole();
- try
- {
- //Login as requester and initiate role request;
- HashMap<String, Object> roleDataMap = new HashMap<String,Object>();
- RoleManager roleManagerService_1=Platform.getService(RoleManager.class);
- roleDataMap.put(RoleManagerConstants.TEMPORAL_END_DATE, endDate);
- String requestID = roleManagerService_1.grantRoleRequest( "RoleKey", roleKey, "usr_key", userKey, roleDataMap);
- System.out.println( "Requst ID should not be Generated ");
- }
- catch(ValidationFailedException e)
- {
- System.out.println( "End Date cannot be set to prior to the Current Date:::" + e.getErrorMessage());
- }
- }
- }
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 Create User,Role and Grant Role with Date
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