jonmbake/discourse-ldap-auth

ldap_error: NoMethodError, undefined method `omit_username='

Closed this issue · 3 comments

jmcm1 commented

I recently updated our discourse instance to 2.8.0.beta10 (from 2.8.0.beta6) and ldap authentication is no longer working. Looking in shared/standalone/log/rails/production.log I find the following error which appears to be new with the update. This happens with both 0.4.1 and 0.5.0.

(ldap) Callback phase initiated.
Processing by Users::OmniauthCallbacksController#complete as HTML
Parameters: {"username"=>"jmcm1", "password"=>"[FILTERED]", "provider"=>"ldap"}
Completed 500 Internal Server Error in 13ms (ActiveRecord: 0.0ms | Allocations: 1471)
(ldap) Authentication failure! ldap_error: NoMethodError, undefined method `omit_username=' for #Auth::Result:0x00007f8c071aa5f0

All LDAP login attempts fail with "Sorry, there was an error authorizing your account. Please try again."

Thanks for opening the issue, @jmcm1 . Looks like this was caused by a change to the Discourse API here: discourse/discourse@cdf4d71#diff-7a57a174ea83f2458c3dda7e72d1ea8deca7715a7eff52a95f1d8795433d134aL18.

I'll add a comment to the Discourse issue to let them know. I think ideally they would deprecate the old method name to give plugins a chance to upgrade. We may have to update this plugin to use overrides_username instead of omit_username.

Fixed by #67

jmcm1 commented

Thank you. I have run a rebuild and LDAP authentication now works. Have a safe and happy new year.