cased-ruby 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/cased/cli/identity.rb +8 -3
- data/lib/cased/cli/interactive_session.rb +6 -2
- data/lib/cased/cli/session.rb +11 -1
- data/lib/cased/version.rb +1 -1
- 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: 136251a6fad727d85e14bf64bfdb5ecf33fdba19735646c3599398c7a0e44abb
|
4
|
+
data.tar.gz: 94f191ec590bc6bd68ef98b137abbaa052c8438573bb84d9cb9b63ffec4ae8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 613409847cfcda2948b2b3559a754ac6822fca908cec0d1a089475be19801290bf8aee866e592d00bef882b1e3b7027ead484346bd39a404c171b8205a5631fa
|
7
|
+
data.tar.gz: 3a3d8435ecce240a7cff4a83061c57412d08dd1d16e91c9995caf1f755a4706f40744e7ce11c015a4557d66ea1948b6c54caf05f893205a2f8296aedb9780e7b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -135,7 +135,8 @@ end
|
|
135
135
|
|
136
136
|
authentication = Cased::CLI::Authentication.new
|
137
137
|
identity = Cased::CLI::Identity.new
|
138
|
-
|
138
|
+
token, ip_address = identity.identify
|
139
|
+
authentication.token = token
|
139
140
|
|
140
141
|
session = Cased::CLI::Session.new(
|
141
142
|
authentication: authentication,
|
data/lib/cased/cli/identity.rb
CHANGED
@@ -23,15 +23,20 @@ module Cased
|
|
23
23
|
def poll(poll_url)
|
24
24
|
count = 0
|
25
25
|
user_id = nil
|
26
|
+
ip_address = nil
|
26
27
|
|
27
28
|
while user_id.nil?
|
28
29
|
count += 1
|
29
30
|
response = Cased.clients.cli.get(poll_url)
|
30
|
-
|
31
|
-
|
31
|
+
if response.success?
|
32
|
+
user_id = response.body.dig('user', 'id')
|
33
|
+
ip_address = response.body.fetch('ip_address')
|
34
|
+
else
|
35
|
+
sleep 1
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
|
-
user_id
|
39
|
+
[user_id, ip_address]
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
@@ -50,7 +50,9 @@ module Cased
|
|
50
50
|
Cased::CLI::Log.log "You must re-authenticate with Cased due to recent changes to this application's settings."
|
51
51
|
|
52
52
|
identity = Cased::CLI::Identity.new
|
53
|
-
|
53
|
+
token, ip_address = identity.identify
|
54
|
+
session.authentication.token = token
|
55
|
+
session.forwarded_ip_address = ip_address
|
54
56
|
|
55
57
|
create
|
56
58
|
elsif session.unauthorized?
|
@@ -61,7 +63,9 @@ module Cased
|
|
61
63
|
end
|
62
64
|
|
63
65
|
identity = Cased::CLI::Identity.new
|
64
|
-
|
66
|
+
token, ip_address = identity.identify
|
67
|
+
session.authentication.token = token
|
68
|
+
session.forwarded_ip_address = ip_address
|
65
69
|
|
66
70
|
create
|
67
71
|
elsif session.reason_required?
|
data/lib/cased/cli/session.rb
CHANGED
@@ -86,9 +86,17 @@ module Cased
|
|
86
86
|
# @return [String, nil]
|
87
87
|
attr_accessor :reason
|
88
88
|
|
89
|
+
# Public: The forwarded IP V4 or IP V6 address of the user that initiated
|
90
|
+
# the CLI session.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# session.forwarded_ip_address #=> "1.1.1.1"
|
94
|
+
# @return [String, nil]
|
95
|
+
attr_accessor :forwarded_ip_address
|
96
|
+
|
89
97
|
# Public: The client's IP V4 or IP V6 address that initiated the CLI session.
|
90
98
|
# @example
|
91
|
-
# session.
|
99
|
+
# session.ip_address #=> "1.1.1.1"
|
92
100
|
# @return [String, nil]
|
93
101
|
attr_reader :ip_address
|
94
102
|
|
@@ -144,6 +152,7 @@ module Cased
|
|
144
152
|
@command = session.fetch('command')
|
145
153
|
@metadata = session.fetch('metadata')
|
146
154
|
@reason = session.fetch('reason')
|
155
|
+
@forwarded_ip_address = session.fetch('forwarded_ip_address')
|
147
156
|
@ip_address = session.fetch('ip_address')
|
148
157
|
@requester = session.fetch('requester')
|
149
158
|
@responded_at = session['responded_at']
|
@@ -226,6 +235,7 @@ module Cased
|
|
226
235
|
|
227
236
|
response = Cased.clients.cli.post('cli/sessions',
|
228
237
|
user_token: authentication.token,
|
238
|
+
forwarded_ip_address: forwarded_ip_address,
|
229
239
|
reason: reason,
|
230
240
|
metadata: metadata,
|
231
241
|
command: command)
|
data/lib/cased/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cased-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett Bjerkhoel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|