halorgium-auth-hmac 1.1.1.2010090303 → 1.1.1.2010100502

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ class AuthHMAC
2
+ class Middleware
3
+ def initialize(app, credentials)
4
+ @app = app
5
+ @hmac = AuthHMAC.new(credentials)
6
+ end
7
+
8
+ def call(env)
9
+ dup.call!(env)
10
+ end
11
+
12
+ def call!(env)
13
+ @env = env
14
+
15
+ if @hmac.authenticated?(request)
16
+ rx = Regexp.new("#{@hmac.service_id} ([^:]+):(.+)$")
17
+
18
+ if md = rx.match(@hmac.authorization_header(request))
19
+ env["hmac-auth.access_key_id"] = md[1]
20
+ else
21
+ raise "Unknown request"
22
+ end
23
+
24
+ @app.call(env)
25
+ else
26
+ Rack::Response.new("Authorization required", 401).finish
27
+ end
28
+ end
29
+
30
+ def request
31
+ @request ||= Rack::Request.new(@env)
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halorgium-auth-hmac
3
3
  version: !ruby/object:Gem::Version
4
- hash: 4020180525
4
+ hash: 4020201087
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - 1
10
- - 2010090303
11
- version: 1.1.1.2010090303
10
+ - 2010100502
11
+ version: 1.1.1.2010100502
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sean Geoghegan
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-09-02 00:00:00 -07:00
22
+ date: 2010-09-02 00:00:00 +12:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -51,27 +51,14 @@ extra_rdoc_files:
51
51
  - PostInstall.txt
52
52
  - README.txt
53
53
  files:
54
+ - lib/auth-hmac/middleware.rb
55
+ - lib/auth-hmac/version.rb
56
+ - lib/auth-hmac.rb
54
57
  - History.txt
55
58
  - License.txt
56
59
  - Manifest.txt
57
60
  - PostInstall.txt
58
61
  - README.txt
59
- - Rakefile
60
- - config/hoe.rb
61
- - config/requirements.rb
62
- - lib/auth-hmac.rb
63
- - lib/auth-hmac/version.rb
64
- - script/console
65
- - script/destroy
66
- - script/generate
67
- - setup.rb
68
- - spec/auth-hmac_spec.rb
69
- - spec/spec.opts
70
- - spec/spec_helper.rb
71
- - tasks/deployment.rake
72
- - tasks/environment.rake
73
- - tasks/rspec.rake
74
- - tasks/website.rake
75
62
  has_rdoc: true
76
63
  homepage: http://github.com/dnclabs/auth-hmac/
77
64
  licenses: []
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
data/config/hoe.rb DELETED
@@ -1,44 +0,0 @@
1
- require 'auth-hmac/version'
2
-
3
- AUTHOR = ['Sean Geoghegan', 'ascarter', "Wes Morgan", "Adrian Cushman"] # can also be an array of Authors
4
- EMAIL = "innovationlab@dnc.org"
5
- DESCRIPTION = "A gem providing HMAC based authentication for HTTP. This is the DNC Labs fork."
6
- GEM_NAME = 'dnclabs-auth-hmac' # what ppl will type to install your gem
7
- HOMEPATH = "http://github.com/dnclabs/auth-hmac/"
8
- RUBYFORGE_PROJECT = ''
9
-
10
- REV = '2010090201'
11
- # UNCOMMENT IF REQUIRED:
12
- # REV = YAML.load(`svn info`)['Revision']
13
- VERS = AuthHMAC::VERSION::STRING + (REV ? ".#{REV}" : "")
14
- RDOC_OPTS = ['--quiet', '--title', 'auth-hmac documentation',
15
- "--opname", "index.html",
16
- "--line-numbers",
17
- "--main", "README",
18
- "--inline-source"]
19
-
20
- class Hoe
21
- def extra_deps
22
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
23
- @extra_deps
24
- end
25
- end
26
-
27
- # Generate all the Rake tasks
28
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
29
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
30
- p.author = AUTHOR
31
- p.email = EMAIL
32
- p.description = DESCRIPTION
33
- p.summary = DESCRIPTION
34
- p.url = HOMEPATH
35
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
36
- p.test_globs = ["test/**/test_*.rb"]
37
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
38
-
39
- # == Optional
40
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
41
- #p.extra_deps = EXTRA_DEPENDENCIES
42
-
43
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
44
- end
@@ -1,15 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/auth-hmac.rb'}"
9
- puts "Loading auth-hmac gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)