Node.js
Authentification Windows sous node.js
Recherche…
Remarques
Il existe plusieurs autres APIS Active Directory, tels que activedirectory2
et adldap
.
Utiliser activedirectory
L'exemple ci-dessous provient des documents complets, disponibles ici (GitHub) ou ici (NPM) .
Installation
npm install --save activedirectory
Usage
// Initialize
var ActiveDirectory = require('activedirectory');
var config = {
url: 'ldap://dc.domain.com',
baseDN: 'dc=domain,dc=com'
};
var ad = new ActiveDirectory(config);
var username = '[email protected]';
var password = 'password';
// Authenticate
ad.authenticate(username, password, function(err, auth) {
if (err) {
console.log('ERROR: '+JSON.stringify(err));
return;
}
if (auth) {
console.log('Authenticated!');
}
else {
console.log('Authentication failed!');
}
});
Modified text is an extract of the original Stack Overflow Documentation
Sous licence CC BY-SA 3.0
Non affilié à Stack Overflow