class DerailedBenchmarks::AuthHelper

Base helper class. Can be used to authenticate different strategies The root app will be wrapped by an authentication action

Attributes

app[R]

Public Instance Methods

add_app(app) click to toggle source

Returns self and sets the target app

# File lib/derailed_benchmarks/auth_helper.rb, line 25
def add_app(app)
  raise "App is required argument" unless app
  @app = app
  setup
  self
end
call(env) click to toggle source

Gets called for every request. Place all auth logic here. Return value is expected to be an valid Rack response array. If you do not manually ‘app.call(env)` here, the client app will never be called.

# File lib/derailed_benchmarks/auth_helper.rb, line 20
def call(env)
  raise "Must subclass"
end
setup() click to toggle source

Put any coded needed to set up or initialize your authentication module here

# File lib/derailed_benchmarks/auth_helper.rb, line 12
def setup
  raise "Must subclass"
end