29 Understanding Context

A context is the environment in which an Oracle Identity Manager operation is performed. For example, a user creation operation performed on the Oracle Identity Self Service is carried out in the Web context. The following information constitutes the context or environment in which this operation is performed:

  • User performing the operation

  • Date and time at which the request is submitted

  • Proxy that is used to reach the application server

For example, if the user is created by running the bulk load utility, the context includes the user who started the bulk load utility, the computer from which the operation is being performed, and so on.

A context is maintained in main-memory. It consists of a set of context variables where each context variable has both a name and value. Each functional component involved in an operation, such as request management, reconciliation, or notification, can add values to the context. Context values can only be set, they cannot be modified. The context values act as a means of communication across components involved in an operation.

Context variable values are loaded into memory only when they are required. This enhances performance. A context also acts as a cache of the typical values required by event handlers. This helps reduce the need to fetch values from the repository each time the values are required.

29.1 Child Context

A child context is a subcontext that is initiated while an operation is in progress. For example, if user creation operation involves provisioning of resource through access policies, resource provisioning runs in the access policy context, which is the child context of the one in which user is being created. This means that contexts can be nested, and there can be a stack of contexts. New contexts can be created by functional components, and further processing starts using the newly created context.

29.2 Context Types

Context Manager supports the following context types:

  • SELF: Operation is initiated through Oracle Identity Self Service.

  • ADMIN: Operation is initiated through Oracle Identity System Administration. This is the default context.

  • RECON: Operation is performed by reconciliation.

  • REQUEST: Operation is performed by a request.

  • POLICY: Operation is performed because of access policy.

Calling ContextManager.getContextType() should tell the type of context. Some of the information that you can retrieve under various contexts are:

  • Reconciliation context: The profile from which the reconciliation event has been created can be retrieved by ContextManager.getValue("profileName") method call.

  • Scheduled tasks run in ADMIN context: Some of the information that can be retrieved are:

    • Job name: ContextManager.getValue("JOBNAME")

    • Task name: ContextManager.getValue("TASKNAME")

  • Request context: You can retrieve the request key by using the following code:

    HashMap<String, ContextAware> requestContext = (HashMap<String, ContextAware>) ContextManager.getValue("requestData", true);
  • Policy context: ContextManager.getContextKey() provides the policy that is evaluated. If multiple policies are applicable, then this returns the highest priority policy key.