com.netscape.cms.publish.mappers
Class LdapDNCompsMap

java.lang.Object
  extended by com.netscape.cms.publish.mappers.LdapDNCompsMap
All Implemented Interfaces:
IExtendedPluginInfo, ILdapPlugin
Direct Known Subclasses:
LdapCertCompsMap, LdapCrlIssuerCompsMap

public class LdapDNCompsMap
extends java.lang.Object
implements ILdapPlugin, IExtendedPluginInfo

Maps a Subject name to an entry in the LDAP server. subject name to form the ldap search dn and filter. Takes a optional root search dn. The DN comps are used to form a LDAP entry to begin a subtree search. The filter comps are used to form a search filter for the subtree. If none of the DN comps matched, baseDN is used for the subtree. If the baseDN is null and none of the DN comps matched, it is an error. If none of the DN comps and filter comps matched, it is an error. If just the filter comps is null, a base search is performed.

Version:
$Revision: 1211 $, $Date: 2010-08-18 10:15:37 -0700 (Wed, 18 Aug 2010) $

Nested Class Summary
static class LdapDNCompsMap.SearchFilter
          class for forming search filters for ldap searching from name=value components.
 
Field Summary
protected  java.lang.String mBaseDN
           
protected  IConfigStore mConfig
           
protected  netscape.security.util.ObjectIdentifier[] mDnComps
           
protected  netscape.security.util.ObjectIdentifier[] mFilterComps
           
 
Fields inherited from interface com.netscape.certsrv.base.IExtendedPluginInfo
HELP_TEXT, HELP_TOKEN
 
Constructor Summary
LdapDNCompsMap()
          constructor if initializing from config store.
LdapDNCompsMap(java.lang.String ldapAttr, java.lang.String baseDN, netscape.security.util.ObjectIdentifier[] dnComps, netscape.security.util.ObjectIdentifier[] filterComps)
          Constructor.
 
Method Summary
 java.lang.String[] formDNandFilter(netscape.security.x509.X500Name subjName)
          form a dn and filter from component in the cert subject name
static netscape.security.util.ObjectIdentifier[] getCompsFromString(java.lang.String val)
          useful routine for parsing components given as string to arrays of objectidentifiers.
 IConfigStore getConfigStore()
          Return config store.
 java.util.Vector getDefaultParams()
           
 java.lang.String getDescription()
           
 netscape.security.util.ObjectIdentifier[] getDnComps()
           
 java.lang.String[] getExtendedPluginInfo(java.util.Locale locale)
          This method returns an array of strings.
 netscape.security.util.ObjectIdentifier[] getFilterComps()
           
 java.lang.String getImplName()
           
 java.util.Vector getInstanceParams()
           
 void init(IConfigStore config)
          for initializing from config store.
protected  void init(java.lang.String baseDN, netscape.security.util.ObjectIdentifier[] dnComps, netscape.security.util.ObjectIdentifier[] filterComps)
          common initialization routine.
 java.lang.String map(netscape.ldap.LDAPConnection conn, netscape.security.x509.X500Name x500name, byte[] obj)
          Maps a X500 subject name to LDAP entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mBaseDN

protected java.lang.String mBaseDN

mDnComps

protected netscape.security.util.ObjectIdentifier[] mDnComps

mFilterComps

protected netscape.security.util.ObjectIdentifier[] mFilterComps

mConfig

protected IConfigStore mConfig
Constructor Detail

LdapDNCompsMap

public LdapDNCompsMap(java.lang.String ldapAttr,
                      java.lang.String baseDN,
                      netscape.security.util.ObjectIdentifier[] dnComps,
                      netscape.security.util.ObjectIdentifier[] filterComps)
Constructor. The DN comps are used to form a LDAP entry to begin a subtree search. The filter comps are used to form a search filter for the subtree. If none of the DN comps matched, baseDN is used for the subtree. If the baseDN is null and none of the DN comps matched, it is an error. If none of the DN comps and filter comps matched, it is an error. If just the filter comps is null, a base search is performed.

