Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Authenticate via LDAP with Ruby
# Using an LDAP test server we will authenticate the user newton
# http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/
# requires net-ldap gem
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = 'ldap.forumsys.com'
ldap.auth "uid=newton,dc=example,dc=com", "password"
if ldap.bind
puts 'authentication succeeded'
else
puts 'authentication failed'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.