Module: AuthlogicCrowdRest::Session::Methods

Defined in:
lib/authlogic_crowd_rest/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/authlogic_crowd_rest/session.rb', line 60

def self.included(klass)
  klass.class_eval do
    validate :validate_by_crowd_rest, :if => :authenticating_with_crowd_rest?
    attr_accessor :crowd_login
    attr_accessor :crowd_password
  end
end

Instance Method Details

#credentialsObject

Hooks into credentials so that you can pass an :ldap_login and :ldap_password key. Hooks into credentials to print out meaningful credentials for LDAP authentication.



70
71
72
73
74
75
76
77
78
79
# File 'lib/authlogic_crowd_rest/session.rb', line 70

def credentials
  if authenticating_with_crowd_rest?
    details = {}
    details[:crowd_login] = 
    details[:crowd_password] = "<protected>"
    details
  else
    super
  end
end

#credentials=(value) ⇒ Object



81
82
83
84
85
86
87
88
89
# File 'lib/authlogic_crowd_rest/session.rb', line 81

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