Class LdapManager
- java.lang.Object
-
- com.jalios.jcms.ldap.LdapManager
-
public class LdapManager extends java.lang.Object
Manager for all LDAP related processing.- Since:
- jcms-9.0.1
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PERIODIC_SYNC_ENABLED
static int
PERIODIC_SYNC_MAX_OP_PER_SYNC_DEFAULT_VALUE
Default value used for the maximum number of operations to process per periodical sync.static java.lang.String
PERIODIC_SYNC_MAX_OP_PER_SYNC_PROP
Property name used to specify the maximum number of operations to process per periodical sync.static java.lang.String
PERIODIC_SYNC_SCHEDULE
static java.lang.String
SYNCHRONIZE_CREATE_DBMEMBER_PROP
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
createDBMember()
Check type of Member to create during LDAP synchronization.Group
getGroupFromDN(java.lang.String dn)
Returns a LDAP group from its distinguish name.static LdapManager
getInstance()
LDAPConfiguration
getLDAPConfiguration()
Returns the default LDAPConfiguration used by JCMS which you can give toLDAPMapper(LDAPConfiguration)
to connect to your LDAP server.LDAPConfiguration
getLDAPConfigurationFromDN(java.lang.String dn)
Retrieve the LDAPConfiguration for the specific DN.LDAPConfiguration
getLDAPConfigurationFromDomain(java.lang.String domain)
Retrieve the LDAPConfiguration for the specific domain.LDAPConfiguration
getLDAPConfigurationFromLogin(java.lang.String login)
Retrieve the LDAPConfiguration to use based on the specified login.java.util.List<LDAPConfiguration>
getLDAPConfigurations()
Returns all LDAPConfiguration configured in JCMS.java.util.Map<java.lang.String,java.lang.Object>
getNewLdapContextMap()
Retrieve a new context map indicating operation is being processed for LDAP.void
importAll()
Import all LDAP users (and their groups) in JCMS, updating existing data if any.void
initLDAP()
Initialize or Reinitialize LDAP configuration.boolean
isImportAllInProgress()
Checks if an import all operation is in progress.boolean
isLdapEnabled()
Checks if LDAP is enabled.
-
-
-
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
-
PERIODIC_SYNC_MAX_OP_PER_SYNC_PROP
public static final java.lang.String PERIODIC_SYNC_MAX_OP_PER_SYNC_PROP
Property name used to specify the maximum number of operations to process per periodical sync.- Since:
- 10.0.8 / JCMS-10654
- See Also:
- Constant Field Values
-
PERIODIC_SYNC_MAX_OP_PER_SYNC_DEFAULT_VALUE
public static final int PERIODIC_SYNC_MAX_OP_PER_SYNC_DEFAULT_VALUE
Default value used for the maximum number of operations to process per periodical sync.- Since:
- 10.0.8 / JCMS-10654
- 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 toLDAPMapper(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 defaultldap.server.*
properties.
Configuration alias can also be defined with propertyldap.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 propertiesldap.server.{domain}.*
or through LDAP configuration alias declared in propertyldap.conf-aliases.{domain}: confname
- Returns:
- an instance of LDAPConfiguration, never return null (default to
getLDAPConfiguration()
)
-
getLDAPConfigurationFromDN
public LDAPConfiguration getLDAPConfigurationFromDN(java.lang.String dn)
Retrieve the LDAPConfiguration for the specific DN.Look for the first LDAPConfiguration which has a matching baseDN, tested on both user base DN (
LDAPConfiguration.getSuffix()
) and group base DN (LDAPConfiguration.getGroupSuffix()
).- Parameters:
dn
- an LDAP distinguish name- 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
-
getNewLdapContextMap
public java.util.Map<java.lang.String,java.lang.Object> getNewLdapContextMap()
Retrieve a new context map indicating operation is being processed for LDAP.Implementation detail : the returned map will contain key {link DataController#CTXT_SYNC_LDAP} with value
Boolean.TRUE
- Returns:
- a new Map
- Since:
- 10.0.8 / JCMS-10691
-
-