com.xpn.xwiki.plugin.ldap
Class XWikiLDAPConfig

java.lang.Object
  extended by com.xpn.xwiki.plugin.ldap.XWikiLDAPConfig

public final class XWikiLDAPConfig
extends Object

Access to LDAP configurations.

Version:
$Id: aae997ef003f611a2d1426964a0d4fc7218b2994 $

Field Summary
static String CFG_LDAP_PORT
          LDAP port property name in xwiki.cfg.
static String CFG_LDAP_SUFFIX
          LDAP properties names suffix in xwiki.cfg.
static Set<String> DEFAULT_GROUP_CLASSES
          Different LDAP implementations groups classes name.
static Set<String> DEFAULT_GROUP_MEMBERFIELDS
          Different LDAP implementations groups member property name.
static String DEFAULT_SEPARATOR
          Mapping fields separator.
static String PREF_LDAP_PORT
          LDAP port property name in XWikiPreferences.
static String PREF_LDAP_SUFFIX
          LDAP properties names suffix in XWikiPreferences.
static String PREF_LDAP_UID
          LDAP port property name in XWikiPreferences.
static String USERMAPPING_SEP
          Mapping fields separator.
static String USERMAPPING_XWIKI_LDAP_LINK
          Character user to link XWiki field name and LDAP field name in user mappings property.
 
Method Summary
 int getCacheExpiration(XWikiContext context)
           
 Collection<String> getGroupClasses(XWikiContext context)
           
 Map<String,Set<String>> getGroupMappings(XWikiContext context)
          Get mapping between XWiki groups names and LDAP groups names.
 Collection<String> getGroupMemberFields(XWikiContext context)
           
