Module: AuthlogicCrowd::Session
- Defined in:
- lib/authlogic_crowd/session.rb
Defined Under Namespace
Modules: Config, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/authlogic_crowd/session.rb', line 3 def self.included(klass) klass.class_eval do extend Config include InstanceMethods attr_accessor :new_registration persist :persist_by_crowd, :if => :authenticating_with_crowd? validate :validate_by_crowd, :if => [:authenticating_with_crowd?, :needs_crowd_validation?] before_destroy :logout_of_crowd, :if => :authenticating_with_crowd? before_persisting {|s| s.instance_variable_set('@persisted_by_crowd', false)} after_persisting(:if => [:authenticating_with_crowd?, :persisted_by_crowd?, :explicit_login_from_crowd_token?], :unless => :new_registration?) do |s| # The user was persisted via a crowd token (not an explicit login via username/password). # Simulate explicit login by executing "save" callbacks. s.before_save s.new_session? ? s.before_create : s.before_update s.new_session? ? s.after_create : s.after_update s.after_save end after_create(:if => :authenticating_with_crowd?, :unless => :new_registration?) do |s| synchronizer = s.crowd_synchronizer synchronizer.local_record = s.record synchronizer.crowd_record = s.crowd_record synchronizer.sync_from_crowd end end end |