How the API Uses Properties

Integrating Native .NET Applications 3-3

3.3.2 Encrypting Property Values

A property value specified in a properties file can be encrypted using the command-line utility BharosaUtils.exe included in the Oracle Adaptive Access Manager .NET SDK. An encryption key arbitrarily selected by the user is required to encrypt and decrypt values. This key is available to Oracle Adaptive Access Manager .NET API through the property bharosa.cipher.client.key, which must be set in one of the application properties files. BharosaUtil.exe prompts the user to enter the encryption key and a value, and the encrypted value is output to the console. The following run of the utility illustrates how to encrypt a string: C:\ BharosaUtil.exe -enc Enter key min 14 characters len: your key Enter key again: your key Enter text to be encrypted: string to encryp Enter text to be encrypted again: string to encryp vCCKC19d14a39hQSKSirXSiWfgbaVG5SKIg==

3.3.3 Using User-Defined Enumerations to Define Elements

Visual Studio 2005 allows you to use enumerations defined in the .NET Framework. A user-defined enumerations are a collection of items; each item is assigned an integer and may contain several attributes. A user-defined enumeration is specified in a properties file, and its name, the names of its items, and the name of the item attributes must conform to the following rules: ■ The name of the enumeration has the suffix .enum ■ The name of an item has a prefix equals to the name of the enumeration ■ The name of an attribute of an item has a prefix equals to the name of the item Here is an example of a user-defined enumeration: Example of a user-defined enumeration auth.status.enum=Enumeration to describe authentication status first item and its attributes auth.status.enum.success=0 auth.status.enum.success.name=Success auth.status.enum.success.description=Success auth.status.enum.success.success=true second item and its attributes CurrentDirectory c:WindowsSystem32 ApplicationDirectorybharosa_properties c:InetpubwwwrootMyAppbharosa_properties CallingAssemblyDirectorybharosa_properties c:WindowsSystem32bharosa_properties CurrentAssemblyDirectorybharosa_properties c:InetpubwwwrootMyAppbinbharosa_properties CurrentAssemblyDirectory..bharosa_ properties c:InetpubwwwrootMyAppbharosa_properties CurrentDirectorybharosa_properties c:WindowsSystem32bharosa_properties Table 3–1 Cont. .NET Property Files Directory Example 3-4 Oracle Fusion Middleware Developers Guide for Oracle Adaptive Access Manager auth.status.enum.invalid_user=1 auth.status.enum.invalid_user.name=Invalid user auth.status.enum.invalid_user.description=Invalid User third item and its attributes auth.status.enum.wrong_password=2 auth.status.enum.wrong_password.name=Wrong password auth.status.enum.wrong_password.description=Wrong password fourth item and its attributes auth.status.enum.wrong_pin=3 auth.status.enum.wrong_pin.name=Wrong pin auth.status.enum.wrong_pin.description=Wrong Pin fifth item and its attributes auth.status.enum.session_expired=4 auth.status.enum.session_expired.name=Session expired auth.status.enum.session_expired.description=Session expired Here is an example of the use of the previous user-defined enumeration in application code: UserDefEnumFactory factory = UserDefEnumFactory.getInstance; UserDefEnum statusEnum = factory.getEnumauth.status.enum; int statusSuccess = statusEnum.getElementValuesuccess; int statusWrongPassword = statusEnum.getElementValuewrong_password;

3.4 Oracle Adaptive Access Manager API Usage

This section contains details on how OAAM APIs are used to support common OAAM scenarios. You can also refer to the sample applications for details.

3.4.1 User Details

Oracle Adaptive Access Manager stores user details in its database and uses this information to perform the following tasks: ■ Determine the risk rules to run for a user ■ Find user-specific virtual authentication device attributes ■ Propose challenge questions ■ Validate answers to challenge questions The client application is responsible for populating the Oracle Adaptive Access Manager database with user details at runtime. For example, when a user logs in, the client application should first determine whether the user record exists. If the record is not found, then the application should call the appropriate APIs to create a user record and set the user status. The following sample illustrates the calls to create a user record: string loginId = testuser; loginId of the user logging in set the proxy to access the SOAP server that communicates with the OAAM SOAP Server IBharosaProxy proxy = BharosaClientFactory.getProxyInstance; find the user record in OAAM VCryptAuthUser user = proxy.getUserByLoginIdloginId;