Class LdapManager


  • public class LdapManager
    extends java.lang.Object
    Manager for all LDAP related processing.
    Since:
    jcms-9.0.1
    • Field Detail

      • PERIODIC_SYNC_ENABLED

        public static final java.lang.String PERIODIC_SYNC_ENABLED
        See Also:
        Constant Field Values
      • PERIODIC_SYNC_SCHEDULE

        public static final java.lang.String PERIODIC_SYNC_SCHEDULE
        See Also:
        Constant Field Values
      • SYNCHRONIZE_CREATE_DBMEMBER_PROP

        public static final java.lang.String SYNCHRONIZE_CREATE_DBMEMBER_PROP
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static final LdapManager getInstance()
      • initLDAP

        public void initLDAP()
        Initialize or Reinitialize LDAP configuration.
      • getLDAPConfiguration

        public LDAPConfiguration getLDAPConfiguration()
        Returns the default LDAPConfiguration used by JCMS which you can give to LDAPMapper(LDAPConfiguration) to connect to your LDAP server.
        Returns:
        the current LDAPConfiguration used by JCMS
        Since:
        jcms-5.5.0
      • getLDAPConfigurationFromLogin

        public LDAPConfiguration getLDAPConfigurationFromLogin​(java.lang.String login)
        Retrieve the LDAPConfiguration to use based on the specified login.

        If the specified login is a mail, a Windows UPN (User Principal Name) format, or a down-level windows logon format (DOMAIN\sAMAccountName), the domain part is extracted and the LDAP configuration will be read from properties ldap.server.{DOMAIN}.* (if available) instead of the default ldap.server.* properties.
        Configuration alias can also be defined with property ldap.conf-aliases.{domain}: confname allowing several domain to match on LDAP configuration.

        Parameters:
        login - the login used to determine which configuration to use
        Returns:
        a LDAPConfiguration, never return null (default to getLDAPConfiguration().
      • getLDAPConfigurationFromDomain

        public LDAPConfiguration getLDAPConfigurationFromDomain​(java.lang.String domain)
        Retrieve the LDAPConfiguration for the specific domain.
        Parameters:
        domain - an optional configuration name or alias, as declared in ldap configuration properties ldap.server.{domain}.* or through LDAP configuration alias declared in property ldap.conf-aliases.{domain}: confname
        Returns:
        an instance of LDAPConfiguration, never return null (default to getLDAPConfiguration())
      • getLDAPConfigurations

        public java.util.List<LDAPConfiguration> getLDAPConfigurations()
        Returns all LDAPConfiguration configured in JCMS.
        Returns:
        a List of all LDAPConfigurations configured in JCMS, never return null
        Since:
        jcms-9.0.1
      • importAll

        public void importAll()
        Import all LDAP users (and their groups) in JCMS, updating existing data if any.

        For each LDAP configuration declared, this method retrieves all users in the LDAP matching the current filters and then trigger the synchronisation operation impletemented in the LdapAuthenticationHandler :
        create or update operation of corresponding Member and Group(s).

        All existing LDAP Member not found during the LDAP search are also processed to disable them as needed.

      • isImportAllInProgress

        public boolean isImportAllInProgress()
        Checks if an import all operation is in progress.
        Returns:
        true if importAll() is currently working, false otherwise
      • isLdapEnabled

        public boolean isLdapEnabled()
        Checks if LDAP is enabled.
        Returns:
        true if LDAP is enabled, false otherwise
      • getGroupFromDN

        public Group getGroupFromDN​(java.lang.String dn)
        Returns a LDAP group from its distinguish name.
        Parameters:
        dn - the dn of the group
        Returns:
        the group or null if not found
      • createDBMember

        public boolean createDBMember()
        Check type of Member to create during LDAP synchronization.
        Returns:
        false to create JStore Member, true to create DBMember
        Since:
        jcms-10.0.1 / JCMS-6340