jonmbake / discourse-ldap-auth

Discourse plugin to enable LDAP/Active Directory authentication.
MIT License
70 stars 53 forks source link

ldap_error: NoMethodError, undefined method `omit_username=' #66

Closed jmcm1 closed 2 years ago

jmcm1 commented 2 years ago

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 #

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

jonmbake commented 2 years ago

Thanks for opening the issue, @jmcm1 . Looks like this was caused by a change to the Discourse API here: https://github.com/discourse/discourse/commit/cdf4d7156ee6ec5469702ad1719677d03cc8b9b0#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.

jonmbake commented 2 years ago

Fixed by https://github.com/jonmbake/discourse-ldap-auth/pull/67

jmcm1 commented 2 years ago

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