s2s-auth 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -10
- data/changelog.md +5 -0
- data/lib/s2s/auth.rb +2 -2
- data/lib/s2s/auth/version.rb +1 -1
- data/lib/s2s/serializer.rb +19 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b9b1930b5f9b10ffc9d2da950f17377af07ae55
|
4
|
+
data.tar.gz: 96f2f62700b100e4c71af02c56ed05dff444176a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac514f8ba325ff7840004eae1e056b91558e4dbb66ff88ea049bc68c4318a6f9e4f545c88d18caf0c803ddc206e6f1f5b40fc3fec4439480569c058fd90b4b5
|
7
|
+
data.tar.gz: 99f076f5337b708702e5e83a5103dd5068be64d80a12ee750c3572bfdded48bc34ea053b2819a7707386af0e8dd10966594790ff5de5eae6348768807286e513
|
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
s2s-auth (0.0.
|
4
|
+
s2s-auth (0.0.2)
|
5
5
|
activesupport (>= 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (4.
|
11
|
-
i18n (~> 0.6, >= 0.6.
|
12
|
-
|
13
|
-
|
10
|
+
activesupport (4.0.2)
|
11
|
+
i18n (~> 0.6, >= 0.6.4)
|
12
|
+
minitest (~> 4.2)
|
13
|
+
multi_json (~> 1.3)
|
14
14
|
thread_safe (~> 0.1)
|
15
|
-
tzinfo (~>
|
15
|
+
tzinfo (~> 0.3.37)
|
16
16
|
atomic (1.1.14)
|
17
17
|
diff-lcs (1.2.5)
|
18
18
|
i18n (0.6.9)
|
19
|
-
|
20
|
-
|
19
|
+
minitest (4.7.5)
|
20
|
+
multi_json (1.8.4)
|
21
21
|
rake (0.9.6)
|
22
22
|
rspec (2.14.1)
|
23
23
|
rspec-core (~> 2.14.0)
|
@@ -29,8 +29,7 @@ GEM
|
|
29
29
|
rspec-mocks (2.14.5)
|
30
30
|
thread_safe (0.1.3)
|
31
31
|
atomic
|
32
|
-
tzinfo (
|
33
|
-
thread_safe (~> 0.1)
|
32
|
+
tzinfo (0.3.38)
|
34
33
|
|
35
34
|
PLATFORMS
|
36
35
|
ruby
|
data/changelog.md
ADDED
data/lib/s2s/auth.rb
CHANGED
@@ -4,7 +4,7 @@ require "active_support/key_generator"
|
|
4
4
|
require "active_support/message_verifier"
|
5
5
|
require "active_support/message_encryptor"
|
6
6
|
require "active_support/key_generator"
|
7
|
-
|
7
|
+
require_relative "serializer"
|
8
8
|
|
9
9
|
module S2S
|
10
10
|
module Auth
|
@@ -32,7 +32,7 @@ module S2S
|
|
32
32
|
raise ArgumentError.new("This module needs to be setup following keys: secret, app, salt, sign_salt")
|
33
33
|
end
|
34
34
|
@iterations = opts[:iterations] || opts["iterations"] || 1000
|
35
|
-
@serializer = opts[:serializer] || opts["serializer"] ||
|
35
|
+
@serializer = opts[:serializer] || opts["serializer"] || S2S::Auth::JsonSerializer
|
36
36
|
keygen = ActiveSupport::CachingKeyGenerator.new(ActiveSupport::KeyGenerator.new(@secret, iterations: @iteration))
|
37
37
|
secret = keygen.generate_key(@salt)
|
38
38
|
sign_secret = keygen.generate_key(@sign_salt)
|
data/lib/s2s/auth/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module S2S
|
4
|
+
module Auth
|
5
|
+
# Based on https://gist.github.com/mattetti/7624413
|
6
|
+
module JsonSerializer
|
7
|
+
def self.load(value)
|
8
|
+
begin
|
9
|
+
JSON.parse(value)
|
10
|
+
rescue JSON::ParserError
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def self.dump(value)
|
15
|
+
JSON.generate(value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s2s-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Aimonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,8 +80,10 @@ files:
|
|
80
80
|
- LICENSE.txt
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
|
+
- changelog.md
|
83
84
|
- lib/s2s/auth.rb
|
84
85
|
- lib/s2s/auth/version.rb
|
86
|
+
- lib/s2s/serializer.rb
|
85
87
|
- s2s-auth.gemspec
|
86
88
|
- spec/auth_spec.rb
|
87
89
|
- spec/spec_helper.rb
|