etna 0.1.24 → 0.1.25
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/lib/commands.rb +0 -2
- data/lib/etna/clients/base_client.rb +4 -1
- data/lib/etna/test_auth.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7ff510ea92327172e9682b7b07e65dc299d2f7246f7250ece8a2071891eb965
|
|
4
|
+
data.tar.gz: a13cb194bc64ae42ef76c0d2daf9ca6041ae46b37fd70db3c90752c80a479ae2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d42498eecb1db7f476e004a7824f1e7b05c10685ded4da125d748c192ea7c2820c3efb3aff60fa7ed3ed026aace0503a12ed2ac61812ba23502925b19d674e99
|
|
7
|
+
data.tar.gz: d584c7eef1d6d874d8bf38d5eb046f91b29de1ec10485b89094ed52dcc8f29e8d43ec8da39fd97a5399a0eba7f9f0da14e340bb026f7b0cefac559d23d40aac9
|
data/lib/commands.rb
CHANGED
|
@@ -355,8 +355,6 @@ class EtnaApp
|
|
|
355
355
|
def execute(project_name, redcap_tokens, models: "all", commit: false)
|
|
356
356
|
raise "Must provide at least one REDCap token (comma-separated)." unless redcap_tokens.split(',').length > 0
|
|
357
357
|
|
|
358
|
-
raise "Your token is expired." if polyphemus_client.token_expired?
|
|
359
|
-
|
|
360
358
|
puts "NOTE: This is a **preview** of what the data loading will look like. Use the --commit flag to load records into Magma." unless commit
|
|
361
359
|
|
|
362
360
|
polyphemus_client.job(Etna::Clients::Polyphemus::RedcapJobRequest.new(
|
|
@@ -10,13 +10,15 @@ module Etna
|
|
|
10
10
|
raise "#{self.class.name} client configuration is missing host." unless host
|
|
11
11
|
raise "#{self.class.name} client configuration is missing token." unless token
|
|
12
12
|
|
|
13
|
+
@token = token
|
|
14
|
+
raise "Your token is expired." if token_expired?
|
|
15
|
+
|
|
13
16
|
@etna_client = ::Etna::Client.new(
|
|
14
17
|
host,
|
|
15
18
|
token,
|
|
16
19
|
routes_available: false,
|
|
17
20
|
ignore_ssl: ignore_ssl)
|
|
18
21
|
@host = host
|
|
19
|
-
@token = token
|
|
20
22
|
@ignore_ssl = ignore_ssl
|
|
21
23
|
end
|
|
22
24
|
|
|
@@ -26,6 +28,7 @@ module Etna
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def token_will_expire?(offset=3000)
|
|
31
|
+
# offset in seconds
|
|
29
32
|
# Will the user's token expire in the given amount of time?
|
|
30
33
|
epoch_seconds = JSON.parse(Base64.urlsafe_decode64(token.split('.')[1]))["exp"]
|
|
31
34
|
expiration = DateTime.strptime(epoch_seconds.to_s, "%s")
|
data/lib/etna/test_auth.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Etna
|
|
|
7
7
|
class TestAuth < Auth
|
|
8
8
|
def self.token_header(params)
|
|
9
9
|
token = Base64.strict_encode64(params.to_json)
|
|
10
|
-
return [ 'Authorization', "Etna
|
|
10
|
+
return [ 'Authorization', "Etna something.#{token}" ]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.token_param(params)
|
|
@@ -36,8 +36,12 @@ module Etna
|
|
|
36
36
|
|
|
37
37
|
return false unless token
|
|
38
38
|
|
|
39
|
-
#
|
|
40
|
-
|
|
39
|
+
# Here we simply base64-encode our user hash and pass it through
|
|
40
|
+
# In order to behave more like "real" tokens, we expect the user hash to be
|
|
41
|
+
# in index 1 after splitting by ".".
|
|
42
|
+
# We do this to support Metis client tests, we pass in tokens with multiple "."-separated parts, so
|
|
43
|
+
# have to account for that.
|
|
44
|
+
payload = JSON.parse(Base64.decode64(token.split('.')[1]))
|
|
41
45
|
|
|
42
46
|
request.env['etna.user'] = Etna::User.new(payload.map{|k,v| [k.to_sym, v]}.to_h, token)
|
|
43
47
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: etna
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.25
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Saurabh Asthana
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-01-
|
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|