static XWikiLDAPConfig getInstance()
           
 String getLDAPBindDN(String login, String password, XWikiContext context)
           
 String getLDAPBindDN(XWikiContext context)
           
 String getLDAPBindPassword(String login, String password, XWikiContext context)
           
 String getLDAPBindPassword(XWikiContext context)
           
 String getLDAPParam(String prefName, String cfgName, String def, XWikiContext context)
          First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.
 String getLDAPParam(String name, String def, XWikiContext context)
          First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.
 long getLDAPParamAsLong(String name, long def, XWikiContext context)
          First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.
 int getLDAPPort(XWikiContext context)
          Get LDAP port from configuration.
 int getLDAPTimeout(XWikiContext context)
           
 Provider getSecureProvider(XWikiContext context)
           
 Map<String,String> getUserMappings(List<String> attrListToFill, XWikiContext context)
          Get mapping between XWiki users attributes and LDAP users attributes.
 boolean isLDAPEnabled(XWikiContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final String DEFAULT_SEPARATOR
Mapping fields separator.

See Also:
Constant Field Values

CFG_LDAP_SUFFIX

public static final String CFG_LDAP_SUFFIX
LDAP properties names suffix in xwiki.cfg.

See Also:
Constant Field Values

CFG_LDAP_PORT

public static final String CFG_LDAP_PORT
LDAP port property name in xwiki.cfg.

See Also:
Constant Field Values

PREF_LDAP_SUFFIX

public static final String PREF_LDAP_SUFFIX
LDAP properties names suffix in XWikiPreferences.

See Also:
Constant Field Values

PREF_LDAP_PORT

public static final String PREF_LDAP_PORT
LDAP port property name in XWikiPreferences.

See Also:
Constant Field Values

PREF_LDAP_UID

public static final String PREF_LDAP_UID
LDAP port property name in XWikiPreferences.

See Also:
Constant Field Values

USERMAPPING_SEP

public static final String USERMAPPING_SEP
Mapping fields separator.

See Also:
Constant Field Values

USERMAPPING_XWIKI_LDAP_LINK

public static final String USERMAPPING_XWIKI_LDAP_LINK
Character user to link XWiki field name and LDAP field name in user mappings property.

See Also:
Constant Field Values

DEFAULT_GROUP_CLASSES

public static final Set<String> DEFAULT_GROUP_CLASSES
Different LDAP implementations groups classes name.

Since:
1.5M1

DEFAULT_GROUP_MEMBERFIELDS

public static final Set<String> DEFAULT_GROUP_MEMBERFIELDS
Different LDAP implementations groups member property name.

Since:
1.5M1
Method Detail

getInstance

public static XWikiLDAPConfig getInstance()
Returns:
unique instance of XWikiLDAPConfig.

getLDAPParam

public String getLDAPParam(String prefName,
                           String cfgName,
                           String def,
                           XWikiContext context)
First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.

Parameters:
prefName - the name of the property in XWikiPreferences.
cfgName - the name of the property in xwiki.cfg.
def - default value.
context - the XWiki context.
Returns:
the value of the property.

getLDAPParam

public String getLDAPParam(String name,
                           String def,
                           XWikiContext context)
First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.

Parameters:
name - the name of the property in XWikiPreferences.
def - default value.
context - the XWiki context.
Returns:
the value of the property.

getLDAPParamAsLong

public long getLDAPParamAsLong(String name,
                               long def,
                               XWikiContext context)
First try to retrieve value from XWiki Preferences and then from xwiki.cfg Syntax ldap_*name* (for XWiki Preferences) will be changed to ldap.*name* for xwiki.cfg.

Parameters:
name - the name of the property in XWikiPreferences.
def - default value.
context - the XWiki context.
Returns:
the value of the property.

getGroupClasses

public Collection<String> getGroupClasses(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the of the LDAP groups classes.
Since:
1.5M1

getGroupMemberFields

public Collection<String> getGroupMemberFields(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the names of the fields for members of groups.
Since:
1.5M1

getSecureProvider

public Provider getSecureProvider(XWikiContext context)
                           throws XWikiLDAPException
Parameters:
context - the XWiki context.
Returns:
the secure provider to use for SSL.
Throws:
XWikiLDAPException - error when trying to instantiate secure provider.
Since:
1.5M1

isLDAPEnabled

public boolean isLDAPEnabled(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
true if LDAP is enabled.

getLDAPPort

public int getLDAPPort(XWikiContext context)
Get LDAP port from configuration.

Parameters:
context - the XWiki context.
Returns:
the LDAP port.

getGroupMappings

public Map<String,Set<String>> getGroupMappings(XWikiContext context)
Get mapping between XWiki groups names and LDAP groups names.

Parameters:
context - the XWiki context.
Returns:
the mapping between XWiki users and LDAP users. The key is the XWiki group, and the value is the list of mapped LDAP groups.

getUserMappings

public Map<String,String> getUserMappings(List<String> attrListToFill,
                                          XWikiContext context)
Get mapping between XWiki users attributes and LDAP users attributes. The key in the Map is lower cased to easily support any case.

Parameters:
attrListToFill - the list to fill with extracted LDAP fields to use in LDAP search.
context - the XWiki context.
Returns:
the mapping between XWiki groups and LDAP groups.

getCacheExpiration

public int getCacheExpiration(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the time in seconds until a entry in the cache is to expire.

getLDAPBindDN

public String getLDAPBindDN(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the pattern to resolve to find the password to use to connect to LDAP server. It is based on MessageFormat.
See Also:
MessageFormat.format(String, Object...), getLDAPBindDN(String, String, XWikiContext)

getLDAPBindDN

public String getLDAPBindDN(String login,
                            String password,
                            XWikiContext context)
Parameters:
login - the login provided by the user
password - the password provided by the user
context - the XWiki context.
Returns:
the login to use to connect to LDAP server.

getLDAPBindPassword

public String getLDAPBindPassword(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the pattern to resolve to find the password to use to connect to LDAP server.
See Also:
MessageFormat.format(String, Object...), getLDAPBindPassword(String, String, XWikiContext)

getLDAPBindPassword

public String getLDAPBindPassword(String login,
                                  String password,
                                  XWikiContext context)
Parameters:
login - the login provided by the user
password - the password provided by the user
context - the XWiki context.
Returns:
the password to use to connect to LDAP server.

getLDAPTimeout

public int getLDAPTimeout(XWikiContext context)
Parameters:
context - the XWiki context.
Returns:
the maximum number of milliseconds the client waits for any operation under these constraints to complete.


Copyright © 2004-2013 XWiki. All Rights Reserved.