# LDAP Auth provider

This is an auth provider implementation that authenticates via LDAP.

## Getting started

To use this project, add the following dependency to the dependencies section of your build descriptor:

- Maven (in your `pom.xml`):

    <dependency>
     <groupId>io.vertx</groupId>
     <artifactId>vertx-auth-ldap</artifactId>
     <version>4.1.7</version>
    </dependency>

- Gradle (in your `build.gradle` file):

    compile 'io.vertx:vertx-auth-ldap:4.1.7'

## Instantiation

To create an instance of the Ldap auth provider, use `LdapAuthentication.create` as follows:

## Configuration

The class `LdapAuthenticationOptions` is used to configure the Ldap authentication provider:

`authenticationQuery`

  this query is used when looking up a user with a particular id. An example is `uid={0},ou=users,dc=foo,dc=com` - the element `{0}` is substituted with the user id to create the actual lookup. This setting is mandatory.

`url`

  the url to the LDAP server. The url must start with `ldap://` and a port must be specified. An example is `ldap://myldapserver.mycompany.com:10389`

`authenticationMechanism`

  Sets the type of LDAP authentication mechanism to use when connecting to the LDAP server.

`referral`

  Sets the LDAP referral behavior when creating a connection. Defaults to `follow`. See the Sun/Oracle LDAP referral documentation for more: http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html

## Notes

Note that when authenticating using this implementation, it assumes `username` and `password` fields are present in the authentication info