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



52
53
54
55
56
# File 'lib/authlogic_oauth2/session.rb', line 52

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.



59
60
61
62
63
64
# File 'lib/authlogic_oauth2/session.rb', line 59

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



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

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.



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

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