class Rampart::Proxy
Public Class Methods
new(strategy_manager, session, user_store)
click to toggle source
# File lib/rampart/proxy.rb, line 3 def initialize(strategy_manager, session, user_store) @strategy_manager = strategy_manager @session = session @user_store = user_store end
Public Instance Methods
authenticate(*names)
click to toggle source
# File lib/rampart/proxy.rb, line 19 def authenticate(*names) event = @strategy_manager.authenticate!(*names) if event.success? set_user(event.user) event.user else nil end end
authenticate!(*names)
click to toggle source
# File lib/rampart/proxy.rb, line 9 def authenticate!(*names) event = @strategy_manager.authenticate!(*names) if event.success? set_user(event.user) event.user else throw(:rampart, event.to_truple) end end
logout()
click to toggle source
# File lib/rampart/proxy.rb, line 29 def logout @session.delete end
set_user(user)
click to toggle source
# File lib/rampart/proxy.rb, line 37 def set_user(user) @user_store.store(user) end
user_id()
click to toggle source
# File lib/rampart/proxy.rb, line 33 def user_id @session.fetch end