halorgium-auth-hmac 1.1.1.2010090301

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,15 @@
1
+ == 1.1.1 2009-10-01
2
+
3
+ * Fixed bug in headers on recent versions of Ruby.
4
+
5
+ == 1.1.0 2009-02-26
6
+
7
+ * Added support for custom request signatures and service ids. (ascarter)
8
+
9
+ == 1.0.1 2008-08-22
10
+
11
+ * Fixed nil pointer exception when with_auth called with nil creds.
12
+
13
+ == 1.0.0 2008-08-11
14
+
15
+ * Initial release
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 The Kaphan Foundation
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,21 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.txt
6
+ Rakefile
7
+ config/hoe.rb
8
+ config/requirements.rb
9
+ lib/auth-hmac.rb
10
+ lib/auth-hmac/version.rb
11
+ script/console
12
+ script/destroy
13
+ script/generate
14
+ setup.rb
15
+ spec/auth-hmac_spec.rb
16
+ spec/spec.opts
17
+ spec/spec_helper.rb
18
+ tasks/deployment.rake
19
+ tasks/environment.rake
20
+ tasks/rspec.rake
21
+ tasks/website.rake
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on auth-hmac, see http://auth-hmac.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.txt ADDED
@@ -0,0 +1,129 @@
1
+ = auth-hmac
2
+
3
+ == What is it?
4
+
5
+ auth-hmac is a Ruby implementation of HMAC[http://en.wikipedia.org/wiki/HMAC] based authentication of HTTP requests.
6
+
7
+ 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.
8
+
9
+ 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.
10
+
11
+ HMAC based authentication also provides message integrity checking because the HMAC is based on a combination of the shared secret and the content of the request. So if any part of the request that is used to build the canonical representation is modified by a malicious party or in transit the authentication will then fail.
12
+
13
+ AuthHMAC was built to support authentication between various applications build by Peerworks[http://peerworks.org].
14
+
15
+ AuthHMAC is loosely based on the Amazon Web Services authentication scheme but without the Amazon specific components, i.e. it is HMAC for the rest of us.
16
+
17
+ == What does it require?
18
+
19
+ AuthHMAC requires Ruby's OpenSSL support. This should be standard in most Ruby builds.
20
+
21
+ == When to use it?
22
+
23
+ HMAC Authentication is best used as authentication for communication between applications such as web services. It provides better security than HTTP Basic authentication without the need to set up SSL. Of course if you need to protect the confidentiality of the data then you need SSL, but if you just want to authenticate requests without sending credentials in the clear AuthHMAC is a good choice.
24
+
25
+ == How to use it?
26
+
27
+ The simplest way to use AuthHMAC is with the AuthHMAC.sign! and AuthHMAC#authenticate? methods.
28
+
29
+ AuthHMAC.sign! takes a HTTP request object, an access id and a secret key and signs the request with the access_id and secret key.
30
+
31
+ * The HTTP request object can be a Net::HTTP::HTTPRequest object, a CGI::Request object or a Webrick HTTP request object. AuthHMAC will do its best to figure out which type it is an handle it accordingly.
32
+ * The access_id is used to identify the secret key that was used to sign the request. Think of it as like a user name, it allows you to hand out different keys to different clients and authenticate each of them individually. The access_id is sent in the clear so you should avoid making it an important string.
33
+ * 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:
34
+
35
+ random = File.read('/dev/random', 512)
36
+ secret_key = Base64.encode64(Digest::SHA2.new(512).digest(random))
37
+
38
+ 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.
39
+
40
+ If you have more than one set of credentials you might find it useful to create an instance of the AuthHMAC class, passing your credentials as a Hash of access id => secret keys, like so:
41
+
42
+ @authhmac = AuthHMAC.new('access_id1' => 'secret1', 'access_id2' => 'secret2')
43
+
44
+ You can then use the instance methods of the @authhmac object to sign and authenticate requests, for example:
45
+
46
+ @authhmac.sign!(request, "access_id1")
47
+
48
+ will sign +request+ with "access_id1" and it's corresponding secret key. Similarly authentication is done like so:
49
+
50
+ @authhmac.authenticated?(request)
51
+
52
+ which will return true if the request has been signed with one of the access id and secret key pairs provided in the constructor.
53
+
54
+ === Rails Integration
55
+
56
+ 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.
57
+
58
+ == How does it work?
59
+
60
+ When creating a signature for a HTTP request AuthHMAC first generates a canonical representation of the request.
61
+
62
+ This canonical string is created like so:
63
+
64
+ canonical_string = HTTP-Verb + "\n" +
65
+ Content-Type + "\n" +
66
+ Content-MD5 + "\n" +
67
+ Date + "\n" +
68
+ request-uri;
69
+
70
+ Where Content-Type, Content-MD5 and Date are all taken from the headers of the request. If Content-Type or Content-MD5 are not present, they are substituted with an empty string. If Date is not present it is added to the request headers with the value +Time.now.httpdate+. +request-uri+ is the path component of the request, without any query string, i.e. everything up to the ?.
71
+
72
+ This string is then used with the secret to generate a SHA1 HMAC using the following:
73
+
74
+ OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret_key, canonical_string)
75
+
76
+ The result is then Base64 encoded and added to the headers of the request as the +Authorization+ header in the format:
77
+
78
+ Authorization: AuthHMAC <access_id>:<base64 encoded hmac>
79
+
80
+ When authenaticating a request, AuthHMAC looks for the Authorization header in the above format, parses out the components, regenerates a HMAC for the request, using the secret key identified by the access id and then compares the generated HMAC with the one provided by the client. If they match the request is authenticated.
81
+
82
+ Using these details it is possible to build code that will sign and authenticate AuthHMAC style requests in other languages.
83
+
84
+ == INSTALL:
85
+
86
+ * sudo gem install auth-hmac
87
+
88
+ == Source Code
89
+
90
+ The source repository is accessible via GitHub or Ruby Forge:
91
+
92
+ git clone git://github.com/seangeo/auth-hmac.git
93
+
94
+
95
+ git clone git://rubyforge.org/auth-hmac.git
96
+
97
+ == Contact Information
98
+
99
+ The project page is at http://rubyforge.org/projects/auth-hmac. Please file any bugs or feedback
100
+ using the trackers and forums there.
101
+
102
+ == Authors and Contributors
103
+
104
+ rAtom was developed by Peerworks[http://peerworks.org] and written by Sean Geoghegan.
105
+
106
+ == LICENSE:
107
+
108
+ (The MIT License)
109
+
110
+ Copyright (c) 2008 The Kaphan Foundation
111
+
112
+ Permission is hereby granted, free of charge, to any person obtaining
113
+ a copy of this software and associated documentation files (the
114
+ 'Software'), to deal in the Software without restriction, including
115
+ without limitation the rights to use, copy, modify, merge, publish,
116
+ distribute, sublicense, and/or sell copies of the Software, and to
117
+ permit persons to whom the Software is furnished to do so, subject to
118
+ the following conditions:
119
+
120
+ The above copyright notice and this permission notice shall be
121
+ included in all copies or substantial portions of the Software.
122
+
123
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
124
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
125
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
126
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
127
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
128
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
129
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
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 ADDED
@@ -0,0 +1,44 @@
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
@@ -0,0 +1,15 @@
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]))
@@ -0,0 +1,9 @@
1
+ class AuthHMAC
2
+ module VERSION #:nodoc:
3
+ MAJOR = 1
4
+ MINOR = 1
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/auth-hmac.rb ADDED
@@ -0,0 +1,272 @@
1
+ # Copyright (c) 2008 The Kaphan Foundation
2
+ #
3
+ # See License.txt for licensing information.
4
+ #
5
+
6
+ $:.unshift(File.dirname(__FILE__)) unless
7
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
8
+
9
+ require 'openssl'
10
+
11
+ # This module provides a HMAC Authentication method for HTTP requests. It should work with
12
+ # net/http request classes and CGIRequest classes and hence Rails.
13
+ #
14
+ # It is loosely based on the Amazon Web Services Authentication mechanism but
15
+ # generalized to be useful to any application that requires HMAC based authentication.
16
+ # As a result of the generalization, it won't work with AWS because it doesn't support
17
+ # the Amazon extension headers.
18
+ #
19
+ # === References
20
+ # Cryptographic Hash functions:: http://en.wikipedia.org/wiki/Cryptographic_hash_function
21
+ # SHA-1 Hash function:: http://en.wikipedia.org/wiki/SHA-1
22
+ # HMAC algorithm:: http://en.wikipedia.org/wiki/HMAC
23
+ # RFC 2104:: http://tools.ietf.org/html/rfc2104
24
+ #
25
+ class AuthHMAC
26
+ module Headers # :nodoc:
27
+ # Gets the headers for a request.
28
+ #
29
+ # Attempts to deal with known HTTP header representations in Ruby.
30
+ # Currently handles net/http and Rails.
31
+ #
32
+ def headers(request)
33
+ if request.respond_to?(:headers)
34
+ request.headers
35
+ elsif request.respond_to?(:env)
36
+ request.env.each_pair do |key,value|
37
+ if value.is_a?(Array) && value.size == 1
38
+ request.env[key] = value[0]
39
+ end
40
+ end
41
+ request.env
42
+ elsif request.respond_to?(:[])
43
+ request
44
+ else
45
+ raise ArgumentError, "Don't know how to get the headers from #{request.inspect}"
46
+ end
47
+ end
48
+
49
+ def find_header(keys, headers)
50
+ keys.map do |key|
51
+ headers[key]
52
+ end.compact.first
53
+ end
54
+ end
55
+
56
+ include Headers
57
+
58
+ # Build a Canonical String for a HTTP request.
59
+ #
60
+ # A Canonical String has the following format:
61
+ #
62
+ # CanonicalString = HTTP-Verb + "\n" +
63
+ # Content-Type + "\n" +
64
+ # Content-MD5 + "\n" +
65
+ # Date + "\n" +
66
+ # request-uri;
67
+ #
68
+ #
69
+ # If the Date header doesn't exist, one will be generated since
70
+ # Net/HTTP will generate one if it doesn't exist and it will be
71
+ # used on the server side to do authentication.
72
+ #
73
+ class CanonicalString < String # :nodoc:
74
+ include Headers
75
+
76
+ def initialize(request, authenticate_referrer=false)
77
+ self << request_method(request) + "\n"
78
+ self << header_values(request) + "\n"
79
+ self << request_path(request, authenticate_referrer)
80
+ end
81
+
82
+ private
83
+ def request_method(request)
84
+ if request.respond_to?(:request_method) && request.request_method.is_a?(String)
85
+ request.request_method
86
+ elsif request.respond_to?(:method) && request.method.is_a?(String)
87
+ request.method
88
+ elsif request.respond_to?(:env) && request.env
89
+ request.env['REQUEST_METHOD']
90
+ else
91
+ raise ArgumentError, "Don't know how to get the request method from #{request.inspect}"
92
+ end
93
+ end
94
+
95
+ def header_values(request)
96
+ headers = headers(request)
97
+ [ content_type(headers),
98
+ (content_md5(headers) or (read_body(request).nil? || read_body(request).empty? ? '' : headers['Content-MD5'] = generate_content_md5(request))),
99
+ (date(headers) or headers['Date'] = Time.now.utc.httpdate)
100
+ ].join("\n")
101
+ end
102
+
103
+ def read_body(request)
104
+ if request.body.respond_to?(:read)
105
+ request.body.rewind
106
+ request.body.read
107
+ else
108
+ request.body
109
+ end
110
+ end
111
+
112
+ def content_type(headers)
113
+ find_header(%w(CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE), headers)
114
+ end
115
+
116
+ def date(headers)
117
+ find_header(%w(DATE HTTP_DATE), headers)
118
+ end
119
+
120
+ def content_md5(headers)
121
+ find_header(%w(CONTENT-MD5 CONTENT_MD5 HTTP_CONTENT_MD5), headers)
122
+ end
123
+
124
+ def generate_content_md5(request)
125
+ OpenSSL::Digest::MD5.hexdigest(read_body(request))
126
+ end
127
+
128
+ def request_path(request, authenticate_referrer)
129
+ if authenticate_referrer
130
+ headers(request)['Referer'] =~ /^(?:http:\/\/)?[^\/]*(\/.*)$/
131
+ path = $1
132
+ else
133
+ # Try unparsed_uri in case it is a Webrick request
134
+ path = if request.respond_to?(:unparsed_uri)
135
+ request.unparsed_uri
136
+ else
137
+ request.path
138
+ end
139
+ end
140
+
141
+ path[/^[^?]*/]
142
+ end
143
+ end
144
+
145
+ @@default_signature_class = CanonicalString
146
+
147
+ # Create an AuthHMAC instance using the given credential store
148
+ #
149
+ # Credential Store:
150
+ # * Credential store must respond to the [] method and return a secret for access key id
151
+ #
152
+ # Options:
153
+ # Override default options
154
+ # * <tt>:service_id</tt> - Service ID used in the AUTHORIZATION header string. Default is AuthHMAC.
155
+ # * <tt>:signature_method</tt> - Proc object that takes request and produces the signature string
156
+ # used for authentication. Default is CanonicalString.
157
+ # Examples:
158
+ # my_hmac = AuthHMAC.new('access_id1' => 'secret1', 'access_id2' => 'secret2')
159
+ #
160
+ # cred_store = { 'access_id1' => 'secret1', 'access_id2' => 'secret2' }
161
+ # options = { :service_id => 'MyApp', :signature_method => lambda { |r| MyRequestString.new(r) } }
162
+ # my_hmac = AuthHMAC.new(cred_store, options)
163
+ #
164
+ def initialize(credential_store, options = nil)
165
+ @credential_store = credential_store
166
+
167
+ # Defaults
168
+ @service_id = self.class.name
169
+ @signature_class = @@default_signature_class
170
+ @authenticate_referrer = false
171
+
172
+ unless options.nil?
173
+ @service_id = options[:service_id] if options.key?(:service_id)
174
+ @signature_class = options[:signature] if options.key?(:signature) && options[:signature].is_a?(Class)
175
+ @authenticate_referrer = options[:authenticate_referrer] || options[:authenticate_referer]
176
+ end
177
+
178
+ @signature_method = lambda { |r,ar| @signature_class.send(:new, r, ar) }
179
+ end
180
+
181
+ # Generates canonical signing string for given request
182
+ #
183
+ # Supports same options as AuthHMAC.initialize for overriding service_id and
184
+ # signature method.
185
+ #
186
+ def AuthHMAC.canonical_string(request, options = nil)
187
+ self.new(nil, options).canonical_string(request)
188
+ end
189
+
190
+ # Generates signature string for a given secret
191
+ #
192
+ # Supports same options as AuthHMAC.initialize for overriding service_id and
193
+ # signature method.
194
+ #
195
+ def AuthHMAC.signature(request, secret, options = nil)
196
+ self.new(nil, options).signature(request, secret)
197
+ end
198
+
199
+ # Signs a request using a given access key id and secret.
200
+ #
201
+ # Supports same options as AuthHMAC.initialize for overriding service_id and
202
+ # signature method.
203
+ #
204
+ def AuthHMAC.sign!(request, access_key_id, secret, options = nil)
205
+ credentials = { access_key_id => secret }
206
+ self.new(credentials, options).sign!(request, access_key_id)
207
+ end
208
+
209
+ # Authenticates a request using HMAC
210
+ #
211
+ # Supports same options as AuthHMAC.initialize for overriding service_id and
212
+ # signature method.
213
+ #
214
+ def AuthHMAC.authenticated?(request, access_key_id, secret, options)
215
+ credentials = { access_key_id => secret }
216
+ self.new(credentials, options).authenticated?(request)
217
+ end
218
+
219
+ # Signs a request using the access_key_id and the secret associated with that id
220
+ # in the credential store.
221
+ #
222
+ # Signing a requests adds an Authorization header to the request in the format:
223
+ #
224
+ # <service_id> <access_key_id>:<signature>
225
+ #
226
+ # where <signature> is the Base64 encoded HMAC-SHA1 of the CanonicalString and the secret.
227
+ #
228
+ def sign!(request, access_key_id)
229
+ secret = @credential_store[access_key_id]
230
+ raise ArgumentError, "No secret found for key id '#{access_key_id}'" if secret.nil?
231
+ if request.respond_to?(:headers)
232
+ request.headers['Authorization'] = authorization(request, access_key_id, secret)
233
+ else
234
+ request['Authorization'] = authorization(request, access_key_id, secret)
235
+ end
236
+ end
237
+
238
+ # Authenticates a request using HMAC
239
+ #
240
+ # Returns true if the request has an AuthHMAC Authorization header and
241
+ # the access id and HMAC match an id and HMAC produced for the secret
242
+ # in the credential store. Otherwise returns false.
243
+ #
244
+ def authenticated?(request)
245
+ rx = Regexp.new("#{@service_id} ([^:]+):(.+)$")
246
+ if md = rx.match(authorization_header(request))
247
+ access_key_id = md[1]
248
+ hmac = md[2]
249
+ secret = @credential_store[access_key_id]
250
+ !secret.nil? && hmac == signature(request, secret)
251
+ else
252
+ false
253
+ end
254
+ end
255
+
256
+ def signature(request, secret)
257
+ digest = OpenSSL::Digest::Digest.new('sha1')
258
+ [OpenSSL::HMAC.digest(digest, secret, canonical_string(request, @authenticate_referrer))].pack('m').strip
259
+ end
260
+
261
+ def canonical_string(request, authenticate_referrer=false)
262
+ @signature_method.call(request, authenticate_referrer)
263
+ end
264
+
265
+ def authorization_header(request)
266
+ find_header(%w(Authorization HTTP_AUTHORIZATION), headers(request))
267
+ end
268
+
269
+ def authorization(request, access_key_id, secret)
270
+ "#{@service_id} #{access_key_id}:#{signature(request, secret)}"
271
+ end
272
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
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 ADDED
@@ -0,0 +1,14 @@
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 ADDED
@@ -0,0 +1,14 @@
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)