trusona 2.3.0 → 2.4.0
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
- checksums.yaml.gz.sig +0 -0
- data/README.md +3 -2
- data/integrations/buster.rb +15 -0
- data/integrations/spec_helper.rb +3 -0
- data/integrations/trusonafication_spec.rb +18 -3
- data/lib/trusona/resources/trusonafication.rb +19 -15
- data/lib/trusona/trusonafication.rb +11 -3
- data/lib/trusona/version.rb +1 -1
- data/trusona.gemspec +3 -2
- data.tar.gz.sig +0 -0
- metadata +28 -13
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8493dc6973da717a55a1dd6d7bc9e27cbfbbeb79
|
4
|
+
data.tar.gz: f5499e8a6a766f4357268506e6a4c414b7c9b04f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9762a0980e163dc0bddf95b4a77ca3670eb8a9e4b7b6d9a73223e34c85740e967394bc5754fdf7988381a4d5b3c9ed762128c495502337a6363a1ff5782c4f97
|
7
|
+
data.tar.gz: 4bbfca2beab08cb3dcdb4cfbea42cce6c9d33fda916b7baf03750baf9434f61cd3f6bb424b56a928a03ffe2978ff96b9bf4b03375c7d067b091a08cb3d9fa53b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -171,8 +171,9 @@ Note that the custom fields are not used in the case that the Trusonafication is
|
|
171
171
|
| Prompt | `prompt` | N | Should the user be prompted to Accept or Reject this Trusonafication? Defaults to `true`. |
|
172
172
|
| Expiration | `expires_at` | N | The ISO-8601 UTC timestamp of the Trusonafication's expiration. Defaults to 90 seconds from creation. |
|
173
173
|
| Custom Fields | `custom_fields` | N | Arbitrary key-value data fields made available to the Trusonafication. Amount of data in the hash is limited to 1MB |
|
174
|
+
| Callback URL | `callback_url` | N | An HTTPS URL to call when the trusonafication has been completed (accepted, rejected, or expired).<br>The request will be a POST and the body will be the same JSON format as sending a GET request to /api/v2/trusonafications/{id}.<br><br> **NOTE:** The URL should include a randomized segment so it cannot be guessed and abused by third-parties (i.e https://your.domain.com/completed_authentications/f8abe61d-4e51-493f-97b1-464c157624f2). |
|
174
175
|
|
175
|
-
[^1]: You must provide at least one field that would allow Trusona to determine which user to authenticate. The identifier fields are `device_identifier`, `user_identifier`, and `trucode_id`.
|
176
|
+
[^1]: You must provide at least one field that would allow Trusona to determine which user to authenticate. The identifier fields are `device_identifier`, `user_identifier`, `email`, and `trucode_id`.
|
176
177
|
|
177
178
|
#### Retrieving an existing Trusonafication
|
178
179
|
|
@@ -255,7 +256,7 @@ end
|
|
255
256
|
|
256
257
|
### TruCodes
|
257
258
|
|
258
|
-
After a user has scanned a TruCode, it's possible to acquire that user's information by getting the
|
259
|
+
After a user has scanned a TruCode, it's possible to acquire that user's information by getting the
|
259
260
|
scanned TruCode from the server. The code sample below shows how to do that:
|
260
261
|
|
261
262
|
```ruby
|
data/integrations/spec_helper.rb
CHANGED
@@ -7,9 +7,12 @@ SimpleCov.start do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
require 'bundler/setup'
|
10
|
+
require 'active_support/core_ext/numeric/time'
|
11
|
+
require 'rspec/wait'
|
10
12
|
require 'trusona'
|
11
13
|
require 'securerandom'
|
12
14
|
require 'webmock/rspec'
|
15
|
+
require_relative 'buster'
|
13
16
|
|
14
17
|
WebMock.allow_net_connect!
|
15
18
|
|
@@ -12,6 +12,8 @@ RSpec.describe 'Trusonafications' do
|
|
12
12
|
}
|
13
13
|
|
14
14
|
@timeout = 5
|
15
|
+
|
16
|
+
@buster = Buster.new
|
15
17
|
end
|
16
18
|
describe 'creating a trusonafication for a known trusona user' do
|
17
19
|
before do
|
@@ -40,10 +42,8 @@ RSpec.describe 'Trusonafications' do
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
|
-
describe 'creating a trusonafication
|
45
|
+
describe 'creating a trusonafication without a level' do
|
44
46
|
it 'as expected, does not work' do
|
45
|
-
@parameters[:email] = "#{Time.now.to_i}@example.com"
|
46
|
-
|
47
47
|
expect {
|
48
48
|
Trusona::Trusonafication.create(
|
49
49
|
params: @parameters, timeout: @timeout
|
@@ -51,5 +51,20 @@ RSpec.describe 'Trusonafications' do
|
|
51
51
|
}.to raise_error(Trusona::InvalidResourceError)
|
52
52
|
end
|
53
53
|
end
|
54
|
+
describe 'creating a trusonafication with a callback url' do
|
55
|
+
it 'should POST to the URL when the trusonafication is completed' do
|
56
|
+
callback_id = SecureRandom.uuid
|
57
|
+
|
58
|
+
@parameters[:callback_url] = @buster.callback_url(callback_id)
|
59
|
+
@parameters[:expires_at] = 1.second.from_now
|
60
|
+
|
61
|
+
Trusona::EssentialTrusonafication.create(params: @parameters, timeout: @timeout)
|
62
|
+
|
63
|
+
wait_for do
|
64
|
+
callback_result = @buster.callback_result(callback_id)
|
65
|
+
callback_result.code
|
66
|
+
end.to eq(200)
|
67
|
+
end
|
68
|
+
end
|
54
69
|
end
|
55
70
|
# rubocop:enable Metrics/BlockLength
|
@@ -11,7 +11,7 @@ module Trusona
|
|
11
11
|
attr_accessor :device_identifier, :user_identifier, :trucode_id,
|
12
12
|
:resource, :action, :level, :id, :email,
|
13
13
|
:accepted_level, :trusona_id, :expires_at,
|
14
|
-
:user_presence, :prompt, :custom_fields
|
14
|
+
:user_presence, :prompt, :custom_fields, :callback_url
|
15
15
|
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
17
17
|
# rubocop:disable Metrics/MethodLength
|
@@ -32,6 +32,7 @@ module Trusona
|
|
32
32
|
self.prompt = defaulting_to(true, @params[:prompt])
|
33
33
|
self.user_presence = defaulting_to(true, @params[:user_presence])
|
34
34
|
self.custom_fields = @params[:custom_fields]
|
35
|
+
self.callback_url = @params[:callback_url]
|
35
36
|
|
36
37
|
@status = @params[:status]
|
37
38
|
end
|
@@ -44,20 +45,23 @@ module Trusona
|
|
44
45
|
|
45
46
|
# rubocop:disable Metrics/MethodLength
|
46
47
|
def to_json
|
47
|
-
JSON(
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
JSON(
|
49
|
+
device_identifier: device_identifier,
|
50
|
+
user_identifier: user_identifier,
|
51
|
+
trucode_id: trucode_id,
|
52
|
+
trusona_id: trusona_id,
|
53
|
+
email: email,
|
54
|
+
resource: resource,
|
55
|
+
action: action,
|
56
|
+
desired_level: level,
|
57
|
+
id: id,
|
58
|
+
status: @status,
|
59
|
+
prompt: prompt,
|
60
|
+
user_presence: user_presence,
|
61
|
+
custom_fields: custom_fields,
|
62
|
+
expires_at: expires_at&.iso8601,
|
63
|
+
callback_url: callback_url
|
64
|
+
)
|
61
65
|
end
|
62
66
|
# rubocop:enable Metrics/MethodLength
|
63
67
|
|
@@ -55,12 +55,20 @@ module Trusona
|
|
55
55
|
# Accept or Reject this Trusonafication?
|
56
56
|
# @option params [String] :expires_at ('90 seconds') The ISO-8601 UTC
|
57
57
|
# timestamp of the Trusonafication's expiration.
|
58
|
-
# @param timeout [Int] (30) The max amount of time, in seconds, to wait
|
59
|
-
# for a response from the Trusona API when polling for a Trusonafication
|
60
|
-
# result
|
61
58
|
# @option params [Hash] :custom_fields Optional data to be associated with
|
62
59
|
# this Trusonafication and can be used to constomize any UX elements. Total
|
63
60
|
# size of data is limited to 1MB.
|
61
|
+
# @option params [String] :callback_url An HTTPS URL to call when the
|
62
|
+
# trusonafication has been completed (accepted, rejected, or expired). The
|
63
|
+
# request will be a POST and the body will be the same JSON format as
|
64
|
+
# sending a GET request to /api/v2/trusonafications/{id}.
|
65
|
+
#
|
66
|
+
# NOTE: The URL should include a randomized segment so it cannot be guessed
|
67
|
+
# and abused by third-parties (i.e
|
68
|
+
# https://your.domain.com/completed_authentications/f8abe61d-4e51-493f-97b1-464c157624f2).
|
69
|
+
# @param timeout [Int] (30) The max amount of time, in seconds, to wait
|
70
|
+
# for a response from the Trusona API when polling for a Trusonafication
|
71
|
+
# result
|
64
72
|
# @yield [Trusona::Resources::Trusonafication] Yields the completed
|
65
73
|
# Trusonafication to the block
|
66
74
|
# @raise [Trusona::InvalidResourceError] if the resource is not +valid?+
|
data/lib/trusona/version.rb
CHANGED
data/trusona.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
|
30
30
|
|
31
|
+
spec.add_development_dependency 'activesupport', '~> 5.2'
|
31
32
|
spec.add_development_dependency 'bump', '~> 0.5'
|
32
|
-
spec.add_development_dependency 'bundler'
|
33
33
|
spec.add_development_dependency 'dotenv', '~> 2.2'
|
34
34
|
spec.add_development_dependency 'guard', '~> 2.14'
|
35
35
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
@@ -37,8 +37,9 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'guard-yard', '~> 2.2'
|
38
38
|
spec.add_development_dependency 'rake', '~> 10.0'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
40
|
+
spec.add_development_dependency 'rspec-wait', '~> 0.0'
|
40
41
|
spec.add_development_dependency 'rubocop', '~> 0.49'
|
41
42
|
spec.add_development_dependency 'simplecov', '~> 0.14'
|
42
43
|
spec.add_development_dependency 'yard', '~> 0.9'
|
43
|
-
spec.add_development_dependency 'webmock'
|
44
|
+
spec.add_development_dependency 'webmock', '~> 3.5'
|
44
45
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusona
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trusona
|
@@ -60,33 +60,33 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.15'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: activesupport
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '5.2'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '5.2'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: bump
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '0.5'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.5'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: dotenv
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,6 +185,20 @@ dependencies:
|
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '3.0'
|
188
|
+
- !ruby/object:Gem::Dependency
|
189
|
+
name: rspec-wait
|
190
|
+
requirement: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.0'
|
195
|
+
type: :development
|
196
|
+
prerelease: false
|
197
|
+
version_requirements: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0.0'
|
188
202
|
- !ruby/object:Gem::Dependency
|
189
203
|
name: rubocop
|
190
204
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,16 +245,16 @@ dependencies:
|
|
231
245
|
name: webmock
|
232
246
|
requirement: !ruby/object:Gem::Requirement
|
233
247
|
requirements:
|
234
|
-
- - "
|
248
|
+
- - "~>"
|
235
249
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
250
|
+
version: '3.5'
|
237
251
|
type: :development
|
238
252
|
prerelease: false
|
239
253
|
version_requirements: !ruby/object:Gem::Requirement
|
240
254
|
requirements:
|
241
|
-
- - "
|
255
|
+
- - "~>"
|
242
256
|
- !ruby/object:Gem::Version
|
243
|
-
version: '
|
257
|
+
version: '3.5'
|
244
258
|
description: Easily interact with the Trusona REST API
|
245
259
|
email:
|
246
260
|
- engineering@trusona.com
|
@@ -263,6 +277,7 @@ files:
|
|
263
277
|
- bin/setup
|
264
278
|
- certs/trusona.pem
|
265
279
|
- checksum/trusona-0.16.0.gem.sha512
|
280
|
+
- integrations/buster.rb
|
266
281
|
- integrations/device_user_binding_integration_spec.rb
|
267
282
|
- integrations/identity_documents_spec.rb
|
268
283
|
- integrations/paired_tru_code_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|