Refactor authentication.

- Handle LDAP bind directly rather than with passport-ldapbind.
- Authenticate using LDAPS.
- Move authentication code into a new module.