Module: WizAuthc::AuthcRealm::ClassMethods
- Defined in:
- lib/wizdog/authc/realm/authc_realm.rb
Instance Method Summary collapse
Instance Method Details
#authenticate(token, remembered = false) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wizdog/authc/realm/authc_realm.rb', line 18 def authenticate(token, remembered = false) user = find_one_by_principal(token.principal) info = AuthcInfo.new() if user && user.authenticate(token.credentials) info.principal = {:identity => user.id, :type => user.class} info.credentials = token.credentials info.authenticated = true end return info end |
#find_one_by_principal(principal) ⇒ Object
14 15 16 |
# File 'lib/wizdog/authc/realm/authc_realm.rb', line 14 def find_one_by_principal(principal) first(:conditions => {:login => principal}) end |