nbudin / devise_cas_authenticatable

CAS authentication support for Devise
MIT License
285 stars 117 forks source link

NoMethodError in Devise::CasSessionsController#service #121

Closed aaronshim closed 8 years ago

aaronshim commented 8 years ago

I am trying out cas authentication in the Rails 5 beta 3 release, but I keep running into this error when I attempt to do anything that handles authentication.

undefined method `encrypted_password_changed?' for #<AdminUser:0x0000000676d508>

and the full stack trace

activemodel (5.0.0.beta3) lib/active_model/attribute_methods.rb:433:in `method_missing'
/home/aaron/.rvm/gems/ruby-2.3.0/bundler/gems/devise-342304375946/lib/devise/models/recoverable.rb:31:in `block (2 levels) in <module:Recoverable>'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:396:in `instance_exec'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:396:in `block in make_lambda'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:769:in `catch'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:170:in `block in halting'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:454:in `block in call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:454:in `each'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:454:in `call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:750:in `_run_update_callbacks'
activerecord (5.0.0.beta3) lib/active_record/callbacks.rb:306:in `_update_record'
activerecord (5.0.0.beta3) lib/active_record/timestamp.rb:81:in `_update_record'
activerecord (5.0.0.beta3) lib/active_record/persistence.rb:534:in `create_or_update'
activerecord (5.0.0.beta3) lib/active_record/callbacks.rb:298:in `block in create_or_update'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
activerecord (5.0.0.beta3) lib/active_record/callbacks.rb:298:in `create_or_update'
activerecord (5.0.0.beta3) lib/active_record/suppressor.rb:41:in `create_or_update'
activerecord (5.0.0.beta3) lib/active_record/persistence.rb:125:in `save'
activerecord (5.0.0.beta3) lib/active_record/validations.rb:44:in `save'
activerecord (5.0.0.beta3) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:319:in `block (2 levels) in save'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
activerecord (5.0.0.beta3) lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `block in transaction'
activerecord (5.0.0.beta3) lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
activerecord (5.0.0.beta3) lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:211:in `transaction'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:319:in `block in save'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
activerecord (5.0.0.beta3) lib/active_record/transactions.rb:318:in `save'
devise_cas_authenticatable (1.7.1) lib/devise_cas_authenticatable/model.rb:40:in `authenticate_with_cas_ticket'
devise_cas_authenticatable (1.7.1) lib/devise_cas_authenticatable/strategy.rb:19:in `authenticate!'
warden (1.2.6) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.2.6) lib/warden/proxy.rb:358:in `block in _run_strategies_for'
warden (1.2.6) lib/warden/proxy.rb:353:in `each'
warden (1.2.6) lib/warden/proxy.rb:353:in `_run_strategies_for'
warden (1.2.6) lib/warden/proxy.rb:323:in `_perform_authentication'
warden (1.2.6) lib/warden/proxy.rb:127:in `authenticate!'
devise_cas_authenticatable (1.7.1) app/controllers/devise/cas_sessions_controller.rb:15:in `service'
actionpack (5.0.0.beta3) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.0.beta3) lib/abstract_controller/base.rb:183:in `process_action'
actionpack (5.0.0.beta3) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.0.beta3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.beta3) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.beta3) lib/action_controller/metal/rescue.rb:27:in `process_action'
actionpack (5.0.0.beta3) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (5.0.0.beta3) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.beta3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.beta3) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.beta3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (5.0.0.beta3) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.0.beta3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.0.beta3) lib/abstract_controller/base.rb:128:in `process'
actionview (5.0.0.beta3) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.0.beta3) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.beta3) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.beta3) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.beta3) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.beta3) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.0.0.beta3) lib/action_dispatch/routing/mapper.rb:47:in `serve'
actionpack (5.0.0.beta3) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.beta3) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.beta3) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.beta3) lib/action_dispatch/routing/route_set.rb:724:in `call'
devise_cas_authenticatable (1.7.1) lib/devise_cas_authenticatable/single_sign_out/rack.rb:14:in `call'
actionview (5.0.0.beta3) lib/action_view/digestor.rb:12:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.0.alpha) lib/rack/etag.rb:25:in `call'
rack (2.0.0.alpha) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.0.alpha) lib/rack/head.rb:12:in `call'
rack (2.0.0.alpha) lib/rack/session/abstract/id.rb:220:in `context'
rack (2.0.0.alpha) lib/rack/session/abstract/id.rb:214:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.0.beta3) lib/active_record/query_cache.rb:36:in `call'
activerecord (5.0.0.beta3) lib/active_record/connection_adapters/abstract/connection_pool.rb:963:in `call'
activerecord (5.0.0.beta3) lib/active_record/migration.rb:558:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.beta3) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/reloader.rb:71:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.beta3) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.beta3) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.beta3) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.beta3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.beta3) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.beta3) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.0.alpha) lib/rack/method_override.rb:22:in `call'
rack (2.0.0.alpha) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.beta3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/load_interlock.rb:13:in `call'
actionpack (5.0.0.beta3) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.0.alpha) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.beta3) lib/rails/engine.rb:522:in `call'
puma (3.0.2) lib/puma/configuration.rb:221:in `call'
puma (3.0.2) lib/puma/server.rb:561:in `handle_request'
puma (3.0.2) lib/puma/server.rb:406:in `process_client'
puma (3.0.2) lib/puma/server.rb:271:in `block in run'
puma (3.0.2) lib/puma/thread_pool.rb:111:in `block in spawn_thread'

What should I define to fix the encrypted_password_changed? error?

nbudin commented 8 years ago

Hi @aaronshim, so sorry to hear about the issue! Based on this traceback, it looks like the error is originating in Devise itself, not devise_cas_authenticatable. Would you mind reporting it in https://github.com/plataformatec/devise instead?

aaronshim commented 8 years ago

https://github.com/plataformatec/devise/issues/3624 suggests a quick fix. We can create the fields password and encrypted_password in the user/account model, and that happens to fix this behavior for the time being.

aaronshim commented 8 years ago

@nbudin , thank you for your help! :)

nbudin commented 8 years ago

Interesting - it seems given that Devise issue as if it's a general issue for Devise 3.5 upgrades that don't use the password_authenticatable module. I'll definitely keep this in mind if I hear any further questions that sound like they might be related to this.

Thanks for the update!