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.



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

def app
  @app
end

Instance Method Details

#add_app(app) ⇒ Object

Returns self and sets the target app



25
26
27
28
29
30
# 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) ⇒ 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.



20
21
22
# File 'lib/derailed_benchmarks/auth_helper.rb', line 20

def call(env)
  raise "Must subclass"
end

#setupObject

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



12
13
14
# File 'lib/derailed_benchmarks/auth_helper.rb', line 12

def setup
  raise "Must subclass"
end