Class: Heroku::Bouncer
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Heroku::Bouncer
- Defined in:
- lib/heroku/bouncer.rb
Constant Summary collapse
- ID =
(ENV['HEROKU_OAUTH_ID'] || ENV['HEROKU_ID']).to_s
- SECRET =
(ENV['HEROKU_OAUTH_SECRET'] || ENV['HEROKU_SECRET']).to_s
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Bouncer
constructor
A new instance of Bouncer.
Constructor Details
#initialize(app, options = {}) ⇒ Bouncer
Returns a new instance of Bouncer.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/heroku/bouncer.rb', line 34 def initialize(app, = {}) if ID.empty? || SECRET.empty? $stderr.puts "[fatal] heroku-bouncer: HEROKU_OAUTH_ID or HEROKU_OAUTH_SECRET not set, middleware disabled" @app = app @disabled = true # super is not called; we're not using sinatra if we're disabled else super(app) @herokai_only = extract_option(, :herokai_only, false) @expose_token = extract_option(, :expose_token, false) @expose_email = extract_option(, :expose_email, true) @expose_user = extract_option(, :expose_user, true) end end |
Instance Method Details
#call(env) ⇒ Object
49 50 51 |
# File 'lib/heroku/bouncer.rb', line 49 def call(env) @disabled ? @app.call(env) : super(env) end |