Class: Rampart::Auth
- Inherits:
-
Object
- Object
- Rampart::Auth
- Defined in:
- lib/rampart/auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, strategies: {}, serializer: Proc.new{|u| u.id}, session_key: "rampart_session_id") ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(app, strategies: {}, serializer: Proc.new{|u| u.id}, session_key: "rampart_session_id") ⇒ Auth
Returns a new instance of Auth.
8 9 10 11 12 13 |
# File 'lib/rampart/auth.rb', line 8 def initialize(app, strategies: {}, serializer: Proc.new{|u| u.id}, session_key: "rampart_session_id") @app = app @strategies = strategies @serializer = serializer @session_key = session_key end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rampart/auth.rb', line 15 def call(env) strategy_manager = StrategyManager.new(env) @strategies.each { |k,v| strategy_manager.register(k,v) } proxy = Proxy.new(strategy_manager, Session.new(env), UserStore.new(Session.new(env), @serializer)) env["rampart"] = proxy catch(:rampart) do @app.call(env) end end |