I am trying to write an authentication strategy for authentication against an existing deprecated API. I do not have a database, so I cannot transfer users from some existing source. I want to do something like:
http://4trabes.com/2012/10/31/remote-authentication-with-devise/
However, after following these instructions, Devise refuses to invoke my authentication strategy. I tested this by trying to insert puts calls into my RemoteAuthenticatable modules ...
Peter.
EDIT add code as requested.
application / models / User.rb:
class User attr_accessor :id include ActiveModel::Validations #required because some before_validations are defined in devise extend ActiveModel::Callbacks #required to define callbacks extend Devise::Models define_model_callbacks :validation #required by Devise devise :remote_authenticatable end
lib / remote_authenticatable.rb (pay attention to the insets I marked to get tracking of poor people).
module Devise module Models module RemoteAuthenticatable extend ActiveSupport::Concern
and the code that I added to config / initializers / devise.rb
require 'remote_authenticatable' config.warden do |manager| manager.strategies.add(:remote, Devise::Strategies::RemoteAuthenticatable) manager.default_strategies(:scope => :user).unshift :remote end Devise.add_module :remote_authenticatable, :controller => :sessions, :route => { :session => :routes }
source share