soar_authentication_token 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e3c701d097f5b136e50e3f178c444e6b604f2da
4
- data.tar.gz: 0178b46dd7f0e2a2a7d15e9cb73b422b00165d30
3
+ metadata.gz: 30c0c39a09540212db058ce833ebcd693e2defd2
4
+ data.tar.gz: cc20f98a7bdaa653cd2fe437946d6646b268bd78
5
5
  SHA512:
6
- metadata.gz: ede08945abe0fe5da8cdb4ce59f8fb7853bc52fdc3c9f160e0722b65a0fb2ac2b1c01efd3e8e20671df1d3ca8eab03ceac98f1777b5d72a2f2c0d49c161e970e
7
- data.tar.gz: 0108db7ca629b57f7c5398764c98cdb208557aab62cdfec6e96d82d4b3bba7e7529ee5e3cbf240898191c5203130e3f67e2360051a4662cfa5247a95d1c2592c
6
+ metadata.gz: b76a8b2663458cd8b417c391e73b2467c31d8cbca6b2d8b5ab343f65641e698e9e2e25b0e65cdccef98f2270eddcfb712bc5ad101c0b69bead28f49f72c24eed
7
+ data.tar.gz: 1b9804a8de2dc0dc9ea7a84e6f9c3641d84a0a3b62b8ae94e7087813da8b49f04e9a5da910fb2860f093ce86048f2e5c4edefdb39a6afe70b6370de7d433bbee
@@ -33,6 +33,9 @@ module SoarAuthenticationToken
33
33
  end
34
34
 
35
35
  def validate_configuration
36
+ raise "'mode' must be configured" unless @configuration['mode']
37
+ raise "'mode' must be configured as either 'local' or 'remote'" unless ['local','remote'].include?(@configuration['mode'])
38
+
36
39
  end
37
40
 
38
41
  def merge_with_default_configuration(configuration)
@@ -5,6 +5,7 @@ module SoarAuthenticationToken
5
5
  class TokenValidator
6
6
  DEFAULT_CONFIGURATION = {
7
7
  'mode' => 'local',
8
+ 'expiry' => 604800, #a day in seconds
8
9
  'public_key' => '',
9
10
  'url' => ''
10
11
  } unless defined? DEFAULT_CONFIGURATION; DEFAULT_CONFIGURATION.freeze
@@ -36,7 +37,10 @@ module SoarAuthenticationToken
36
37
  end
37
38
 
38
39
  def validate_configuration
39
-
40
+ raise "'mode' must be configured" unless @configuration['mode']
41
+ raise "'mode' must be configured as either 'local' or 'remote'" unless ['local','remote'].include?(@configuration['mode'])
42
+ raise "'expiry' must be configured" unless @configuration['expiry']
43
+ raise "'expiry' must be an integer" unless Integer(@configuration['expiry'])
40
44
  end
41
45
 
42
46
  def merge_with_default_configuration(configuration)
@@ -48,7 +52,7 @@ module SoarAuthenticationToken
48
52
  end
49
53
 
50
54
  def expired?(issue_time)
51
- (Time.parse(issue_time) + 604800) < Time.now #TODO make this configurable
55
+ (Time.parse(issue_time) + @configuration['expiry']) < Time.now
52
56
  end
53
57
  end
54
58
  end
@@ -1,3 +1,3 @@
1
1
  module SoarAuthenticationToken
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_authentication_token
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barney de Villiers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: soar_xt