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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30c0c39a09540212db058ce833ebcd693e2defd2
|
4
|
+
data.tar.gz: cc20f98a7bdaa653cd2fe437946d6646b268bd78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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) +
|
55
|
+
(Time.parse(issue_time) + @configuration['expiry']) < Time.now
|
52
56
|
end
|
53
57
|
end
|
54
58
|
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.
|
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-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar_xt
|