Skip to content

Instantly share code, notes, and snippets.

@ajmorris
Created November 17, 2008 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajmorris/25905 to your computer and use it in GitHub Desktop.
Save ajmorris/25905 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'net/ldap'
module Merb::Authentication::Strategies
class AtLdap < Merb::Authentication::Strategy
def run!( login, password )
initialize_ldap_connection unless @ldap
@ldap.bind_as(
:base => "cn=#{login},ou=cats,o=gwu",
:filter => Net::LDAP::Filter.eq( "sn", "*" ),
:scope => Net::LDAP::SearchScope_BaseObject,
:password => password
)
end
def initialize_ldap_connection
@ldap = Net::LDAP.new
@ldap.host = '128.164.60.16'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment