diff --git a/README.md b/README.md index 16f1f31ccc57e6a25bf018e240cb4cbb10fe83b0..04fd76d856932e7816306f8806a46d154244f162 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,40 @@ # ldapAuth LDAP Authentication bridge + +This will start a LDAP Server witch can be used to auth against and bridge the auth to where ever you want (TextFile, Database, SMTP Auth...) + +# HowTo Server +Starting the Server is simple: +``` +var ldapAuth = require('./ldapAuth'); + +ldapAuth.init({ + serverPort : 389, //Default 389 + ldapServerPassword : "asdg", //Change password here + warningCallback : function(warning) { + console.log("warning",warning); + }, + errorCallback : function(error) { + console.log("error",error); + }, + checkPassword : function(auth, isPasswordCorrectCallback) { + var userName = auth["userName"]; + var userPassword = auth["userPassword"]; + + if(userName=="test" && userPassword=="test") { //Test user+pw combination here + isPasswordCorrectCallback(true); + } else { + isPasswordCorrectCallback(false); + } + } +}); +``` + +# HowTo Client +Change to this settings at your LDAP Client +* HOST: IP of the Server you set this up +* PORT: Change to the port you defined (389 default) +* DN Bind: `cn=auth` +* DN Password: Change to your ldapServerPassword +* Base for user filter: `ou=Users` +* User filter: `(&(uid=%s))`