Giter VIP home page Giter VIP logo

node-ldapauth's Introduction

  • This library is only for LDAP authentication. If you're looking for a more complete LDAP implementation, check out http://ldapjs.org/

LDAP Authentication for Node.JS

Provides a simple function for validating username/password credentials on an LDAP server.

This can be used in web-applications that authenticate users from a central directory.

It binds to the native OpenLDAP library (libldap) and calls ldap_simple_bind().

Building

./build.sh

Usage

Ensure libldap (OpenLDAP client library) is installed.

You need to add ldapauth.node to your application.

var ldapauth = require('./ldapauth'); // path to ldapauth.node

ldapauth.authenticate('scheme', 'some.host', 389 /*port*/, 'someuser', 'somepassword', 
  function(err, result) {
    if (err) {
      print('Error');
    } else {
      print('Credentials valid = ' + result); // true or false
    }
  });

Resources

2010, Joe Walnes, [email protected], http://joewalnes.com/

Bitdeli Badge

node-ldapauth's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-ldapauth's Issues

invalid ELF header

while running my app I got:

Error: /vendor/ldapauth.node: invalid ELF header

Cannot build on node v.0.6.10

[1/2] cxx: ldapauth.cc -> build/Release/ldapauth_1.o
../ldapauth.cc:42:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Build failed:  -> task failed (err #1): 
    {task: cxx ldapauth.cc -> ldapauth_1.o}

Please fix this issue.

Aborting on failure to bind

If right attribute data is given, it works without any errors and stays put:
$ ./example.js
Auth: true

But, if wrong attributes are given, it fails as expected, but aborts with the following trace.
Any idea what is going on?
$ ./example.js
Auth: false
*** glibc detected *** node: double free or corruption (out): 0xbfed0b80 ***
======= Backtrace: =========
/lib/libc.so.6[0x1cc6c5]
/lib/libc.so.6(cfree+0x59)[0x1ccb09]
/usr/lib/liblber-2.3.so.0(ber_memfree_x+0x4a)[0x36a31a]
/usr/lib/liblber-2.3.so.0(ber_free+0x34)[0x3686b4]
/user1/sites/nodejs/node_modules/ldapauth/ldapauth.node[0xcdef89]
/user1/sites/nodejs/node_modules/ldapauth/ldapauth.node[0xcdf074]
node[0x8176987]
node(eio_poll+0x154)[0x8176b14]
node[0x813442e]
node(ev_invoke_pending+0x5a)[0x81798ca]
node(ev_run+0x5c9)[0x817ee99]
node(_ZN4node5StartEiPPc+0x768)[0x8138738]
node(main+0x22)[0x8133fe2]
/lib/libc.so.6(__libc_start_main+0xdc)[0x178e9c]
node[0x8133f01]
======= Memory map: ========
00110000-00134000 rwxp 00110000 00:00 0
0013d000-0013f000 r-xp 00000000 03:0a 992090 /lib/libutil-2.5.so
0013f000-00140000 r-xp 00001000 03:0a 992090 /lib/libutil-2.5.so
00140000-00141000 rwxp 00002000 03:0a 992090 /lib/libutil-2.5.so
00144000-0015f000 r-xp 00000000 03:0a 992013 /lib/ld-2.5.so
0015f000-00160000 r-xp 0001a000 03:0a 992013 /lib/ld-2.5.so
00160000-00161000 rwxp 0001b000 03:0a 992013 /lib/ld-2.5.so
00163000-002b6000 r-xp 00000000 03:0a 992015 /lib/libc-2.5.so
002b6000-002b8000 r-xp 00153000 03:0a 992015 /lib/libc-2.5.so
002b8000-002b9000 rwxp 00155000 03:0a 992015 /lib/libc-2.5.so
002b9000-002bc000 rwxp 002b9000 00:00 0
002be000-002e5000 r-xp 00000000 03:0a 992044 /lib/libm-2.5.so
002e5000-002e6000 r-xp 00026000 03:0a 992044 /lib/libm-2.5.so
002e6000-002e7000 rwxp 00027000 03:0a 992044 /lib/libm-2.5.so
002e9000-002ec000 r-xp 00000000 03:0a 992038 /lib/libdl-2.5.so
002ec000-002ed000 r-xp 00002000 03:0a 992038 /lib/libdl-2.5.so
002ed000-002ee000 rwxp 00003000 03:0a 992038 /lib/libdl-2.5.so
002f0000-00305000 r-xp 00000000 03:0a 992021 /lib/libpthread-2.5.so
00305000-00306000 r-xp 00015000 03:0a 992021 /lib/libpthread-2.5.so
00306000-00307000 rwxp 00016000 03:0a 992021 /lib/libpthread-2.5.so
00307000-00309000 rwxp 00307000 00:00 0
0030b000-0031d000 r-xp 00000000 03:0d 1303417 /usr/lib/libz.so.1.2.3
0031d000-0031e000 rwxp 00011000 03:0d 1303417 /usr/lib/libz.so.1.2.3
00320000-00327000 r-xp 00000000 03:0a 992022 /lib/librt-2.5.so
00327000-00328000 r-xp 00007000 03:0a 992022 /lib/librt-2.5.so
00328000-00329000 rwxp 00008000 03:0a 992022 /lib/librt-2.5.so
00329000-00362000 r-xp 00000000 03:0d 1310272 /usr/lib/libldap-2.3.so.0.2.31
00362000-00363000 rwxp 00039000 03:0d 1310272 /usr/lib/libldap-2.3.so.0.2.31
00363000-00370000 r-xp 00000000 03:0d 1304988 /usr/lib/liblber-2.3.so.0.2.31
00370000-00371000 rwxp 0000c000 03:0d 1304988 /usr/lib/liblber-2.3.so.0.2.31
00371000-0037b000 r-xp 00000000 03:0a 992079 /lib/libnss_files-2.5.so
0037b000-0037c000 r-xp 00009000 03:0a 992079 /lib/libnss_files-2.5.so
0037c000-0037d000 rwxp 0000a000 03:0a 992079 /lib/libnss_files-2.5.so
004c1000-004c2000 r-xp 004c1000 00:00 0 [vdso]
00778000-0077c000 r-xp 00000000 03:0a 992073 /lib/libnss_dns-2.5.so
0077c000-0077d000 r-xp 00003000 03:0a 992073 /lib/libnss_dns-2.5.so
0077d000-0077e000 rwxp 00004000 03:0a 992073 /lib/libnss_dns-2.5.so
0095e000-00963000 rwxp 0095e000 00:00 0
00965000-00967000 rwxp 00965000 00:00 0
009e2000-00a02000 rwxp 009e2000 00:00 0
00bb2000-00bed000 r-xp 00000000 03:0a 992066 /lib/libsepol.so.1
00bed000-00bee000 rwxp 0003b000 03:0a 992066 /lib/libsepol.so.1
00bee000-00bf8000 rwxp 00bee000 00:00 0
00bfa000-00c10000 r-xp 00000000 03:0a 992072 /lib/libselinux.so.1
00c10000-00c12000 rwxp 00015000 03:0a 992072 /lib/libselinux.so.1
00c1e000-00c29000 r-xp 00000000 03:0a 992204 /lib/libgcc_s-4.1.2-20080825.so.1
00c29000-00c2a000 rwxp 0000a000 03:0a 992204 /lib/libgcc_s-4.1.2-20080825.so.1
00c95000-00cb5000 rwxp 00c95000 00:00 0
00cd7000-00ce4000 r-xp 00000000 03:05 3180275 /user1/sites/nodejs/node_modules/ldapauth/ldapauth.node
00ce4000-00ce5000 rwxp 0000d000 03:05 3180275 /user1/sites/nodejs/node_modules/ldapauth/ldapauth.node
00df1000-00df3000 r-xp 00000000 03:0a 992055 /lib/libkeyutils-1.2.so
00df3000-00df4000 rwxp 00001000 03:0a 992055 /lib/libkeyutils-1.2.so
00df6000-00df8000 r-xp 00000000 03:0a 992074 /lib/libcom_err.so.2.1
00df8000-00df9000 rwxp 00001000 03:0a 992074 /lib/libcom_err.so.2.1
00ea1000-00ec1000 rwxp 00ea1000 00:00 0
07261000-07271000 r-xp 00000000 03:0a 992063 /lib/libresolv-2.5.so
07271000-07272000 r-xp 0000f000 03:0a 992063 /lib/libresolv-2.5.so
07272000-07273000 rwxp 00010000 03:0a 992063 /lib/libresolv-2.5.so
07273000-07275000 rwxp 07273000 00:00 0
07277000-073a1000 r-xp 00000000 03:0a 992080 /lib/libcrypto.so.0.9.8e
073a1000-073b4000 rwxp 00129000 03:0a 992080 /lib/libcrypto.so.0.9.8e
073b4000-073b8000 rwxp 073b4000 00:00 0
07414000-074a8000 r-xp 00000000 03:0d 1304960 /usr/lib/libkrb5.so.3.3
074a8000-074ab000 rwxp 00093000 03:0d 1304960 /usr/lib/libkrb5.so.3.3
074ad000-074b5000 r-xp 00000000 03:0d 1304426 /usr/lib/libkrb5support.so.0.1
074b5000-074b6000 rwxp 00007000 03:0d 1304426 /usr/lib/libkrb5support.so.0.1
074f0000-0751d000 r-xp 00000000 03:0d 1304963 /usr/lib/libgssapi_krb5.so.2.2
0751d000-0751e000 rwxp 0002d000 03:0d 1304963 /usr/lib/libgssapi_krb5.so.2.2
07520000-07546000 r-xp 00000000 03:0d 1304959 /usr/lib/libk5crypto.so.3.1
07546000-07547000 rwxp 00025000 03:0d 1304959 /usr/lib/libk5crypto.so.3.1
07549000-0758d000 r-xp 00000000 03:0a 992087 /lib/libssl.so.0.9.8e
0758d000-07591000 rwxp 00043000 03:0a 992087 /lib/libssl.so.0.9.8e
07998000-07a78000 r-xp 00000000 03:0d 1303422 /usr/lib/libstdc++.so.6.0.8
07a78000-07a7c000 r-xp 000df000 03:0d 1303422 /usr/lib/libstdc++.so.6.0.8
07a7c000-07a7d000 rwxp 000e3000 03:0d 1303422 /usr/lib/libstdc++.so.6.0.8
07a7d000-07a83000 rwxp 07a7d000 00:00 0
07a85000-07a8e000 r-xp 00000000 03:0a 992206 /lib/libcrypt-2.5.so
07a8e000-07a8f000 r-xp 00008000 03:0a 992206 /lib/libcrypt-2.5.so
07a8f000-07a90000 rwxp 00009000 03:0a 992206 /lib/libcrypt-2.5.so
07a90000-07ab7000 rwxp 07a90000 00:00 0
07bf0000-07c08000 r-xp 00000000 03:0d 1310271 /usr/lib/libsasl2.so.2.0.22
07c08000-07c09000 rwxp 00017000 03:0d 1310271 /usr/lib/libsasl2.so.2.0.22
08048000-0859d000 r-xp 00000000 03:07 163599 /usr/local/node-v0.4.8/bin/node
0859d000-085a5000 rw-p 00554000 03:07 163599 /usr/local/node-v0.4.8/bin/node
085a5000-085bf000 rw-p 085a5000 00:00 0
093bb000-09471000 rw-p 093bb000 00:00 0 [heap]
b53d8000-b53d9000 ---p b53d8000 00:00 0
b53d9000-b53e9000 rw-p b53d9000 00:00 0
b53e9000-b53ea000 ---p b53e9000 00:00 0
b53ea000-b5495000 rw-p b53ea000 00:00 0
b5495000-b5496000 ---p b5495000 00:00 0
b5496000-b5f38000 rw-p b5496000 00:00 0
b5f38000-b6000000 ---p b5f38000 00:00 0
b6000000-b6080000 rw-p b6000000 00:00 0
b6080000-b6800000 ---p b6080000 00:00 0
b6800000-b6880000 rw-p b6800000 00:00 0
b6880000-b7f38000 ---p b6880000 00:00 0
b7f38000-b7f3e000 rw-p b7f38000 00:00 0
bfebe000-bfed3000 rw-p bffe9000 00:00 0 [stack]
Aborted

Thanks

node-gyp update needed

New nodejs uses node-gyp instead of node-waf (currently node-waf is used in this project). Could you update installation scripts to use node-gyp .

authentication works but search crashes

Note: this is on 1686 machine. I did build the module on the machine.

node version: v0.3.2-pre

When I run the example script, with my credentials and server info, it authenticates fine but then crashes with the following on a search....

node example.js

Auth: true
*** glibc detected *** node: double free or corruption (out): 0x0a55c110 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7c06704]
/lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb7c086b6]
/usr/lib/liblber-2.4.so.2(ber_memfree_x+0x50)[0xb521fe50]
/usr/lib/liblber-2.4.so.2(ber_free+0x34)[0xb521e854]
/home/tfrohe/node-ldapauth/ldapauth.node[0xb5272f93]
/home/tfrohe/node-ldapauth/ldapauth.node[0xb527307d]
node[0x816db05]
node(eio_poll+0x16b)[0x816dceb]
node[0x813a02b]
node(ev_invoke_pending+0x53)[0x8170b73]
node(ev_run+0x88c)[0x817528c]
node(_ZN4node5StartEiPPc+0x594)[0x813d0f4]
node(main+0x22)[0x81395d2]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7bad775]
node[0x8139511]
======= Memory map: ========
08048000-08510000 r-xp 00000000 fc:00 1499218 /home/tfrohe/local/bin/node
08510000-08511000 r--p 004c7000 fc:00 1499218 /home/tfrohe/local/bin/node
08511000-08516000 rw-p 004c8000 fc:00 1499218 /home/tfrohe/local/bin/node
08516000-0852e000 rw-p 08516000 00:00 0
0a514000-0a5d9000 rw-p 0a514000 00:00 0 [heap]
b4ef4000-b4f00000 rwxp b4ef4000 00:00 0
b4f00000-b4f30000 rw-p b4f00000 00:00 0
b4f30000-b5000000 ---p b4f30000 00:00 0
b5009000-b5080000 rw-p b5009000 00:00 0
b5080000-b50a0000 rwxp b5080000 00:00 0
b50a0000-b50aa000 r-xp 00000000 fc:00 508091 /lib/tls/i686/cmov/libnss_files-2.9.so
b50aa000-b50ab000 r--p 00009000 fc:00 508091 /lib/tls/i686/cmov/libnss_files-2.9.so
b50ab000-b50ac000 rw-p 0000a000 fc:00 508091 /lib/tls/i686/cmov/libnss_files-2.9.so
b50ac000-b50ad000 ---p b50ac000 00:00 0
b50ad000-b50bd000 rw-p b50ad000 00:00 0
b50bd000-b50be000 ---p b50bd000 00:00 0
b50be000-b50ce000 rw-p b50be000 00:00 0
b50ce000-b50d1000 r-xp 00000000 fc:00 508159 /lib/libgpg-error.so.0.3.0
b50d1000-b50d2000 rw-p 00002000 fc:00 508159 /lib/libgpg-error.so.0.3.0
b50d2000-b5138000 r-xp 00000000 fc:00 508157 /lib/libgcrypt.so.11.4.4
b5138000-b5139000 r--p 00065000 fc:00 508157 /lib/libgcrypt.so.11.4.4
b5139000-b513b000 rw-p 00066000 fc:00 508157 /lib/libgcrypt.so.11.4.4
b513b000-b514b000 r-xp 00000000 fc:00 215537 /usr/lib/libtasn1.so.3.0.16
b514b000-b514c000 r--p 0000f000 fc:00 215537 /usr/lib/libtasn1.so.3.0.16
b514c000-b514d000 rw-p 00010000 fc:00 215537 /usr/lib/libtasn1.so.3.0.16
b514d000-b51e4000 r-xp 00000000 fc:00 215341 /usr/lib/libgnutls.so.26.4.6
b51e4000-b51e9000 r--p 00097000 fc:00 215341 /usr/lib/libgnutls.so.26.4.6
b51e9000-b51ea000 rw-p 0009c000 fc:00 215341 /usr/lib/libgnutls.so.26.4.6
b51ea000-b51fc000 r-xp 00000000 fc:00 508101 /lib/tls/i686/cmov/libresolv-2.9.so
b51fc000-b51fd000 r--p 00011000 fc:00 508101 /lib/tls/i686/cmov/libresolv-2.9.so
b51fd000-b51fe000 rw-p 00012000 fc:00 508101 /lib/tls/i686/cmov/libresolv-2.9.so
b51fe000-b5200000 rw-p b51fe000 00:00 0
b5200000-b5216000 r-xp 00000000 fc:00 215374 /usr/lib/libsasl2.so.2.0.22
b5216000-b5217000 r--p 00015000 fc:00 215374 /usr/lib/libsasl2.so.2.0.22
b5217000-b5218000 rw-p 00016000 fc:00 215374 /usr/lib/libsasl2.so.2.0.22
b5218000-b5224000 r-xp 00000000 fc:00 1419910 /usr/lib/liblber-2.4.so.2.4.1
b5224000-b5225000 r--p 0000b000 fc:00 1419910 /usr/lib/liblber-2.4.so.2.4.1
b5225000-b5226000 rw-p 0000c000 fc:00 1419910 /usr/lib/liblber-2.4.so.2.4.1
b5226000-b5266000 r-xp 00000000 fc:00 1419911 /usr/lib/libldap_r-2.4.so.2.4.1
b5266000-b5267000 ---p 00040000 fc:00 1419911 /usr/lib/libldap_r-2.4.so.2.4.1
b5267000-b5268000 r--p 00040000 fc:00 1419911 /usr/lib/libldap_r-2.4.so.2.4.1
b5268000-b5269000 rw-p 00041000 fc:00 1419911 /usr/lib/libldap_r-2.4.so.2.4.1
b5269000-b526a000 rw-p b5269000 00:00 0
b526a000-b5278000 r-xp 00000000 fc:00 1263835 /home/tfrohe/node-ldapauth/ldapauth.node
b5278000-b5279000 r--p 0000d000 fc:00 1263835 /home/tfrohe/node-ldapauth/ldapauth.node
b5279000-b527a000 rw-p 0000e000 fc:00 1263835 /home/tfrohe/node-ldapauth/ldapauth.node
b527a000-b529c000 rwxp b527a000 00:00 0
b529c000-b52bc000 rw-p b529c000 00:00 0
b52bc000-b52bd000 ---p b52bc000 00:00 0
b52bd000-b5b1f000 rw-p b52bd000 00:00 0
b5b1f000-b5b3f000 rwxp b5b1f000 00:00 0
b5b3f000-b5b7f000 rw-p b5b3f000 00:00 0
b5b7f000-b6000000 ---p b5b7f000 00:00 0
b6000000-b6080000 rw-p b6000000 00:00 0
b6080000-b6800000 ---p b6080000 00:00 0
b6800000-b6880000 rw-p b6800000 00:00 0
b6880000-b7b7f000 ---p b6880000 00:00 0
b7b7f000-b7b81000 rw-p b7b7f000 00:00 0
b7b81000-b7b95000 r-xp 00000000 fc:00 508043 /lib/libz.so.1.2.3.3
b7b95000-b7b96000 r--p 00013000 fc:00 508043 /lib/libz.so.1.2.3.3
b7b96000-b7b97000 rw-p 00014000 fc:00 508043 /lib/libz.so.1.2.3.3
b7b97000-b7cf3000 r-xp 00000000 fc:00 508012 /lib/tls/i686/cmov/libc-2.9.so
b7cf3000-b7cf4000 ---p 0015c000 fc:00 508012 /liAborted

How to bind the dn in the authentication

Hi Joe,

how can i use the bind dn and password to authenticate on the Openldap server. I was used the java code and that was working fine but here i am not able to find the binddn enteries to be passed to the authenticate function. Any help would be a great help for me...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.