Class: Rack::Webauth
- Inherits:
-
Object
- Object
- Rack::Webauth
- Defined in:
- lib/rack-webauth.rb
Overview
Usage in any rack based app:
# In a rack environment:
use(Rack::Webauth)
# In a view or controller:
include(Rack::Webauth::Helpers)
# In a before filter or helper
# or other middleware:
@current_user = User.find_by_login(webauth.login)
# or whatever...
Usage in rails:
# config/application.rb:
require 'rack-webauth'
config.middleware.use(Rack::Webauth)
# ApplicationController:
include(Rack::Webauth::Helpers)
# optionally:
delegate :logged_in?, :to => :webauth
Defined Under Namespace
Modules: Helpers Classes: Info
Constant Summary
- ANONYMOUS =
Anonymous login name (if WebAuthOptional is set) Requires webauth patch.
"<anonymous>"- NS =
Namespace for rack environment
"x-rack.webauth-info"
Instance Method Summary (collapse)
-
- (Object) call(env)
put new Info object in env, then continue.
-
- (Webauth) initialize(app)
constructor
A new instance of Webauth.
Constructor Details
- (Webauth) initialize(app)
A new instance of Webauth
36 37 38 |
# File 'lib/rack-webauth.rb', line 36 def initialize(app) @app = app end |
Instance Method Details
- (Object) call(env)
put new Info object in env, then continue.
41 42 43 44 |
# File 'lib/rack-webauth.rb', line 41 def call(env) env[NS] = Rack::Webauth::Info.new(env) @app.call(env) end |