Module: AuthlogicOauth2::Session::Methods

Includes:
Oauth2Process
Defined in:
lib/authlogic_oauth2/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



57
58
59
60
61
# File 'lib/authlogic_oauth2/session.rb', line 57

def self.included(klass)
  klass.class_eval do
    validate :validate_by_oauth2, :if => :authenticating_with_oauth2?
  end
end

Instance Method Details

#credentials=(value) ⇒ Object

Hooks into credentials so that you can pass a user who has already has an oauth2 access token.



64
65
66
67
68
69
# File 'lib/authlogic_oauth2/session.rb', line 64

def credentials=(value)
  super
  values = value.is_a?(Array) ? value : [value]
  hash = values.first.is_a?(Hash) ? values.first.with_indifferent_access : nil
  self.record = hash[:priority_record] if !hash.nil? && hash.key?(:priority_record)
end

#record=(record) ⇒ Object



71
72
73
# File 'lib/authlogic_oauth2/session.rb', line 71

def record=(record)
  @record = record
end

#save(&block) ⇒ Object

Clears out the block if we are authenticating with oauth2, so that we can redirect without a DoubleRender error.



77
78
79
80
# File 'lib/authlogic_oauth2/session.rb', line 77

def save(&block)
  block = nil if redirecting_to_oauth2_server?
  super(&block)
end