README.md in rack-simple_auth-0.0.1 vs README.md in rack-simple_auth-0.0.2

- old
+ new

@@ -1,9 +1,11 @@ # Rack::SimpleAuth -Rack Middleware for HMAC Authentication +Rack::SimpleAuth will contain different Authentication Class Middlewares +Until now only HMAC is implemented... + ## Installation Add this line to your application's Gemfile: gem 'rack-simple_auth' @@ -18,32 +20,64 @@ ## Gem Status [![Build Status](https://travis-ci.org/Benny1992/rack-simple_auth.png?branch=master)](https://travis-ci.org/Benny1992/rack-simple_auth) [![Coverage Status](https://coveralls.io/repos/Benny1992/rack-simple_auth/badge.png?branch=master)](https://coveralls.io/r/Benny1992/rack-simple_auth?branch=master) -[![GitHub version](https://badge.fury.io/gh/benny1992%2Frack-simple_auth.png)](http://badge.fury.io/gh/benny1992%2Frack-simple_auth) +[![Gem Version](https://badge.fury.io/rb/rack-simple_auth.png)](http://badge.fury.io/rb/rack-simple_auth) +[![Dependency Status](https://gemnasium.com/Benny1992/rack-simple_auth.png)](https://gemnasium.com/Benny1992/rack-simple_auth) ## Usage +### HMAC Authorization + Uses Authorization HTTP Header, example: -```Authorization: ContentHash:Signature``` +```Authorization: MessageHash:Signature``` -Signature is the "Public Key" +- Signature is the "Public Key" +- MessageHash is the HMAC encrypted Message -ContentHash is the HMAC encrypted Message +#### Basic Usage: ```ruby +config = { + 'GET' => 'path', + 'POST' => 'params', + 'DELETE' => 'path', + 'PUT' => 'path', + 'PATCH' => 'path' +} + map '/' do - use Rack::SimpleAuth::HMAC, 'signature', 'private_key' + use Rack::SimpleAuth::HMAC, 'signature', 'private_key', config run MyApplication end ``` -Private Key and Signature should be served by a file which is not checked into git version control. +Note: Private Key and Signature should be served by a file which is not checked into git version control. +#### Config Hash + +Via the config hash you are able to define the 'data' for each request method.<br /> +This data + HTTP Methodname is your Message what will be encrypted.<br /> + +For example ```GET '/get/user?name=rack'```: +```ruby +config = { 'GET => 'path' } +``` + +The Message what will be HMAC encrypted is: +```ruby +message = { 'method' => 'GET', 'data' => '/get/user?name=rack' }.to_json +``` + + ## Contributing -1. Fork it ( http://github.com/<my-github-username>/rack-simple_auth/fork ) +1. Fork it ( http://github.com/benny1992/rack-simple_auth/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request + + + +