[RAILS] LDAP authentication with devise
If LDAP authentication is by username (not email), add to Devise the possibility to login with username:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-with-something-other-than-their-email-address
Add to Gemfile the gem net-ldap:
https://rubygems.org/gems/net-ldap/versions/0.15.0 https://github.com/ruby-ldap/ruby-net-ldap
gem 'net-ldap', '~> 0.15.0'
Follow the instructions on:
https://github.com/plataformatec/devise/wiki/How-To:-Authenticate-via-LDAP
In config/initializers/ldap_authenticatable.rb
replace:
[YOUR LDAP HOSTNAME]
[YOUR LDAP HOSTNAME PORT] # 389 default port