Module: AuthlogicConnect::Openid::Session::InstanceMethods

Includes:
Process
Defined in:
lib/authlogic_connect/openid/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Process

#cleanup_openid_session, #restore_attributes, #save_openid_session

Methods included from Variables

#openid_identifier, #openid_provider

Methods included from AuthlogicConnect::Openid::State

#allow_openid_redirect?, #openid_identifier?, #openid_provider?, #openid_request?, #openid_response?, #redirecting_to_openid_server?, #using_openid?, #validate_password_with_openid?

Class Method Details

.included(klass) ⇒ Object



14
15
16
17
18
19
# File 'lib/authlogic_connect/openid/session.rb', line 14

def self.included(klass)
  klass.class_eval do
    validate :validate_openid_error
    validate :validate_by_openid, :if => :authenticating_with_openid?
  end
end

Instance Method Details

#credentials=(value) ⇒ Object

Hooks into credentials so that you can pass an :openid_identifier key.



22
23
24
25
26
27
# File 'lib/authlogic_connect/openid/session.rb', line 22

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

#save_with_openid(&block) ⇒ Object

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



31
32
33
34
# File 'lib/authlogic_connect/openid/session.rb', line 31

def save_with_openid(&block)
  block = nil if Token.find_by_key(openid_identifier.normalize_identifier)
  return block.nil?
end