Parameters:
baseDN - The base DN.
dnComps - Components to form the LDAP base dn for search.
filterComps - Components to form the LDAP search filter.

LdapDNCompsMap

public LdapDNCompsMap()
constructor if initializing from config store.

Method Detail

getConfigStore

public IConfigStore getConfigStore()
Description copied from interface: ILdapPlugin
Return config store.

Specified by:
getConfigStore in interface ILdapPlugin

init

public void init(IConfigStore config)
          throws EBaseException
for initializing from config store.

Specified by:
init in interface ILdapPlugin
Parameters:
config - the configuration store to initialize from.
Throws:
ELdapException - initialization failed due to Ldap error.
EBaseException - initialization failed.

getImplName

public java.lang.String getImplName()

getDescription

public java.lang.String getDescription()

getExtendedPluginInfo

public java.lang.String[] getExtendedPluginInfo(java.util.Locale locale)
Description copied from interface: IExtendedPluginInfo
This method returns an array of strings. Each element of the array represents a configurable parameter, or some other meta-info (such as help-token) there is an entry indexed on that parameter name ;[,required];;... Where: type_info is either 'string', 'number', 'boolean', 'password' or 'choice(ch1,ch2,ch3,...)' If the marker 'required' is included after the type_info, the parameter will has some visually distinctive marking in the UI. 'description' is a short sentence describing the parameter 'choice' is rendered as a drop-down list. The first parameter in the list will be activated by default 'boolean' is rendered as a checkbox. The resulting parameter will be either 'true' or 'false' 'string' allows any characters 'number' allows only numbers 'password' is rendered as a password field (the characters are replaced with *'s when being types. This parameter is not passed through to the plugin. It is instead inserted directly into the password cache keyed on the instance name. The value of the parameter 'bindPWPrompt' (see example below) is set to the key. In addition to the configurable parameters, the following magic parameters may be defined: HELP_TOKEN;helptoken - a pointer to the online manual section for this plugin HELP_TEXT;helptext - a general help string describing the plugin For example: "username;string;The username you wish to login as" "bindPWPrompt;password;Enter password to bind as above user with" "algorithm;choice(RSA,DSA);Which algorithm do you want to use" "enable;boolean;Do you want to run this plugin" "port;number;Which port number do you want to use"

Specified by:
getExtendedPluginInfo in interface IExtendedPluginInfo

getDefaultParams

public java.util.Vector getDefaultParams()

getInstanceParams

public java.util.Vector getInstanceParams()

init

protected void init(java.lang.String baseDN,
                    netscape.security.util.ObjectIdentifier[] dnComps,
                    netscape.security.util.ObjectIdentifier[] filterComps)
common initialization routine.


map

public java.lang.String map(netscape.ldap.LDAPConnection conn,
                            netscape.security.x509.X500Name x500name,
                            byte[] obj)
                     throws ELdapException
Maps a X500 subject name to LDAP entry. Uses DN components and filter components to form a DN and filter for a LDAP search. If the formed DN is null the baseDN will be used. If the formed DN is null and baseDN is null an error is thrown. If the filter is null a base search is performed. If both are null an error is thrown.

Parameters:
conn - the LDAP connection.
x500name - the dn to map.
obj - the object
Returns:
the DN of the entry.
Throws:
ELdapException - if any LDAP exceptions occured.

formDNandFilter

public java.lang.String[] formDNandFilter(netscape.security.x509.X500Name subjName)
                                   throws ELdapException
form a dn and filter from component in the cert subject name

Parameters:
subjName - subject name
Throws:
ELdapException

getDnComps

public netscape.security.util.ObjectIdentifier[] getDnComps()

getFilterComps

public netscape.security.util.ObjectIdentifier[] getFilterComps()

getCompsFromString

public static netscape.security.util.ObjectIdentifier[] getCompsFromString(java.lang.String val)
                                                                    throws ELdapException
useful routine for parsing components given as string to arrays of objectidentifiers. The string is expected to be comma separated AVA attribute names. For example, "uid,cn,o,ou". Attribute names are case insensitive.

Parameters:
val - the string specifying the comps
Throws:
ELdapException - if any error occurs.