Gist 5600900
✓ Published0🌍 Public
Aafbroman
Last edited Jul 26, 2009
Created on May 17, 2013
This example demonstrates a minimal Ruby script for authenticating a user against an LDAP directory using the ActiveLDAP library. It shows the setup of an LDAP connection to a specified host and base DN, followed by a `User` class that defines an `authenticate` method, which finds an entry by distinguished name and attempts to bind with the provided password. The script rescues specific LDAP errors, returning `nil` on failure, and includes a test call at the bottom that prints the authentication result for hardcoded credentials.
AI-generated description