Class EmbeddedLdapServerContextSourceFactoryBean
- java.lang.Object
-
- org.springframework.security.config.ldap.EmbeddedLdapServerContextSourceFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>
,org.springframework.context.ApplicationContextAware
public class EmbeddedLdapServerContextSourceFactoryBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
Creates aDefaultSpringSecurityContextSource
used to perform LDAP authentication and starts and in-memory LDAP server.- Since:
- 5.7
-
-
Constructor Summary
Constructors Constructor Description EmbeddedLdapServerContextSourceFactoryBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
static EmbeddedLdapServerContextSourceFactoryBean
fromEmbeddedLdapServer()
Create an EmbeddedLdapServerContextSourceFactoryBean that will use an embedded LDAP server to perform LDAP authentication.DefaultSpringSecurityContextSource
getObject()
java.lang.Class<?>
getObjectType()
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setLdif(java.lang.String ldif)
Specifies an LDIF to load at startup for an embedded LDAP server.void
setManagerDn(java.lang.String managerDn)
Username (DN) of the "manager" user identity (i.e.void
setManagerPassword(java.lang.String managerPassword)
The password for the manager DN.void
setPort(int port)
The port to connect to LDAP to (the default is 33389 or random available port if unavailable).void
setRoot(java.lang.String root)
Optional root suffix for the embedded LDAP server.
-
-
-
Method Detail
-
fromEmbeddedLdapServer
public static EmbeddedLdapServerContextSourceFactoryBean fromEmbeddedLdapServer()
Create an EmbeddedLdapServerContextSourceFactoryBean that will use an embedded LDAP server to perform LDAP authentication. This requires a dependency on `com.unboundid:unboundid-ldapsdk`.- Returns:
- the EmbeddedLdapServerContextSourceFactoryBean
-
setLdif
public void setLdif(java.lang.String ldif)
Specifies an LDIF to load at startup for an embedded LDAP server. The default is "classpath*:*.ldif".- Parameters:
ldif
- the ldif to load at startup for an embedded LDAP server.
-
setPort
public void setPort(int port)
The port to connect to LDAP to (the default is 33389 or random available port if unavailable). Supplying 0 as the port indicates that a random available port should be selected.- Parameters:
port
- the port to connect to
-
setRoot
public void setRoot(java.lang.String root)
Optional root suffix for the embedded LDAP server. Default is "dc=springframework,dc=org".- Parameters:
root
- root suffix for the embedded LDAP server
-
setManagerDn
public void setManagerDn(java.lang.String managerDn)
Username (DN) of the "manager" user identity (i.e. "uid=admin,ou=system") which will be used to authenticate to an LDAP server. If omitted, anonymous access will be used.- Parameters:
managerDn
- the username (DN) of the "manager" user identity used to authenticate to a LDAP server.
-
setManagerPassword
public void setManagerPassword(java.lang.String managerPassword)
The password for the manager DN. This is required if thesetManagerDn(String)
is specified.- Parameters:
managerPassword
- password for the manager DN
-
getObject
public DefaultSpringSecurityContextSource getObject() throws java.lang.Exception
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>
- Throws:
java.lang.Exception
-
getObjectType
public java.lang.Class<?> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
-