new Strategy(options, verifyopt)
Strategy constructor
The LDAP authentication strategy authenticates requests based on the credentials submitted through an HTML-based login form.
Applications may supply a `verify` callback which accepts `user` object and then calls the `done` callback supplying a `user`, which should be set to `false` if user is not allowed to authenticate. If an exception occured, `err` should be set.
Options can be also given as function that accepts a callback end calls it with error and options arguments. Notice that the callback is executed on every authenticate call.
Example:
The LDAP authentication strategy authenticates requests based on the credentials submitted through an HTML-based login form.
Applications may supply a `verify` callback which accepts `user` object and then calls the `done` callback supplying a `user`, which should be set to `false` if user is not allowed to authenticate. If an exception occured, `err` should be set.
Options can be also given as function that accepts a callback end calls it with error and options arguments. Notice that the callback is executed on every authenticate call.
Example:
var LdapStrategy = require('passport-ldapauth').Strategy; passport.use(new LdapStrategy({ server: { url: 'ldap://localhost:389', bindDN: 'cn=root', bindCredentials: 'secret', searchBase: 'ou=passport-ldapauth', searchFilter: '(uid={{username}})', reconnect: true } }, function(user, done) { return cb(null, user); } ));
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | optionsCallback | Configuration options or options returning function
Properties
|
|||||||||||||||||||||||||||||||||||||||||
verify |
verifyCallback | verifyReqCallback | undefined |
<optional> |
User verify callback |
- Source:
Methods
authenticate(req, optionsopt) → {undefined}
Authenticate the request coming from a form or such.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
Object | The HTTP request | |||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Authentication options (flash messages). All messages have default values.
Properties
|
- Source:
Returns:
- Type
- undefined