cschiewek / devise_ldap_authenticatable

Devise Module for LDAP
MIT License
594 stars 359 forks source link

HTTP AUTH fix for ldap authenticatable #145

Open shotty01 opened 11 years ago

shotty01 commented 11 years ago

Hi,

I was in need to authenticate via basic auth (for api use) through ldap. Devise has a flag http_authenticatable which when set to true, reads the HTTP Headers and provides the data.

A very small change in the code is necesary in the strategy LdapAuthenticatable to get this to work.

replace

resource = valid_password? && mapping.to.authenticate_with_ldap(params[scope])

with

resource = valid_password? && mapping.to.authenticate_with_ldap(authentication_hash.merge(:password => password))

At the moment I got it patched in a initializer, but it would be great if you could add this to the gem directly

tia, Shotty

cschiewek commented 11 years ago

Submit a PR and if tests passed, I'll merge it ASAP.

shotty01 commented 11 years ago

actually, i just noted that u already have integrated a pull request for this 4 months ago in your master ( https://github.com/cschiewek/devise_ldap_authenticatable/pull/80) It's just missing in the 0.7.0 (last release for Rails 3) of your gem

2013/10/28 Curtis Schiewek notifications@github.com

Submit a PR and if tests passed, I'll merge it ASAP.

— Reply to this email directly or view it on GitHubhttps://github.com/cschiewek/devise_ldap_authenticatable/issues/145#issuecomment-27206293 .

cschiewek commented 11 years ago

Cool. I'll try and get a 0.7.1 with this patch in it as soon as I can.

Thanks!

shotty01 commented 11 years ago

did a pull request anyway for 0.7 :)

cschiewek commented 11 years ago

You rule! :+1: