Configure a Database Adaptor

Follow these steps to configure a database adaptor to make the database appear like an LDAP server. This enables the virtualized identity store provider to retrieve user profile information from a database using the database adapter.

This task shows how to edit and apply adapter templates that specify how to use your database tables as an identity store. The example given here is for the sample schema that is used throughout Configure a Database as the Authentication Provider.

When customizing the adapter_template_usergroup1.xml file, map the elements by matching the classes and attributes used in a virtual LDAP schema with the columns in your database. The virtual schema is the same as that of WebLogic Embedded LDAP, you can map database columns to any of the attributes shown in the table.

The following is the schema file example:

<?xml version = '1.0' encoding = 'UTF-8'?>
<adapters schvers="303" version="1" xmlns="http://www.octetstring.com/schemas/Adapters" xmlns:adapters="http://www.w3.org/2001/XMLSchema-instance">
   <dataBase id="directoryType" version="0">
      <root>%ROOT%</root>
      <active>true</active>
      <serverType>directoryType</serverType>
      <routing>
         <critical>true</critical>
         <priority>50</priority>
         <inclusionFilter/>
         <exclusionFilter/>
         <plugin/>
         <retrieve/>
         <store/>
         <visible>Yes</visible>
         <levels>-1</levels>
         <bind>true</bind>
         <bind-adapters/>
         <views/>
         <dnpattern/>
      </routing>
      <pluginChains xmlns="http://xmlns.oracle.com/iam/management/ovd/config/plugins">
         <plugins>
            <plugin>
               <name>DBGUID</name>
               <class>oracle.ods.virtualization.engine.chain.plugins.dbguid.DBGuidPlugin</class>
               <initParams>

					                  <param name="guidAtribute" value="orclguid"/>
               </initParams>
            </plugin>
         </plugins>
         <default>
            <plugin name="DBGUID"/>
         </default>
         <add/>
         <bind/>
         <delete/>
         <get/>
         <modify/>
         <rename/>
      </pluginChains>
      <driver>oracle.jdbc.driver.OracleDriver</driver>
      <url>%URL%</url>
      <user>%USER%</user>
      <password>%PASSWORD%</password>
      <ignoreObjectClassOnModify>false</ignoreObjectClassOnModify>
      <includeInheritedObjectClasses>true</includeInheritedObjectClasses>
      <maxConnections>10</maxConnections>
      <mapping>
         <joins/>
						<objectClass name="person" rdn="cn">
						<attribute ldap="cn" table="USER_VW" field="U_NAME" type=""/>
						<attribute ldap="uid" table="USER_VW" field="U_NAME" type=""/>
						<attribute ldap="usernameattr" table="USER_VW" field="U_NAME" type=""/>						
						<attribute ldap="loginid" table="USER_VW" field="U_NAME" type=""/>
						<attribute ldap="description" table="USER_VW" field="U_NAME" type=""/>
						<attribute ldap="orclguid" table="USER_VW" field="GUID" type=""/>
						</objectClass>
      </mapping>
      <useCaseInsensitiveSearch>true</useCaseInsensitiveSearch>
      <connectionWaitTimeout>10</connectionWaitTimeout>
      <oracleNetConnectTimeout>0</oracleNetConnectTimeout>
      <validateConnection>false</validateConnection>
   </dataBase>
</adapters>

In the <objectClass> element:

  • The name="person" and rdn="cn" values declare the mapping of the LDAP person object class.

  • The cn attribute is used as its Relative Distinguished Name (RDN).

  • The child elements declare the LDAP attributes mapping to tables and columns in the database, for example:

    The line <attribute ldap="uid" table="USER_VW" field="USER_ID" type=""/> maps the USER_ID field of the USER_VW table to the standard LDAP attribute uid, a unique user id for each user.

  • The USER_VW view should have a GUID column to match the orclguid attribute mapped to GUID column in adapter_template_usergroup1.xml, for example:

    You could CREATE or REPLACE VIEW USER_VW as the following:

    SELECT U_NAME, MAIL_ADDRESS, U_PASSWORD, U_DESCRIPTION, RPAD(U_NAME, 16, '0') AS GUID FROM USERS;
Attribute Example

description

John Doe

cn

john.doe

uid

john.doe

sn

Doe

userpassword

password

displayName

John Doe

employeeNumber

12345

employeeType

Regular

givenName

John

homePhone

650-555-1212

mail

john.doe@example.com

title

Manager

manager

uid=mary.jones,ou=people,ou=myrealm,dc=wc_domain

preferredLanguage

en

departmentNumber

tools

facsimiletelephonenumber

650-555-1200

mobile

650-500-1200

pager

650-400-1200

telephoneNumber

650-506-1212

