shared-secret-authentication 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -16,7 +16,14 @@ module SharedSecretAuthentication
|
|
16
16
|
string_keys = hash.keys.inject({}) {|keys, key| keys.merge!(key.to_s => key) }
|
17
17
|
string_keys.keys.sort.each do |key|
|
18
18
|
d.update key
|
19
|
-
|
19
|
+
value = hash[string_keys[key]]
|
20
|
+
if value.instance_of? Hash
|
21
|
+
value = value.collect {|k,v| k.to_s + v.to_s}
|
22
|
+
end
|
23
|
+
if value.instance_of? Array
|
24
|
+
value = value.sort
|
25
|
+
end
|
26
|
+
d.update value.to_s
|
20
27
|
end
|
21
28
|
d.update SHARED_SECRET
|
22
29
|
d.to_s
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{shared-secret-authentication}
|
8
|
+
s.version = "0.1.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Josh Moore"]
|
12
|
+
s.date = %q{2010-11-03}
|
13
|
+
s.description = %q{helper methods to make shared secret authentication easier}
|
14
|
+
s.email = %q{joshsmoore@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"config/shared_secret.yml",
|
27
|
+
"lib/shared-secret-authentication.rb",
|
28
|
+
"lib/shared-secret-authentication/hash_signatures.rb",
|
29
|
+
"lib/shared-secret-authentication/load_secret.rb",
|
30
|
+
"shared-secret-authentication.gemspec",
|
31
|
+
"spec/shared-secret-authentication/hash_signatures_spec.rb",
|
32
|
+
"spec/shared-secret-authentication/load_secret_spec.rb",
|
33
|
+
"spec/shared-secret-authentication_spec.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"watchr.rb"
|
37
|
+
]
|
38
|
+
s.homepage = %q{http://github.com/joshsmoore@gmail.com/shared-secret-authentication}
|
39
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = %q{1.3.7}
|
42
|
+
s.summary = %q{helper methods to make shared secret authentication easier}
|
43
|
+
s.test_files = [
|
44
|
+
"spec/shared-secret-authentication/hash_signatures_spec.rb",
|
45
|
+
"spec/shared-secret-authentication/load_secret_spec.rb",
|
46
|
+
"spec/shared-secret-authentication_spec.rb",
|
47
|
+
"spec/spec_helper.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
+
end
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'spec/spec_helper'
|
2
2
|
|
3
|
+
require 'rubygems'
|
4
|
+
require 'activesupport'
|
5
|
+
|
3
6
|
describe SharedSecretAuthentication do
|
4
7
|
before(:all) do
|
5
8
|
Object.const_set(:SHARED_SECRET, 'test')
|
@@ -47,9 +50,18 @@ describe SharedSecretAuthentication do
|
|
47
50
|
SharedSecretAuthentication.hash_signature({'test' => 'me', 'different' => 'order', '1' => '2'}).should == SharedSecretAuthentication.hash_signature({'1' => '2', 'different' => 'order', 'test' => 'me'})
|
48
51
|
end
|
49
52
|
|
53
|
+
|
50
54
|
it 'should work for hash keys that are symbols' do
|
51
55
|
SharedSecretAuthentication.hash_signature(:test => 'me', :key => 'test').should == 'b1a4b3df933590f973f07e6f0a391e95a8423e7b5250973f24e3174d60e8a1ac'
|
52
56
|
end
|
53
57
|
|
58
|
+
context 'edge cases' do
|
59
|
+
it 'should produce the same signature for both hashes' do
|
60
|
+
hash1 = {"practices"=>{"name"=>"Body Image Physical Therapy & Fitness P.C.", "mysql_updated_at"=>Time.parse("Thu, 03 Jun 2010 19:15:03 UTC +00:00"), "mysql_id"=>79}}
|
61
|
+
hash2 = {"practices"=>{"mysql_updated_at"=>Time.parse("2010-06-03T19:15:03Z"), "name"=>"Body Image Physical Therapy & Fitness P.C.", "mysql_id"=>79}}
|
62
|
+
|
63
|
+
SharedSecretAuthentication.hash_signature(hash1).should == SharedSecretAuthentication.hash_signature(hash2)
|
64
|
+
end
|
65
|
+
end
|
54
66
|
end
|
55
67
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shared-secret-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Moore
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-03 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,8 @@ files:
|
|
54
54
|
- lib/shared-secret-authentication.rb
|
55
55
|
- lib/shared-secret-authentication/hash_signatures.rb
|
56
56
|
- lib/shared-secret-authentication/load_secret.rb
|
57
|
-
-
|
57
|
+
- shared-secret-authentication.gemspec
|
58
|
+
- spec/shared-secret-authentication/hash_signatures_spec.rb
|
58
59
|
- spec/shared-secret-authentication/load_secret_spec.rb
|
59
60
|
- spec/shared-secret-authentication_spec.rb
|
60
61
|
- spec/spec.opts
|
@@ -95,7 +96,7 @@ signing_key:
|
|
95
96
|
specification_version: 3
|
96
97
|
summary: helper methods to make shared secret authentication easier
|
97
98
|
test_files:
|
98
|
-
- spec/shared-secret-authentication/
|
99
|
+
- spec/shared-secret-authentication/hash_signatures_spec.rb
|
99
100
|
- spec/shared-secret-authentication/load_secret_spec.rb
|
100
101
|
- spec/shared-secret-authentication_spec.rb
|
101
102
|
- spec/spec_helper.rb
|