Class LdapProviderConfig
java.lang.Object
org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapProviderConfig
Configuration of the ldap provider.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassDefines the configuration of an identity (user or group).static classDefines the configuration of a connection pool. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final booleanstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final booleanstatic final Stringstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final String[]static final Stringstatic final booleanstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable String[]Configures whether enabled protocols should be set on theLdapConnectionConfig.static StringencodeFilterValue(String value) Copied from org.apache.directory.api.ldap.model.filter.FilterEncoder#encodeFilterValue(java.lang.String) in order to keep this configuration LDAP client independent.@NotNull LdapProviderConfig.PoolConfigReturns the admin connection pool configuration.@Nullable StringConfigures the DN that is used to bind to the LDAP server.@Nullable StringConfigures the password that is used to bind to the LDAP server.@NotNull String[]Optionally configures an array of attribute names that will be retrieved when looking up LDAP entries.@NotNull LdapProviderConfig.IdentityReturns the group specific configuration.@NotNull StringConfigures the attribute that stores the members of a group.@NotNull StringConfigures the hostname of the LDAP server.getMemberOfSearchFilter(@NotNull String dn) Returns the LDAP filter that is used when searching for groups where an identity is member of.@NotNull StringgetName()Returns the name of this provider configuration.intgetPort()Configures the port of the LDAP server.longConfigures the timeout in milliseconds that is used for all LDAP searches.@NotNull LdapProviderConfig.IdentityReturns the user specific configuration.@NotNull LdapProviderConfig.PoolConfigReturns the user connection pool configuration.booleanIf true, the value of the user id (resp.booleanConfigures whether certificates on SSL/TLS connections should be validated.static LdapProviderConfigof(ConfigurationParameters params) Creates a new LDAP provider configuration based on the properties store in the given parameters.@NotNull LdapProviderConfigSets the bind DN.@NotNull LdapProviderConfigsetBindPassword(@Nullable String bindPassword) Sets the bind password@NotNull LdapProviderConfigsetCustomAttributes(@NotNull String[] customAttributes) Sets the attribute names to be retrieved when looking up LDAP entries.@NotNull LdapProviderConfigsetEnabledProtocols(@NotNull String... enabledProtocols) Configures the enabled protocols to be set to theLdapConnectionConfig.@NotNull LdapProviderConfigsetGroupMemberAttribute(@NotNull String groupMemberAttribute) Sets the group member attribute.@NotNull LdapProviderConfigsetHostname(@NotNull String hostname) Sets the hostname.@NotNull LdapProviderConfigSets the name of this provider.@NotNull LdapProviderConfigsetNoCertCheck(boolean noCertCheck) Disables certificate validation.@NotNull LdapProviderConfigsetPort(int port) Sets the port.@NotNull LdapProviderConfigsetSearchTimeout(long searchTimeout) Sets the search timeout.@NotNull LdapProviderConfigsetUseSSL(boolean useSSL) Enables SSL connections.@NotNull LdapProviderConfigsetUseTLS(boolean useTLS) Enables TLS connections.@NotNull LdapProviderConfigsetUseUidForExtId(boolean useUidForExtId) Sets the flag that controls if the user id (resp.toString()booleanuseSSL()Configures whether SSL connections should be used.booleanuseTLS()Configures whether TLS connections should be used.
-
Field Details
-
PARAM_NAME
- See Also:
-
PARAM_NAME_DEFAULT
- See Also:
-
PARAM_LDAP_HOST
- See Also:
-
PARAM_LDAP_HOST_DEFAULT
- See Also:
-
PARAM_LDAP_PORT
- See Also:
-
PARAM_LDAP_PORT_DEFAULT
public static final int PARAM_LDAP_PORT_DEFAULT- See Also:
-
PARAM_USE_SSL
- See Also:
-
PARAM_USE_SSL_DEFAULT
public static final boolean PARAM_USE_SSL_DEFAULT- See Also:
-
PARAM_USE_TLS
- See Also:
-
PARAM_USE_TLS_DEFAULT
public static final boolean PARAM_USE_TLS_DEFAULT- See Also:
-
PARAM_NO_CERT_CHECK
- See Also:
-
PARAM_NO_CERT_CHECK_DEFAULT
public static final boolean PARAM_NO_CERT_CHECK_DEFAULT- See Also:
-
PARAM_ENABLED_PROTOCOLS
- See Also:
-
PARAM_BIND_DN
- See Also:
-
PARAM_BIND_DN_DEFAULT
- See Also:
-
PARAM_BIND_PASSWORD
- See Also:
-
PARAM_BIND_PASSWORD_DEFAULT
- See Also:
-
PARAM_SEARCH_TIMEOUT
- See Also:
-
PARAM_SEARCH_TIMEOUT_DEFAULT
- See Also:
-
PARAM_ADMIN_POOL_MAX_ACTIVE
- See Also:
-
PARAM_ADMIN_POOL_MAX_ACTIVE_DEFAULT
public static final int PARAM_ADMIN_POOL_MAX_ACTIVE_DEFAULT- See Also:
-
PARAM_ADMIN_POOL_LOOKUP_ON_VALIDATE
- See Also:
-
PARAM_ADMIN_POOL_LOOKUP_ON_VALIDATE_DEFAULT
public static final boolean PARAM_ADMIN_POOL_LOOKUP_ON_VALIDATE_DEFAULT- See Also:
-
PARAM_ADMIN_POOL_MIN_EVICTABLE_IDLE_TIME
- See Also:
-
PARAM_ADMIN_POOL_MIN_EVICTABLE_IDLE_TIME_DEFAULT
- See Also:
-
PARAM_ADMIN_POOL_TIME_BETWEEN_EVICTION_RUNS
- See Also:
-
PARAM_ADMIN_POOL_TIME_BETWEEN_EVICTION_RUNS_DEFAULT
- See Also:
-
PARAM_ADMIN_POOL_NUM_TESTS_PER_EVICTION_RUN
- See Also:
-
PARAM_ADMIN_POOL_NUM_TESTS_PER_EVICTION_RUN_DEFAULT
public static final int PARAM_ADMIN_POOL_NUM_TESTS_PER_EVICTION_RUN_DEFAULT- See Also:
-
PARAM_USER_POOL_MAX_ACTIVE
- See Also:
-
PARAM_USER_POOL_MAX_ACTIVE_DEFAULT
public static final int PARAM_USER_POOL_MAX_ACTIVE_DEFAULT- See Also:
-
PARAM_USER_POOL_LOOKUP_ON_VALIDATE
- See Also:
-
PARAM_USER_POOL_LOOKUP_ON_VALIDATE_DEFAULT
public static final boolean PARAM_USER_POOL_LOOKUP_ON_VALIDATE_DEFAULT- See Also:
-
PARAM_USER_POOL_MIN_EVICTABLE_IDLE_TIME
- See Also:
-
PARAM_USER_POOL_MIN_EVICTABLE_IDLE_TIME_DEFAULT
- See Also:
-
PARAM_USER_POOL_TIME_BETWEEN_EVICTION_RUNS
- See Also:
-
PARAM_USER_POOL_TIME_BETWEEN_EVICTION_RUNS_DEFAULT
- See Also:
-
PARAM_USER_POOL_NUM_TESTS_PER_EVICTION_RUN
- See Also:
-
PARAM_USER_POOL_NUM_TESTS_PER_EVICTION_RUN_DEFAULT
public static final int PARAM_USER_POOL_NUM_TESTS_PER_EVICTION_RUN_DEFAULT- See Also:
-
PARAM_USER_BASE_DN
- See Also:
-
PARAM_USER_BASE_DN_DEFAULT
- See Also:
-
PARAM_USER_OBJECTCLASS
- See Also:
-
PARAM_USER_OBJECTCLASS_DEFAULT
-
PARAM_USER_ID_ATTRIBUTE
- See Also:
-
PARAM_USER_ID_ATTRIBUTE_DEFAULT
- See Also:
-
PARAM_USER_EXTRA_FILTER
- See Also:
-
PARAM_USER_EXTRA_FILTER_DEFAULT
- See Also:
-
PARAM_USER_MAKE_DN_PATH
- See Also:
-
PARAM_USER_MAKE_DN_PATH_DEFAULT
public static final boolean PARAM_USER_MAKE_DN_PATH_DEFAULT- See Also:
-
PARAM_GROUP_BASE_DN
- See Also:
-
PARAM_GROUP_BASE_DN_DEFAULT
- See Also:
-
PARAM_GROUP_OBJECTCLASS
- See Also:
-
PARAM_GROUP_OBJECTCLASS_DEFAULT
-
PARAM_GROUP_NAME_ATTRIBUTE
- See Also:
-
PARAM_GROUP_NAME_ATTRIBUTE_DEFAULT
- See Also:
-
PARAM_GROUP_EXTRA_FILTER
- See Also:
-
PARAM_GROUP_EXTRA_FILTER_DEFAULT
- See Also:
-
PARAM_GROUP_MAKE_DN_PATH
- See Also:
-
PARAM_GROUP_MAKE_DN_PATH_DEFAULT
public static final boolean PARAM_GROUP_MAKE_DN_PATH_DEFAULT- See Also:
-
PARAM_GROUP_MEMBER_ATTRIBUTE
- See Also:
-
PARAM_GROUP_MEMBER_ATTRIBUTE_DEFAULT
- See Also:
-
PARAM_USE_UID_FOR_EXT_ID
- See Also:
-
PARAM_USE_UID_FOR_EXT_ID_DEFAULT
public static final boolean PARAM_USE_UID_FOR_EXT_ID_DEFAULT- See Also:
-
PARAM_CUSTOM_ATTRIBUTES
- See Also:
-
PARAM_CUSTOM_ATTRIBUTES_DEFAULT
-
-
Constructor Details
-
LdapProviderConfig
public LdapProviderConfig()
-
-
Method Details
-
of
Creates a new LDAP provider configuration based on the properties store in the given parameters.- Parameters:
params- the configuration parameters.- Returns:
- the config
-
getName
Returns the name of this provider configuration. The default is "ldap"- Returns:
- the name.
-
setName
Sets the name of this provider.- Parameters:
name- the name- Returns:
this- See Also:
-
getHostname
Configures the hostname of the LDAP server. The default is "localhost"- Returns:
- the hostname
-
setHostname
Sets the hostname.- Parameters:
hostname- the hostname- Returns:
this- See Also:
-
getPort
public int getPort()Configures the port of the LDAP server. The default is 389- Returns:
- the port
-
setPort
Sets the port.- Parameters:
port- the port- Returns:
this- See Also:
-
useSSL
public boolean useSSL()Configures whether SSL connections should be used. The default is false.- Returns:
trueif SSL should be used.
-
setUseSSL
Enables SSL connections.- Parameters:
useSSL-trueto enable SSL- Returns:
this- See Also:
-
useTLS
public boolean useTLS()Configures whether TLS connections should be used. The default is false.- Returns:
trueif TLS should be used.
-
setUseTLS
Enables TLS connections.- Parameters:
useTLS-trueto enable TLS- Returns:
this- See Also:
-
noCertCheck
public boolean noCertCheck()Configures whether certificates on SSL/TLS connections should be validated. The default is false.- Returns:
trueif certificates should not be validated
-
setNoCertCheck
Disables certificate validation.- Parameters:
noCertCheck-trueto disable certificate validation- Returns:
this- See Also:
-
enabledProtocols
Configures whether enabled protocols should be set on theLdapConnectionConfig.- Returns:
- an array of enabled protocols or null if no protocols should be explicitly enabled
-
setEnabledProtocols
@NotNull public @NotNull LdapProviderConfig setEnabledProtocols(@NotNull @NotNull String... enabledProtocols) Configures the enabled protocols to be set to theLdapConnectionConfig. By default no protocols are set explicitly.- Parameters:
enabledProtocols- The protocols to be enabled on theLdapConnectionConfig.- Returns:
this- See Also:
-
getBindDN
Configures the DN that is used to bind to the LDAP server. If this value isnullor an empty string, anonymous connections are used.- Returns:
- the bind DN or
null.
-
setBindDN
Sets the bind DN.- Parameters:
bindDN- the DN- Returns:
this- See Also:
-
getBindPassword
Configures the password that is used to bind to the LDAP server. This value is not used for anonymous binds.- Returns:
- the password.
-
setBindPassword
@NotNull public @NotNull LdapProviderConfig setBindPassword(@Nullable @Nullable String bindPassword) Sets the bind password- Parameters:
bindPassword- the password- Returns:
this- See Also:
-
getSearchTimeout
public long getSearchTimeout()Configures the timeout in milliseconds that is used for all LDAP searches. The default is "60s".- Returns:
- the timeout in milliseconds.
-
setSearchTimeout
Sets the search timeout.- Parameters:
searchTimeout- the timeout in milliseconds- Returns:
this- See Also:
-
getGroupMemberAttribute
Configures the attribute that stores the members of a group. Default is "uniquemember"- Returns:
- the group member attribute
-
setGroupMemberAttribute
@NotNull public @NotNull LdapProviderConfig setGroupMemberAttribute(@NotNull @NotNull String groupMemberAttribute) Sets the group member attribute.- Parameters:
groupMemberAttribute- the attribute name- Returns:
this- See Also:
-
getUseUidForExtId
public boolean getUseUidForExtId()If true, the value of the user id (resp. group name) attribute will be used to create external identifiers. Otherwise the DN will be used, which is the default.- Returns:
- true iff the value of the user id (resp. group name) attribute will be used to create external identifiers
-
setUseUidForExtId
Sets the flag that controls if the user id (resp. gruop name) will be used instead of the DN to create external ids.- Parameters:
useUidForExtId- the new value of #useUidForExtId- Returns:
this- See Also:
-
getCustomAttributes
Optionally configures an array of attribute names that will be retrieved when looking up LDAP entries. Defaults to the empty array indicating that all attributes will be retrieved.- Returns:
- an array of attribute names. The empty array indicates that all attributes will be retrieved.
-
setCustomAttributes
@NotNull public @NotNull LdapProviderConfig setCustomAttributes(@NotNull @NotNull String[] customAttributes) Sets the attribute names to be retrieved when looking up LDAP entries. The empty array indicates that all attributes will be retrieved.- Parameters:
customAttributes- an array of attribute names- Returns:
- the Identity instance
-
getMemberOfSearchFilter
Returns the LDAP filter that is used when searching for groups where an identity is member of. The filter is based on the configuration and has the following format:
Note that the objectclass part is repeated according to the specified objectclasses in(&(${memberAttribute}=${dn})(objectclass=${objectclass})${extraFilter})LdapProviderConfig.Identity.getObjectClasses()of the group configuration.- Parameters:
dn- the dn of the identity to search for- Returns:
- the search filter
-
getUserConfig
Returns the user specific configuration.- Returns:
- the user config.
-
getGroupConfig
Returns the group specific configuration.- Returns:
- the groups config.
-
getAdminPoolConfig
Returns the admin connection pool configuration.- Returns:
- admin pool config
-
getUserPoolConfig
Returns the user connection pool configuration.- Returns:
- user pool config
-
encodeFilterValue
Copied from org.apache.directory.api.ldap.model.filter.FilterEncoder#encodeFilterValue(java.lang.String) in order to keep this configuration LDAP client independent. Handles encoding of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.- Parameters:
value- Right hand side of "attrId=value" assertion occurring in an LDAP search filter.- Returns:
- Escaped version of
value
-
toString
-