Package org.springframework.security.config.annotation.authentication.configurers.ldap

# Class LdapAuthenticationProviderConfigurer.ContextSourceBuilder

java.lang.Object
org.springframework.security.config.annotation.authentication.configurers.ldap.LdapAuthenticationProviderConfigurer.ContextSourceBuilder

Enclosing class:
  LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>

public final class LdapAuthenticationProviderConfigurer.ContextSourceBuilder extends Object
Allows building a `BaseLdapPathContextSource` and optionally creating an embedded LDAP instance.

Since:
  3.2

## Method Summary

Modifier and Type
Method
Description
`LdapAuthenticationProviderConfigurer<B>`
`and()`
Gets the `LdapAuthenticationProviderConfigurer` for further customizations
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`ldif(String ldif)`
Specifies an ldif to load at startup for an embedded LDAP server.
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`managerDn(String managerDn)`
Username (DN) of the "manager" user identity (i.e.
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`managerPassword(String managerPassword)`
The password for the manager DN.
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`port(int port)`
The port to connect to LDAP to (the default is 33389 or random available port if unavailable).
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`root(String root)`
Optional root suffix for the embedded LDAP server.
`LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder`
`url(String url)`
Specifies the ldap server URL when not using the embedded LDAP server.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### ldif

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder ldif(String ldif)
Specifies an ldif to load at startup for an embedded LDAP server. This only loads if using an embedded instance. The default is "classpath*:*.ldif".

Parameters:
  `ldif` - the ldif to load at startup for an embedded LDAP server.
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### managerDn

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder managerDn(String managerDn)
Username (DN) of the "manager" user identity (i.e. "uid=admin,ou=system") which will be used to authenticate to a (non-embedded) 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.
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### managerPassword

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder managerPassword(String managerPassword)
The password for the manager DN. This is required if the manager-dn is specified.

Parameters:
  `managerPassword` - password for the manager DN
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### port

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder port(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
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### root

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder root(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
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### url

public LdapAuthenticationProviderConfigurer<B>.ContextSourceBuilder url(String url)
Specifies the ldap server URL when not using the embedded LDAP server. For example, "ldaps://ldap.example.com:33389/dc=myco,dc=org".

Parameters:
  `url` - the ldap server URL
Returns:
  the `LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>>.ContextSourceBuilder` for further customization

### and

public LdapAuthenticationProviderConfigurer<B> and()
Gets the `LdapAuthenticationProviderConfigurer` for further customizations

Returns:
  the `LdapAuthenticationProviderConfigurer` for further customizations