Class: ASF::Auth::Committers

Inherits:
Rack::Auth::Basic
  • Object
show all
Defined in:
lib/whimsy/asf/rack.rb

Overview

‘use’ the following class in config.ru to limit access to the application to ASF committers

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Committers

Returns a new instance of Committers.



42
43
44
# File 'lib/whimsy/asf/rack.rb', line 42

def initialize(app)
  super(app, "ASF Committers", &proc {})
end

Instance Method Details

#call(env) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/whimsy/asf/rack.rb', line 46

def call(env)
  authorized = ( ENV['RACK_ENV'] == 'test' )

  authorized ||= ASF::Auth.decode(env).asf_committer?

  if authorized
    @app.call(env)
  else
    unauthorized
  end
end