Version 4.9 and Above
With the LDAP authentication mechanism, users (and passwords) and roles (or groups) are loaded from an Active Directory or LDAP domain.
Encrypting Credentials in the Configuration
To encode credentials defined in dvserver-standalone.xml, do the following:
1. Encrypt the password via a CLI command:
CALL SYSADMIN.executeCli(script => '/subsystem=elytron/expression=encryption:create-expression(resolver=dv-encryption-resolver, clear-text=Password123)', "maskInLogs" => true) ;;
The output will be like the following:
{
"outcome" => "success",
"result" => {"expression" => "${ENC::dv-encryption-resolver:RUxZAUMQ42XclErCI4BDa6nzzp/r/aqx31Cu/aNwUjvCgr5Tofw=}"}
}
2. Copy the expression value to use in the configuration file like this:
<dir-contexts>
<dir-context name="ldap-connection" principal="CN=Administrator,CN=Users,DC=mydomain,DC=local" url="ldap://192.168.222.102/">
<credential-reference clear-text="${ENC::dv-encryption-resolver:RUxZAUMQ42XclErCI4BDa6nzzp/r/aqx31Cu/aNwUjvCgr5Tofw=}"/>
</dir-context>
</dir-contexts>
Configuration
To configure LDAP authentication, please modify dvserver-standalone.xml as follows:
1. Replace the following code:
<custom-realm class-name="com.datavirtuality.dv.core.teiid.users.DVLoginModule" module="com.datavirtuality.dv" name="DataVirtualityRealm"/>
To search for this line, use "custom-realm" as your search term as the actual order of elements may differ.
with a snippet like this:
<ldap-realm dir-context="ldap-connection" direct-verification="true" name="DataVirtualityRealm">
<identity-mapping rdn-identifier="cn" search-base-dn="DC=mydomain,DC=local" use-recursive-search="true">
<attribute-mapping>
<attribute filter="(member={1})" filter-base-dn="OU=Users,DC=mydomain,DC=local" from="cn" to="Roles"/>
</attribute-mapping>
</identity-mapping>
</ldap-realm>
Filter-based authentication can be set up as follows
<ldap-realm dir-context="ldap-connection" direct-verification="true" name="DataVirtualityRealm">
<identity-mapping filter-name="(userPrincipalName={0}@mydomain.local)" rdn-identifier="userPrincipalName" use-recursive-search="true" search-base-dn="DC=mydomain,DC=local">
<attribute-mapping>
<attribute filter="(member={1})" filter-base-dn="OU=Users,DC=mydomain,DC=local" from="cn" to="Roles"/>
</attribute-mapping>
</identity-mapping>
</ldap-realm>
Adapt the values in the above fragment to the settings of your environment.
2. Find the </expression-resolver> tag and paste the following code, first replacing the required parts with your values:
<dir-contexts>
<dir-context name="ldap-connection" principal="CN=Administrator,CN=Users,DC=mydomain,DC=local" url="ldap://192.168.0.68/">
<credential-reference clear-text="Password123"/>
</dir-context>
</dir-contexts>
3. Find the </policy-decider-module> tag and insert the following code below:
<ldap>
<property name="defaultAdminGroup" value="super-group"/>
<property name="displayUserName" value="cn"/>
<property name="roleRecursion" value="5"/>
</ldap>
Other properties supported by DVLdapExtContext
and DVLdapContext
can be added in this section.
For example, to set a conditional rule for displaying user names in the system, you can configure the following property:
<property name="displayUserName" value="has('userPrincipalName') ? stripDomain(userPrincipalName) : distinguishedName"/>