class ThreeScale::Middleware
Constants
- DEFAULT_OPTIONS
Attributes
authenticator[R]
client[R]
Public Class Methods
new(app, provider_key, mode, options = {})
click to toggle source
Calls superclass method
# 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
Private Instance Methods
authenticator_for(mode)
click to toggle source
# File lib/3scale/middleware.rb, line 21 def authenticator_for(mode) klass = case mode when :user_key then UserKeyAuthenticator when :app_id then AppIdAuthenticator when nil then NilAuthenticator else raise "Unknown auth mode #{mode}" end klass.new(@client) end