/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
require 'rubygems' require 'net/ldap' username = '' password = '' ldaphost = '' basedn='' ldap = Net::LDAP.new(:host => ldaphost, :base => basedn) filter = Net::LDAP::Filter.eq('uid', username) ldap.search(:filter => filter) {|entry| username = entry.dn} ldap.auth(username, password) if ldap.bind print "YEAP"; else print "NOPE"; end