Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Authenticate via LDAP with Ruby
# Using an LDAP test server we will authenticate the user newton
# requires net-ldap gem
require 'net/ldap'
ldap = = ''
ldap.auth "uid=newton,dc=example,dc=com", "password"
if ldap.bind
puts 'authentication succeeded'
puts 'authentication failed'
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.