Reputation: 3509
I am trying to login using LDAP and Devise, but it does not work for some reason.
In my LDAP file I only have:
host: xxxxxxxx
port: 389
attribute: uid
base: ou=Students, dc=xxx, dc=xx, dc=xx
ssl: false
My model is called User though.
Is it normal for the query that Devise makes on its own to be ... ?
SELECT "users".* FROM "users" WHERE "users"."username" = 'xxxx' LIMIT 1
I really couldn't find documentation on this. Could you please help?
Upvotes: 1
Views: 1028
Reputation: 3509
For anyone as confused about LDAP as I am, the answer is: yes, it is normal.
Maybe I should have mentioned that I was talking about the devise_ldap_authenticatable gem in my original question. My bad.
In the config/initializers/devise.rb
file you will find the configuration file for devise
and devise_ldap_authenticatable
, where there will be a line sort of like:
config.ldap_create_user = false (by default)
If this is changed to true, then it will create a user in the local database whenever a successful login has occurred. This is why the SQL statement in the first post exists, it is just looking to see if the user is already saved. The odd thing about it is that it executes and displays the statement even if the ldap_create_user
option is false.
Upvotes: 2