rob-murray / ferver

A Ruby gem to serve files over HTTP, packaged as a Ruby gem
MIT License
14 stars 3 forks source link

Basic Auth #9

Open rob-murray opened 10 years ago

rob-murray commented 10 years ago

How about adding capability of Basic Auth? By default is off, if a config file is present then take credentials and authenticate URIs with Basic Auth?

dkam commented 9 years ago

Hi Rob, I've had a first go at this. I've put the credentials in as arguments. Password could probably be pulled in from the environment rather than being put on the command line. Also, I'm happy to take a go at adding a config file. Maybe something using yaml or yaml/store ?

dkam commented 9 years ago

Hi Rob - I scrapped the first go at this. Here's my second take:

https://github.com/dkam/ferver/tree/basic_auth_take_2

I can send it as a pull request if that easier.

I've restructured things a bit so that we can first process the options and determine if we have a username passed in, then start Sinatra. I couldn't see how to require 'ferver' ( starting the app ) and then process options and add in the Sinatra::Auth::Basic middleware.

Any thoughts?