Module AuthlogicOpenid::Session::Methods

  1. lib/authlogic_openid/session.rb

Methods

public class

  1. included

public instance

  1. credentials=
  2. openid_identifier=
  3. save

Public class methods

included (klass)
[show source]
# File lib/authlogic_openid/session.rb, line 34
      def self.included(klass)
        klass.class_eval do
          attr_reader :openid_identifier
          validate :validate_openid_error
          validate :validate_by_openid, :if => :authenticating_with_openid?
        end
      end

Public instance methods

credentials= (value)

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

[show source]
# File lib/authlogic_openid/session.rb, line 43
      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
openid_identifier= (value)
[show source]
# File lib/authlogic_openid/session.rb, line 50
      def openid_identifier=(value)
        @openid_identifier = value.blank? ? nil : OpenIdAuthentication.normalize_identifier(value)
        @openid_error = nil
      rescue OpenIdAuthentication::InvalidOpenId => e
        @openid_identifier = nil
        @openid_error = e.message
      end
save (&block)

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

[show source]
# File lib/authlogic_openid/session.rb, line 60
      def save(&block)
        block = nil if !openid_identifier.blank?
        super(&block)
      end