OIM 11gR1: ContextManager returns null inside Scheduled Task
We're trying to obtain the User ID of the user that ran a Scheduled Job (i.e. clicked the "Run Now" button) from inside of the Scheduled Task code. We were under the assumption that we could get this information from ContextManager, but it seems all of the relevant fields are null when called inside of a Scheduled Task. This is from debug output from the task: ContextManager.getContextType() = ADMINContextManager.getContextSubType() = nullContextManager.getJAASUser() = nullContextManager.getOIMUser() = nullContextManager.getOrigUser() = nullContextManager.getProxyUser() = nullContextManager.getUserPreference(KEY) = nullContextManager.getUserPreference(EMAIL) = null What are we missing? Is there a different context level/parent or somewhere else we can get this info? Thanks,Wayne
check ContextManager apiimport oracle.iam.platform.context.ContextManager;ContextManager.getOIMUser() AuthenticatedSelfService asfService = Platform.getService(AuthenticatedSelfService.class);User currActor= asfService.getProfileDetails(null); http://docs.oracle.com/cd/E28280_01/doc.1111/e14309/context.htm#OMDEV829 Reference: To retrieve logged in user's details from session in OIMOIM 11g : Get the logged in user id in eventhandler ~J
Scheduled tasks always run as the user defined in the oim-config.xml file which is by default the OIMINTERNAL user. -Kevin
Hi Abhishek,Thanks for the reply. My original post describes the issues we're seeing with ContextManager (everything's null!). I tried the AuthenticatedSelfService service, but that returns the OIMINTERNAL user as the authenticated user, probably because the reference is obtained from Platform. Wayne
Hi Kevin,Thanks for the reply. I was aware of that the tasks run under the context of OIMINTERNAL, but I was hoping there was some way to get the user that actually ran the job. What's interesting is that if you look at the ORCHPROCESS table for the job ("SCHEDULE NOW" operation), the CONTEXTVAL field XML does contain the user ID of the user running the task in the "origuser" and "oimuser" properties. Was hoping to be able to get at these somehow programmatically from inside the task. Thanks,Wayne
The same use case was asked in the below post: Did you see this post?To retrieve logged in user's details from session in OIM ~J
ERROR IN PROVISIONING USER TO HOMEDRIVE USING THE WINNDOWS 2000 CONNECTOR
ORM JBOSS cluster
Is IdXML going away from OAM?
when defining access control, Unable to expand searchbase
How to use assign someone the oracleDASEditUser priv with limitations
AD to OID integration problems bootstraping.
Oracle Access Manager 10.1.4.0.1 WebPass
How to hide fields in User Form in OIM?
Problem in SPML configuration
Oracle Access Manger
Approval workflow for EBS responsibilties and AD Groups
Disable Resource in OIM
CSV file feed to OIM
Problem in object form prepopulate