Introduction to the Access SDK and API 2-41
Note that the Oracle Access Manager 11g Access SDK contains a new set of APIs that are functionally similar to the Oracle Access Manager 10g JNI SDK APIs, but with new
interfaces.
2.9.3.2 Converting Code
You can migrate application code that was implemented using Oracle Access Manager 10g JNI ASDK to achieve the same functionality in Oracle Access Manager 11g Access
SDK. This section explains how to modify existing application code to use the new API in Oracle Access Manager 11g Access SDK.
2.9.3.2.1 Initializing and Uninitializing Access SDK
In Oracle Access Manager 10g JNI SDK, the com.oblix.access.ObConfig class provides a function to perform ASDK initialization and uninitialization. In Oracle
Access Manager 11g Access SDK, the oracle.security.am.asdk.AccessClient provides this function.
As with Oracle Access Manager 10g JNI SDK, the Access Client application instance can work with a given configuration.
Depending on the requirement, you can use the AccessClient class in two different ways:
■
You can use the createDefaultInstance static function to create a single instance of the AccessClient class. Only a single default instance of this class is
permitted. Invoking this method multiple times within a single instance of the Access Client application causes an exception.
If you use the createDefaultInstance method, you must use the AccessClient class instance obtained using this method when instantiating any of
AuthenticationScheme, ResourceRequest, or UserSession classes
■
You can use the createInstance static function to create a new AccessClient class instance initialized with a given configuration. This class is required when it
is within the same running instance of an Access Client application, and the
Class Summary:
■
ObAuthenticationScheme
■
ObConfig
■
ObDiagnostic
■
ObResourceRequest
■
ObUserSession
Class Summary:
■
AuthenticationScheme
■
AccessClient
■
Supported through AccessClient
■
ResourceRequest
■
UserSession
■
PseudoUserSession
■
BaseUserSession
Exception Summary:
ObAccessException
Exception Summary:
■
AccessException
■
OperationNotPermittedException
Enumeration Summary:
None
Enumeration Summary:
AccessClient.CompatibilityMode.OAM_10G
Table 2–6 Cont. Differences Between JNI ASDK com.oblix.access Package and Access
SDK oracle.security.am.asdk Package JNI ASDK com.oblix.access Package
Access SDK oracle.security.am.asdk Package
2-42 Developers Guide for Oracle Access Manager and Oracle Security Token Service
application must work with different Oracle Access Manager systems or different configurations. Each AccessClient class instance can log its messages to
different log files by passing in an appropriate logger name while constructing the Access Client instances.
You must pass AccessClient.CompatibilityMode.OAM_10G in compatibility mode when initializing AccessClient objects.
If you use the createInstance method, you must use the AccessClient class instance obtained using this method when instantiating the
AuthenticationScheme, ResourceRequest, or UserSession classes.
While the application is shutting down, it should invoke the AccessClient class shutdown method to perform uninitialization as shown in the following examples:
■
For Oracle Access Manager 10g JNI ASDK
Public static void main String args[] { try {
ObConfig.Initialize ; Configuration is read from the location pointed by OBACCESS_INSTALL_DIR
environment variable
OR
ObConfig.Initialize configLocation; Configuration is read from the location provided
……….. }catch ObAccessException e{
} ObConfig.shutdown;
}main ends here
■
For Oracle Access Manager 11g Access SDK
import java.io.; import java.util.;
import oracle.security.am.asdk.; Import classes from OAM11g Access ASDK …………..
Public static void main String args[] { try {
ac = AccessClient.createDefaultInstance “”, AccessClient.CompatibilityMode.OAM_10G; Refer to Oracle Access Manager
Access SDK Java API Reference
OR
AccessClient.createInstance“”,AccessClient.CompatibilityMode.OAM_10G; Refer to Oracle Access Manager Access SDK Java API Reference
……….. }catch AccessException e{
} ac.shutdown;
}main ends here
2.9.3.2.2 Performing Access Operations
As shown in Table 2–6
, there is a one-to-one mapping between the classes that are used to perform access operations. The classes in oracle.security.am.asdk are
AuthenticationScheme, ResourceRequest, and UserSession.