Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added clarifying documentation parameters to #bind.

  • Loading branch information...
commit e6cccef62780a84fa99f8ffa7efdb9ad40e6b20d 1 parent b828ff5
authored October 23, 2007

Showing 1 changed file with 17 additions and 0 deletions. Show diff stats Hide diff stats

  1. 17  lib/net/ldap.rb
17  lib/net/ldap.rb
@@ -709,6 +709,23 @@ def search args = {}
709 709
     #    p ldap.get_operation_result
710 710
     #  end
711 711
     #
  712
+    # Here's a more succinct example which does exactly the same thing, but
  713
+    # collects all the required parameters into arguments:
  714
+    #
  715
+    #  require 'net/ldap'
  716
+    #  ldap = Net::LDAP.new( :host=>your_server_ip_address, :port=>389 )
  717
+    #  if ldap.bind( :method=>:simple, :username=>your_user_name, :password=>your_user_password )
  718
+    #    # authentication succeeded
  719
+    #  else
  720
+    #    # authentication failed
  721
+    #    p ldap.get_operation_result
  722
+    #  end
  723
+    #
  724
+    # You don't need to pass a user-password as a String object to bind. You can
  725
+    # also pass a Ruby Proc object which returns a string. This will cause bind to
  726
+    # execute the Proc (which might then solicit input from a user with console display
  727
+    # suppressed). The String value returned from the Proc is used as the password.
  728
+    #
712 729
     # You don't have to create a new instance of Net::LDAP every time
713 730
     # you perform a binding in this way. If you prefer, you can cache the Net::LDAP object
714 731
     # and re-use it to perform subsequent bindings, <i>provided</i> you call

0 notes on commit e6cccef

Please sign in to comment.
Something went wrong with that request. Please try again.