How to use LDAP with htaccess file in rails

Can anyone help me set up LDAP using .htaccess method is Ruby on Rails. I have been looking on line for hours and there are some examples, but know examples explain where to put things in the rails directories and what file names to use. I have seen references to ruby-net-ldap as well, but the examples incomplete. Any help would be appreciated.

thanks in advance.

-Wayne

Hi!

1) First you configure your apache to read you LDAP server. Look into apache documentation: mod_auth_ldap - Apache HTTP Server I'm not sure if you can use .htaccess for this one. Try by "virtualhost" configuration.

2) After you login to site with HTTP authentication your requests should contain user credentials. Debug your seesion to see whats inside "request" object.

... or ...

You can avoid apache configuration and you write your own devise adapter that will connect to LDAP. Devise: GitHub - heartcombo/devise: Flexible authentication solution for Rails with Warden. Devise HTTP Authentication: https://github.com/plataformatec/devise/wiki/How-To:-Use-HTTP-Authentication

Hope that this helps you :slight_smile:

- Oto