opentoken 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1,4 +1,4 @@
1
- rvm use 1.9.3-p0@opentoken --create
1
+ rvm use 1.9.3-p125@opentoken --create
2
2
  if ! command -v bundle ; then
3
3
  gem install bundler
4
4
  bundle install --local
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ Bundler::GemHelper.install_tasks
4
4
  require 'rake/testtask'
5
5
  Rake::TestTask.new(:test) do |test|
6
6
  test.libs << 'lib' << 'test'
7
- test.pattern = 'test/**/test_*.rb'
7
+ test.test_files = FileList['test/test*.rb']
8
8
  test.verbose = true
9
9
  end
10
10
 
@@ -3,6 +3,8 @@ require 'active_support/hash_with_indifferent_access'
3
3
  require 'active_support/core_ext/time/calculations'
4
4
 
5
5
  module OpenToken
6
+ CLOCK_SKEW_TOLERANCE = 5 # in seconds
7
+
6
8
  class TokenExpiredError < StandardError; end
7
9
 
8
10
  class Token < ActiveSupport::HashWithIndifferentAccess
@@ -11,7 +13,7 @@ module OpenToken
11
13
  end
12
14
  #verify that the current time is between the not-before and not-on-or-after values
13
15
  def valid?
14
- start_at.past? && end_at.future?
16
+ (start_at - CLOCK_SKEW_TOLERANCE).past? && (end_at + CLOCK_SKEW_TOLERANCE).future?
15
17
  end
16
18
  def expired?
17
19
  !valid?
@@ -31,4 +33,4 @@ module OpenToken
31
33
  Time.iso8601(self[key])
32
34
  end
33
35
  end
34
- end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module OpenToken
2
- VERSION = '1.2.2'
2
+ VERSION = '1.2.3'
3
3
  end
@@ -31,9 +31,9 @@ class TestOpentoken < Test::Unit::TestCase
31
31
  end
32
32
  end
33
33
 
34
- context "decoding token when current time is before expiration date" do
34
+ context "decoding token when current time is outside clock skew tolerance of before expiration date" do
35
35
  should "raise TokenExpiredError" do
36
- Timecop.travel(Time.iso8601('2010-03-04T19:19:10Z')) do
36
+ Timecop.travel(Time.iso8601('2010-03-04T19:19:05Z')) do
37
37
  assert_raises OpenToken::TokenExpiredError do
38
38
  @token = OpenToken.decode @opentoken
39
39
  end
@@ -41,9 +41,39 @@ class TestOpentoken < Test::Unit::TestCase
41
41
  end
42
42
  end
43
43
 
44
+ context "decoding token when current time is within clock skew tolerance of before expiration date" do
45
+ should "not raise TokenExpiredError" do
46
+ Timecop.travel(Time.iso8601('2010-03-04T19:19:10Z')) do
47
+ assert_nothing_raised do
48
+ @token = OpenToken.decode @opentoken
49
+ end
50
+ end
51
+ end
52
+ end
53
+
44
54
  context "decoding token when current time is equal to expiration date" do
45
- should "raise TokenExpiredError" do
55
+ should "not raise TokenExpiredError" do
46
56
  Timecop.travel(Time.iso8601('2010-03-04T19:24:15Z')) do
57
+ assert_nothing_raised do
58
+ @token = OpenToken.decode @opentoken
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ context "decoding token when current time is within clock skew tolerance of expiration date" do
65
+ should "not raise TokenExpiredError" do
66
+ Timecop.travel(Time.iso8601('2010-03-04T19:24:19Z')) do
67
+ assert_nothing_raised do
68
+ @token = OpenToken.decode @opentoken
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ context "decoding token when current time is outside clock skew tolerance of expiration date" do
75
+ should "raise TokenExpiredError" do
76
+ Timecop.travel(Time.iso8601('2010-03-04T19:24:25Z')) do
47
77
  assert_raises OpenToken::TokenExpiredError do
48
78
  @token = OpenToken.decode @opentoken
49
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-17 00:00:00.000000000 Z
12
+ date: 2012-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2174041000 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.0.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2174041000
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.3
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: i18n
27
- requirement: &2174040480 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,40 +37,60 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2174040480
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: shoulda
38
- requirement: &2174040000 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
- - - =
51
+ - - '='
42
52
  - !ruby/object:Gem::Version
43
53
  version: 2.11.3
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2174040000
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.11.3
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: timecop
49
- requirement: &2174039520 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
- - - =
67
+ - - '='
53
68
  - !ruby/object:Gem::Version
54
69
  version: 0.3.5
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *2174039520
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.3.5
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rake
60
- requirement: &2174039040 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
- - - =
83
+ - - '='
64
84
  - !ruby/object:Gem::Version
65
85
  version: 0.9.2
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *2174039040
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.2
69
94
  description: parse opentoken properties passed for Single Signon requests
70
95
  email:
71
96
  - ryan@socialcast.com
@@ -104,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
129
  version: '0'
105
130
  segments:
106
131
  - 0
107
- hash: -3830787979922973573
132
+ hash: 4385898841292862662
108
133
  required_rubygems_version: !ruby/object:Gem::Requirement
109
134
  none: false
110
135
  requirements:
@@ -113,10 +138,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
138
  version: '0'
114
139
  segments:
115
140
  - 0
116
- hash: -3830787979922973573
141
+ hash: 4385898841292862662
117
142
  requirements: []
118
143
  rubyforge_project: opentoken
119
- rubygems_version: 1.8.13
144
+ rubygems_version: 1.8.24
120
145
  signing_key:
121
146
  specification_version: 3
122
147
  summary: ruby implementation of the opentoken specification