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 Object
implements org.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
Creates a
DefaultSpringSecurityContextSource used to perform LDAP
authentication and starts and in-memory LDAP server.- Since:
- 5.7
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Create an EmbeddedLdapServerContextSourceFactoryBean that will use an embedded LDAP server to perform LDAP authentication.Class<?>voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidSpecifies an LDIF to load at startup for an embedded LDAP server.voidsetManagerDn(String managerDn) Username (DN) of the "manager" user identity (i.e.voidsetManagerPassword(String managerPassword) The password for the manager DN.voidsetPort(int port) The port to connect to LDAP to (the default is 33389 or random available port if unavailable).voidOptional root suffix for the embedded LDAP server.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
EmbeddedLdapServerContextSourceFactoryBean
public EmbeddedLdapServerContextSourceFactoryBean()
-
-
Method Details
-
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
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
Optional root suffix for the embedded LDAP server. Default is "dc=springframework,dc=org".- Parameters:
root- root suffix for the embedded LDAP server
-
setManagerDn
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
The password for the manager DN. This is required if thesetManagerDn(String)is specified.- Parameters:
managerPassword- password for the manager DN
-
getObject
- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>- Throws:
Exception
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-