class Rack::UrlAuth
Constants
- VERSION
Attributes
app[R]
forward_auth[R]
signer[R]
Public Class Methods
new(app, opts = {})
click to toggle source
# File lib/rack/url_auth.rb, line 9 def initialize(app, opts = {}) secret = opts[:secret] or raise(ArgumentError, 'Please provide `secret`') @app = app @signer = Signer.new(secret) @forward_auth = !!opts[:forward_auth] end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/url_auth.rb, line 18 def call(env) proxy = env['rack.signature_auth'] = Proxy.new(env, signer) if !@forward_auth && !proxy.authorized? [403, {}, ['Forbidden']] else @app.call(env) end end