Module: Authlogic::ActsAsAuthentic::RestfulAuthentication::Config

Defined in:
lib/authlogic/acts_as_authentic/restful_authentication.rb

Overview

Configures the restful_authentication aspect of acts_as_authentic. These methods become class methods of ::ActiveRecord::Base.

Constant Summary collapse

DPR_MSG =
<<~STR.squish
  Support for transitioning to authlogic from restful_authentication
  (%s) is deprecated without replacement. restful_authentication is no
  longer used in the ruby community, and the transition away from it is
  complete. There is only one version of restful_authentication on
  rubygems.org, it was released in 2009, and it's only compatible with
  rails 2.3. It has been nine years since it was released.
STR

Instance Method Summary collapse

Instance Method Details

#act_like_restful_authentication(value = nil) ⇒ Object

Switching an existing app to Authlogic from restful_authentication? No problem, just set this true and your users won’t know anything changed. From your database perspective nothing will change at all. Authlogic will continue to encrypt passwords just like restful_authentication, so your app won’t skip a beat. Although, might consider transitioning your users to a newer and stronger algorithm. Checkout the transition_from_restful_authentication option.

  • Default: false

  • Accepts: Boolean



35
36
37
38
39
# File 'lib/authlogic/acts_as_authentic/restful_authentication.rb', line 35

def act_like_restful_authentication(value = nil)
  r = rw_config(:act_like_restful_authentication, value, false)
  set_restful_authentication_config if value
  r
end

#act_like_restful_authentication=(value = nil) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/authlogic/acts_as_authentic/restful_authentication.rb', line 41

def act_like_restful_authentication=(value = nil)
  ::ActiveSupport::Deprecation.warn(
    format(DPR_MSG, "act_like_restful_authentication="),
    caller(1)
  )
  act_like_restful_authentication(value)
end

#transition_from_restful_authentication(value = nil) ⇒ Object

This works just like act_like_restful_authentication except that it will start transitioning your users to the algorithm you specify with the crypto provider option. The next time they log in it will resave their password with the new algorithm and any new record will use the new algorithm as well. Make sure to update your users table if you are using the default migration since it will set crypted_password and salt columns to a maximum width of 40 characters which is not enough.



56
57
58
59
60
# File 'lib/authlogic/acts_as_authentic/restful_authentication.rb', line 56

def transition_from_restful_authentication(value = nil)
  r = rw_config(:transition_from_restful_authentication, value, false)
  set_restful_authentication_config if value
  r
end

#transition_from_restful_authentication=(value = nil) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/authlogic/acts_as_authentic/restful_authentication.rb', line 62

def transition_from_restful_authentication=(value = nil)
  ::ActiveSupport::Deprecation.warn(
    format(DPR_MSG, "transition_from_restful_authentication="),
    caller(1)
  )
  transition_from_restful_authentication(value)
end