Class: DerailedBenchmarks::AuthHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/derailed_benchmarks/auth_helper.rb

Overview

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

Direct Known Subclasses

DerailedBenchmarks::AuthHelpers::Devise

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



7
8
9
# File 'lib/derailed_benchmarks/auth_helper.rb', line 7

def app
  @app
end

Instance Method Details

#add_app(app) ⇒ Object

Returns self and sets the target app



23
24
25
26
27
28
# File 'lib/derailed_benchmarks/auth_helper.rb', line 23

def add_app(app)
  raise "App is required argument" unless app
  @app = app
  setup
  self
end

#call(env) ⇒ Object

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.



18
19
20
# File 'lib/derailed_benchmarks/auth_helper.rb', line 18

def call(env)
  raise "Must subclass"
end

#setupObject

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



10
11
12
# File 'lib/derailed_benchmarks/auth_helper.rb', line 10

def setup
  raise "Must subclass"
end