Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8252812
made my changes less disruptive to the CanonicalString API
cap10morgan May 11, 2010
b42a1b7
added content-md5 generation when client doesn't supply it
cap10morgan Sep 2, 2010
3676c5c
gutted Rails monkey-patching
cap10morgan Sep 2, 2010
f257ab4
modified gemspec for our fork
cap10morgan Sep 3, 2010
05169b8
Remove Base64 and use Array#pack instead.
Sep 3, 2010
c867567
updated README.rdoc to better reflect the state of our fork
cap10morgan Sep 3, 2010
afc03fe
fixed up some more stuff in the README.rdoc
cap10morgan Sep 3, 2010
a7e0c93
add gemfile for easier development
ultraninja Sep 4, 2010
63426a1
switch to AS 3
ultraninja Sep 4, 2010
1d7cc33
make rack bodies work with content-md5
ultraninja Sep 4, 2010
533d746
Use the CanonicalString as an object rather than passing request and …
ultraninja Sep 4, 2010
a1bbcd0
extract generated_md5 method and expand ternary
ultraninja Sep 4, 2010
7ad0f8d
Expose the service id
ultraninja Sep 4, 2010
ee59471
Rewind the body after reading
ultraninja Sep 4, 2010
8300a9b
Return the body of the request instead of the rewind
ultraninja Sep 4, 2010
c4332bd
add the middleware
ultraninja Oct 5, 2010
1000224
Change the env key to be more consistent
halorgium Oct 6, 2010
6a3d421
bundle rake
sr Nov 29, 2010
69e8429
exit 1 when gems are missing
sr Nov 29, 2010
cff0bdf
bundle other random gems required by the rakefile
sr Nov 29, 2010
33ce859
do not require newgem and rubigen
sr Nov 29, 2010
cca8fb4
remove deployment, environment and website tasks
sr Nov 29, 2010
72eb60a
move rspec.task to Rakefile
sr Nov 29, 2010
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pkg
.bundle
vendor/bundle
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "http://rubygems.org"

gem "rspec"
gem "ruby-debug"
gem "activesupport"
gem "rake"
gem "hoe"
29 changes: 29 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
GEM
remote: http://rubygems.org/
specs:
activesupport (3.0.0)
columnize (0.3.1)
hoe (2.6.2)
rake (>= 0.8.7)
rubyforge (>= 2.0.4)
json_pure (1.4.6)
linecache (0.43)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
ruby-debug-base (0.10.3)
linecache (>= 0.3)
rubyforge (2.0.4)
json_pure (>= 1.1.7)

PLATFORMS
ruby

DEPENDENCIES
activesupport
hoe
rake
rspec
ruby-debug
27 changes: 12 additions & 15 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

auth-hmac is a Ruby implementation of HMAC[http://en.wikipedia.org/wiki/HMAC] based authentication of HTTP requests.

This is the DNC Innovation Lab fork of the project. We added Rack support and some other more obscure stuff for HMAC proxying that you probably won't need unless you're doing something weird like we are. :)
Github user rjackson contributed Ruby 1.9 support, which is pretty awesome.

HMAC authentication involves a client and server having a shared secret key. When sending the request the client, signs the request using the secret key. This involves building a canonical representation of the request and then generating a HMAC of the request using the secret. The generated HMAC is then sent as part of the request.

When the server receives the request it builds the same canonical representation and generates a HMAC using it's copy of the secret key, if the HMAC produced by the server matches the HMAC sent by the client, the server can be assured that the client also possesses the shared secret key.
Expand Down Expand Up @@ -33,7 +36,7 @@ AuthHMAC.sign! takes a HTTP request object, an access id and a secret key and si
* The secret key is the shared secret between the client and the server. You should make this sufficiently random so that is can't be guessed or exposed to dictionary attacks. The follow code will give you a pretty good secret key:

random = File.read('/dev/random', 512)
secret_key = Base64.encode64(Digest::SHA2.new(512).digest(random))
secret_key = [Digest::SHA2.new(512).digest(random)].pack('m')

On the server side you can then authenticate these requests using the AuthHMAC.authenticated? method. This takes the same arguments as the sign! method but returns true if the request has been signed with the access id and secret or false if it hasn't.

Expand All @@ -51,10 +54,6 @@ will sign +request+ with "access_id1" and it's corresponding secret key. Simila

which will return true if the request has been signed with one of the access id and secret key pairs provided in the constructor.

=== Rails Integration

AuthHMAC supports authentication within Rails controllers and signing of requests generated by Active Resource. See AuthHMAC::Rails::ControllerFilter::ClassMethods and AuthHMAC::Rails::ActiveResourceExtension::BaseHmac::ClassMethods for details.

== How does it work?

When creating a signature for a HTTP request AuthHMAC first generates a canonical representation of the request.
Expand Down Expand Up @@ -83,25 +82,23 @@ Using these details it is possible to build code that will sign and authenticate

== INSTALL:

* sudo gem install auth-hmac
* sudo gem install dnclabs-auth-hmac

== Source Code

The source repository is accessible via GitHub or Ruby Forge:
The source repository is accessible via GitHub:

