Devise LDAP Multiple
This project is a fork of the brilliant project devise_ldap_authenticatable here: (https://github.com/cschiewek/devise_ldap_authenticatable).
The difference is that this project allows you to use multiple LDAP databases in a single app, and the code was refactored significantly while adding this feature.
Devise LDAP Multiple is a LDAP based authentication strategy for the Devise authentication framework.
If you are building applications for use within your organization which require authentication and you want to use LDAP, this plugin is for you.
Devise LDAP Multiple works in replacement of Database Authenticatable. This devise plugin has not been tested with DatabaseAuthenticatable enabled at the same time. This is meant as a drop in replacement for DatabaseAuthenticatable allowing for a semi single sign on approach.
Prerequisites
- devise ~> 3.0.0 (which requires rails ~> 4.0)
- net-ldap ~> 0.6.0
If you are transitioning from having Devise manage your users' passwords in the database to using LDAP auth, you may have to update your users
table to make encrypted_password
nullable, or else the LDAP user insert will fail.
Usage
In the Gemfile for your application:
gem "devise_ldap_multiple"
To get the latest version, pull directly from github instead of the gem:
gem "devise_ldap_multiple", :git => "https://github.com/xarael/devise_ldap_multiple"
Setup
Run the rails generators for devise (please check the devise documents for further instructions)
rails generate devise:install
rails generate devise MODEL_NAME
Run the rails generator for devise_ldap_multiple
rails generate devise_ldap_multiple:install
rails generate devise_ldap_multiple [MODEL_NAME]
MODEL_NAME defaults to: user
This will install [MODEL_NAME].yml file to the config/ldap/ directory, update the devise.rb initializer with a default scope (default), and update your model.
All configuration is set within these .yml files for each model. There's comments in the files to describe the various settings.
References
Released under the MIT license
Copyright (c) 2016 Scott Willett