Class: ThreeScale::Middleware

Inherits:
Rack::Auth::Basic
  • Object
show all
Defined in:
lib/3scale/middleware.rb

Defined Under Namespace

Classes: AppIdAuthenticator, NilAuthenticator, UserKeyAuthenticator

Constant Summary collapse

DEFAULT_OPTIONS =
{ secure: true, persistent: true }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, provider_key, mode, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



12
13
14
15
16
17
# File 'lib/3scale/middleware.rb', line 12

def initialize(app, provider_key, mode, options = {})
  options = DEFAULT_OPTIONS.merge(options).merge(provider_key: provider_key)
  @client = ThreeScale::Client.new(options)

  super(app, '3scale Authentication', &authenticator_for(mode))
end

Instance Attribute Details

#authenticatorObject (readonly)

Returns the value of attribute authenticator.



8
9
10
# File 'lib/3scale/middleware.rb', line 8

def authenticator
  @authenticator
end

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/3scale/middleware.rb', line 8

def client
  @client
end