postaladdress

200 Oracle Parkway

l

Redwood Shores

homepostaladdress

123 Main St., Anytown 12345

You map groups using the same method as you used for mapping a person. When mapping groups, in the <objectClass name="groupofuniquenames" ...> element, define the unique member for a group. The %uniquemember% value is a placeholder for a value that is passed in at runtime during the look up to determine if the user is a member of a group. The only aspect of this element you might want to change is the specification of the root for your users. The %uniquemember% value matches the root of your user population when you run the libovdadapterconfig script.

The groupofuniquenames object class specifies how group attributes are mapped to database fields and as with the user, the attributes correspond to the defaults in WebLogic Embedded LDAP. You must map the following attributes:

  • cn maps to a unique name for your group.

  • uniquemember maps to the unique name for your user in the user/group mapping table in your database schema.

  • orclguid maps to a unique id, if available in your database schema.

Mapping the description attribute is optional.

  1. Create a file named adapter_template_usergroup1.xml that maps the user table to a virtual LDAP store.
  2. In the <mapping> element, add the <objectclass> element with attributes similar to the following example:
    <mapping>
              <joins/>
    	  <objectClass name="person" rdn="cn">
    		<attribute ldap="cn" table="USER_VW" field="U_NAME" type=""/              
                  <attribute ldap="uid" table="USER_VW" field="U_NAME" type=""/>
    		<attribute ldap="usernameattr" table="USER_VW" field="U_NAME" type=""/>
    		<attribute ldap="loginid" table="USER_VW" field="U_NAME" type=""/>
    		<attribute ldap="description" table="USER_VW" field="U_NAME" type=""/>
    		<attribute ldap="orclguid" table="USER_VW" field="GUID" type=""/>
    	  </objectClass>
          </mapping>
  3. Create a file, named adapter_template_usergroup2.xml, to map the group table to a virtual LDAP store.
  4. In the <objectClass name="groupofuniquenames"> element map the group table to the virtual LDAP store, as shown in the example:
      <mapping>
             <joins/>
    						<objectClass name="groupofuniquenames" rdn="cn">
    						<attribute ldap="cn" table="GROUPMEMBERS_VW" field="G_NAME" type=""/>
                                              <attribute ldap="groupnameattr" table="GROUPMEMBERS"  field="G_NAME" type=""/>
    						<attribute ldap="description" table="GROUPMEMBERS_VW" field="G_NAME" type=""/>
    						<attribute ldap="uniquemember" table="GROUPMEMBERS_VW" field="G_MEMBER" type=""/>
    						       <attribute ldap="orclguid" table="GROUPMEMBERS_VW" field="G_MEMBER" type=""/>
    						</objectClass>
          </mapping>
  5. Copy the two adapter files into the following folder:

    ORACLE_HOME/oracle_common/modules/oracle.ovd/templates/

  6. Open a command prompt/terminal from within:

    ORACLE_HOME/oracle_common/bin

  7. Verify that the environment variables are set:
    • ORACLE_HOME=ORACLE_HOME/oraclehome

    • WL_HOME=ORACLE_HOME/wlserver

    • JAVA_HOME=ORACLE_HOME/jdk/jre

  8. Run the libovdadapterconfig script to create each of the two adapters from the template files using the syntax as follows:
    libovdadapterconfig -adapterName <name of adapter> -adapterTemplate <name (NOT including path) of template file which defines adapter> -host localhost -port <Admin Server port> -userName <user id of account which has administrative privileges in the domain> -domainPath <path to the BI domain> -dataStore DB -root <nominal specification of a pseudo-LDAP query to treat as the "root" of this adapter - must match that specified in template for adapter 2 above> -contextName default -dataSourceJNDIName <JNDI name for DataSource which points at the database being mapped>		

    For example:

    ./libovdadapterconfig.sh -adapterName userGroupAdapter1 -adapterTemplate adapter_template_usergroup1.xml -host localhost -port 9500 -userName weblogic -domainPath /opt/oracle_bi/user_projects/domains/bifoundation_domain/ -dataStore DB -root cn=users,dc=oracle,dc=com -contextName default -dataSourceJNDIName jdbc/UserGroupDS
    
    ./libovdadapterconfig.sh -adapterName userGroupAdapter2 -adapterTemplate adapter_template_usergroup2.xml -host localhost -port 9500 -userName weblogic -domainPath /opt/oracle_bi/user_projects/domains/bifoundation_domain/ -dataStore DB -root cn=users,dc=oracle,dc=com -contextName default -dataSourceJNDIName jdbc/UserGroupDS
  9. Restart WebLogic Administration Server and Managed servers.
  10. Sign in to WebLogic and Oracle WebLogic Server using credentials stored in the database.