Challenge Use Case Oracle Fusion Middleware Online Documentation Library

12-2 Oracle Fusion Middleware Developers Guide for Oracle Adaptive Access Manager 4. Compile the java class and create a jar file of the compiled class files. 5. Extendcustomize Oracle Adaptive Access Manager to add the custom jar. Refer to Section 4.1.3, CustomizingExtendingOverriding Oracle Adaptive Access Manager Properties for steps for adding the custom jar to Oracle Adaptive Access Manager. 6. Restart OAAM Server and the OAAM Admin Server. 7. Log in to OAAM Admin and create an action definition entry for the newly deployed Configurable Action. 8. Make sure all the parameters required for the Configurable Action are displayed in the user interface. 9. Use the newly available Configurable Action by adding it to the required checkpoints. For more information on configuring Configurable Actions, refer to the Oracle Fusion Middleware Administrators Guide for Oracle Adaptive Access Manager.

12.2 Executing Configurable Actions in a Particular Order and Data Sharing

Configurable Actions can be used to implement chaining in such a way that ■ they execute in a particular order ■ data can be shared across these actions To be able to execute Configurable Actions in a particular order and share data: 1. Configure Configurable Actions as synchronous actions with the required order of execution in ascending order. 2. To share data, insert the data into the actionContextMap parameter of the Configurable Actions execute method. Since the actionContextMap is a Map, it requires a key and value pair that represents the data to be shared.

3. Ensure that the code can handle the case where the key is not present in the

actionContextMap. This step must be performed to avoid errors or NullPointerException when the other action do not insert the value into the actionContextMap. Note: Sharing data across Configurable Actions involves writing java code and requires more effort than just a configuration task. Note: A Configurable Action is executed only if the trigger criteria is met; therefore, make sure the trigger criteria is correct. Note: it is the implementers responsibility to ensure that ■ the duplicate keys are not used while inserting data ■ the same key is used when trying to access this shared data from another Configurable Action. Configurable Actions 12-3

12.3 How to Test Configurable Actions Triggering

To test if configurable actions triggering: 1. Make sure there is a way to identify if the code in the Configurable Action is executed. This could be as simple as an entry in log file or an entry in database. 2. Enable debug level logging for oracle.oaam logger in OAAM Server. 3. Create an action template for the given Configurable Action. 4. Add the action to a Pre-Authentication checkpoint with trigger criteria as score between 0 and 1000. 5. Try logging in to OAAM Server as a user. 6. Check OAAM Server logs for the entry Enter: executeAction: Executing Action Instance. 7. If there is no error then you will see a related log statement like Exit: executeAction: Action Instance. 8. If there is an error, you will see a log statement like Error: executeAction. 9. Apart from these, check for a log entry or a database entry that is created by the Configurable Action itself

12.4 Sample JUnit Code

The following is an sample JUnit code for testing dynamic action: public class TestDynamicActionsExecution extends TestCase { static Logger logger = Logger.getLoggerTestDynamicActionsExecution.class; private DynamicAction caseCreationAction = null; public void setUpthrows Exception { caseCreationAction = new CaseCreationAction; } public void testDynamicAction { RequestId String requestId = testRequest; Request Time Date requestTime = new Date; Map that contains values passed to the rulemodel execution Map ruleContextMap = new HashMap; Result from rule execution VCryptRulesResultImpl rulesResult = new VCryptRulesResultImpl; rulesResult.setResultAllow; rulesResult.setRuntimeTypenew Integer1; Configurable actions parameter values Map actionParamValueMap = new HashMap; RuntimeActionParamValue caseTypeParamValue = new RuntimeActionParamValue; caseTypeParamValue.setIntValueCaseConstants.CASE_AGENT_TYPE; 12-4 Oracle Fusion Middleware Developers Guide for Oracle Adaptive Access Manager RuntimeActionParamValue caseSeverityParamValue = new RuntimeActionParamValue; caseSeverityParamValue.setIntValue1; RuntimeActionParamValue caseDescriptionParamValue = new RuntimeActionParamValue; caseDescriptionParamValue.setStringValueTesting CaseCreation Action; ActionContext Map for passing data tofrom the dynamic action execution Map actionContextMap = new HashMap; Execute the action try { caseCreationAction.executerequestId, requestTime, ruleContextMap, rulesResult, actionParamValueMap, actionContextMap; }catchException e { Assert.failException occurred while executing dynamic action; logger.errorException occcurred while executing dynamic action, e; } Write appropriate asserts to check if the configurable action has executed properly } public void tearDown throws Exception { } }