I followed 'https://github.com/cschiewek/devise_ldap_authenticatable'
The error I got on Rails console
LDAP: LDAP search yielded 0 matches
LDAP: Not authorized because not authenticated.
Completed 401 Unauthorized in 19ms
I tried to run the ldap setting on another Rails app 'redmine'
Redmine works
ldap.yml
development:
host: dc01.toshiba.tw
port: 389
attribute: sAMAccountName
base: dc=toshiba,dc=tw
admin_user: redmine.rd@toshiba.tw
admin_password: adminredmine
ssl: false
# <<: *AUTHORIZATIONS
Login page
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.text_field :email, autofocus: true %></div>
devise.rb
Devise.setup do |config|
# ==> LDAP Configuration
# config.ldap_logger = true
config.ldap_create_user = true
# config.ldap_update_password = true
config.ldap_config = "#{Rails.root}/config/ldap.yml"
# config.ldap_check_group_membership = false
# config.ldap_check_attributes = true
# config.ldap_use_admin_to_bind = true
# config.ldap_ad_group_check = false