Class 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 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
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.beans.factory.FactoryBean

        isSingleton
    • Constructor Detail

      • EmbeddedLdapServerContextSourceFactoryBean

        public EmbeddedLdapServerContextSourceFactoryBean()
    • 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 the setManagerDn(String) is specified.
        Parameters:
        managerPassword - password for the manager DN
      • getObjectType

        public java.lang.Class<?> getObjectType()
        Specified by:
        getObjectType in interface org.springframework.beans.factory.FactoryBean<DefaultSpringSecurityContextSource>
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Throws:
        org.springframework.beans.BeansException