Package com.netscape.cms.publish.mappers
Class LdapDNCompsMap
- java.lang.Object
-
- 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$, $Date$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LdapDNCompsMap.SearchFilter
class for forming search filters for ldap searching from name=value components.
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
logger
protected java.lang.String
mBaseDN
protected IConfigStore
mConfig
protected org.mozilla.jss.netscape.security.util.ObjectIdentifier[]
mDnComps
protected org.mozilla.jss.netscape.security.util.ObjectIdentifier[]
mFilterComps
-
Fields inherited from interface com.netscape.certsrv.base.IExtendedPluginInfo
HELP_TEXT, HELP_TOKEN
-
-
Constructor Summary
Constructors Constructor Description LdapDNCompsMap()
constructor if initializing from config store.LdapDNCompsMap(java.lang.String ldapAttr, java.lang.String baseDN, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] dnComps, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] filterComps)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
formDNandFilter(org.mozilla.jss.netscape.security.x509.X500Name subjName)
form a dn and filter from component in the cert subject namestatic org.mozilla.jss.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<java.lang.String>
getDefaultParams()
java.lang.String
getDescription()
org.mozilla.jss.netscape.security.util.ObjectIdentifier[]
getDnComps()
java.lang.String[]
getExtendedPluginInfo(java.util.Locale locale)
This method returns an array of strings.org.mozilla.jss.netscape.security.util.ObjectIdentifier[]
getFilterComps()
java.lang.String
getImplName()
java.util.Vector<java.lang.String>
getInstanceParams()
void
init(IConfigStore config)
for initializing from config store.protected void
init(java.lang.String baseDN, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] dnComps, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] filterComps)
common initialization routine.java.lang.String
map(netscape.ldap.LDAPConnection conn, org.mozilla.jss.netscape.security.x509.X500Name x500name, byte[] obj)
Maps a X500 subject name to LDAP entry.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
mBaseDN
protected java.lang.String mBaseDN
-
mDnComps
protected org.mozilla.jss.netscape.security.util.ObjectIdentifier[] mDnComps
-
mFilterComps
protected org.mozilla.jss.netscape.security.util.ObjectIdentifier[] mFilterComps
-
mConfig
protected IConfigStore mConfig
-
-
Constructor Detail
-
LdapDNCompsMap
public LdapDNCompsMap(java.lang.String ldapAttr, java.lang.String baseDN, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] dnComps, org.mozilla.jss.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 interfaceILdapPlugin
-
init
public void init(IConfigStore config) throws EBaseException
for initializing from config store.- Specified by:
init
in interfaceILdapPlugin
- Parameters:
config
- the configuration store to initialize from.- Throws:
com.netscape.certsrv.ldap.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 interfaceIExtendedPluginInfo
-
getDefaultParams
public java.util.Vector<java.lang.String> getDefaultParams()
-
getInstanceParams
public java.util.Vector<java.lang.String> getInstanceParams()
-
init
protected void init(java.lang.String baseDN, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] dnComps, org.mozilla.jss.netscape.security.util.ObjectIdentifier[] filterComps)
common initialization routine.
-
map
public java.lang.String map(netscape.ldap.LDAPConnection conn, org.mozilla.jss.netscape.security.x509.X500Name x500name, byte[] obj) throws com.netscape.certsrv.ldap.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:
com.netscape.certsrv.ldap.ELdapException
- if any LDAP exceptions occured.
-
formDNandFilter
public java.lang.String[] formDNandFilter(org.mozilla.jss.netscape.security.x509.X500Name subjName) throws com.netscape.certsrv.ldap.ELdapException
form a dn and filter from component in the cert subject name- Parameters:
subjName
- subject name- Throws:
com.netscape.certsrv.ldap.ELdapException
-
getDnComps
public org.mozilla.jss.netscape.security.util.ObjectIdentifier[] getDnComps()
-
getFilterComps
public org.mozilla.jss.netscape.security.util.ObjectIdentifier[] getFilterComps()
-
getCompsFromString
public static org.mozilla.jss.netscape.security.util.ObjectIdentifier[] getCompsFromString(java.lang.String val) throws com.netscape.certsrv.ldap.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:
com.netscape.certsrv.ldap.ELdapException
- if any error occurs.
-
-