git clone git://github.com/seangeo/auth-hmac.git


git clone git://rubyforge.org/auth-hmac.git
git clone git://github.com/dnclabs/auth-hmac.git

== Contact Information

The project page is at http://rubyforge.org/projects/auth-hmac. Please file any bugs or feedback
using the trackers and forums there.
Please file any bugs or feedback on http://github.com/dnclabs/auth-hmac/

== Authors and Contributors

rAtom was developed by Peerworks[http://peerworks.org] and written by Sean Geoghegan.
Upstream credits: rAtom was developed by Peerworks[http://peerworks.org] and written by Sean Geoghegan.

This fork: Maintained by the Democratic National Committee Innovation Labs team.

== LICENSE:

Expand All @@ -126,4 +123,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 changes: 9 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
require 'config/requirements'
require 'config/hoe' # setup Hoe + all gem configuration

Dir['tasks/**/*.rake'].each { |rake| load rake }
require 'config/requirements'
require 'config/hoe' # setup Hoe + all gem configuration

require 'spec/rake/spectask'
desc "Run the specs under spec/models"
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "spec/spec.opts"]
t.spec_files = FileList['spec/**/*_spec.rb']
end
22 changes: 7 additions & 15 deletions auth-hmac.gemspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{auth-hmac}
s.version = "1.1.0"
s.name = %q{dnclabs-auth-hmac}
s.version = "1.1.1.2010090201"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Sean Geoghegan", "ascarter"]
s.date = %q{2009-02-26}
s.description = %q{A gem providing HMAC based authentication for HTTP}
s.email = %q{seangeo@gmail.com}
s.authors = ["Sean Geoghegan", "ascarter", "Wes Morgan", "Adrian Cushman"]
s.date = %q{2010-09-02}
s.description = %q{A gem providing HMAC based authentication for HTTP. This is the DNC Labs fork.}
s.email = %q{innovationlab@dnc.org}
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt"]
s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "lib/auth-hmac.rb", "lib/auth-hmac/version.rb", "script/console", "script/destroy", "script/generate", "setup.rb", "spec/auth-hmac_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake", "tasks/website.rake"]
s.has_rdoc = true
s.homepage = %q{http://auth-hmac.rubyforge.org}
s.post_install_message = %q{
For more information on auth-hmac, see http://auth-hmac.rubyforge.org

NOTE: Change this information in PostInstall.txt
You can also delete it if you don't want it.


}
s.homepage = %q{http://github.com/dnclabs/auth-hmac/}
s.rdoc_options = ["--main", "README.txt"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{auth-hmac}
Expand Down
48 changes: 9 additions & 39 deletions config/hoe.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
require 'auth-hmac/version'

AUTHOR = ['Sean Geoghegan', 'ascarter'] # can also be an array of Authors
EMAIL = "seangeo@gmail.com"
DESCRIPTION = "A gem providing HMAC based authentication for HTTP"
GEM_NAME = 'auth-hmac' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'auth-hmac' # The unix name for your project
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
EXTRA_DEPENDENCIES = [
# ['activesupport', '>= 1.3.1']
] # An array of rubygem dependencies [name, version]

@config_file = "~/.rubyforge/user-config.yml"
@config = nil
RUBYFORGE_USERNAME = "unknown"
def rubyforge_username
unless @config
begin
@config = YAML.load(File.read(File.expand_path(@config_file)))
rescue
puts <<-EOS
ERROR: No rubyforge config file found: #{@config_file}
Run 'rubyforge setup' to prepare your env for access to Rubyforge
- See http://newgem.rubyforge.org/rubyforge.html for more details
EOS
exit
end
end
RUBYFORGE_USERNAME.replace @config["username"]
end


REV = nil
AUTHOR = ['Sean Geoghegan', 'ascarter', "Wes Morgan", "Adrian Cushman"] # can also be an array of Authors
EMAIL = "innovationlab@dnc.org"
DESCRIPTION = "A gem providing HMAC based authentication for HTTP. This is the DNC Labs fork."
GEM_NAME = 'dnclabs-auth-hmac' # what ppl will type to install your gem
HOMEPATH = "http://github.com/dnclabs/auth-hmac/"
RUBYFORGE_PROJECT = ''

REV = '2010090201'
# UNCOMMENT IF REQUIRED:
# REV = YAML.load(`svn info`)['Revision']
VERS = AuthHMAC::VERSION::STRING + (REV ? ".#{REV}" : "")
Expand Down Expand Up @@ -65,10 +41,4 @@ def extra_deps
#p.extra_deps = EXTRA_DEPENDENCIES

#p.spec_extras = {} # A hash of extra values to set in the gemspec.
end

CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''))
$hoe.rsync_args = '-av --delete --ignore-errors'
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
end
4 changes: 2 additions & 2 deletions config/requirements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
include FileUtils

require 'rubygems'
%w[rake hoe newgem rubigen].each do |req_gem|
%w[rake hoe].each do |req_gem|
begin
require req_gem
rescue LoadError
puts "This Rakefile requires the '#{req_gem}' RubyGem."
puts "Installation: gem install #{req_gem} -y"
exit
exit 1
end
end

Expand Down
Loading