class ASF::Auth::Committers

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

Public Class Methods

new(app) click to toggle source

Specify ‘ASF Committers’ as the HTTP auth Realm

Calls superclass method
# File lib/whimsy/asf/rack.rb, line 36
def initialize(app)
  super(app, 'ASF Committers', &proc {})
end

Public Instance Methods

call(env) click to toggle source

Returns unauthorized unless running in test mode or the authenticated user is an ASF Committer

# File lib/whimsy/asf/rack.rb, line 42
def call(env)
  authorized = ( ENV['RACK_ENV'] == 'test' )

  # Must always call decode as it adds required accessors
  person = ASF::Auth.decode(env)

  authorized ||= person.asf_committer?

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