trusona 0.20.0 → 1.0.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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/.env.example +1 -1
- data/README.md +18 -2
- data/integrations/device_user_binding_integration_spec.rb +1 -1
- data/integrations/identity_documents_spec.rb +1 -10
- data/integrations/spec_helper.rb +7 -0
- data/integrations/tru_code_spec.rb +4 -19
- data/integrations/trusonafication_spec.rb +9 -15
- data/integrations/user_accounts_spec.rb +2 -9
- data/integrations/user_identifiers_spec.rb +2 -8
- data/lib/trusona/resources/trusonafication.rb +1 -3
- data/lib/trusona/services/base_service.rb +1 -0
- data/lib/trusona/tru_code_config.rb +0 -4
- data/lib/trusona/trusonafication.rb +0 -2
- data/lib/trusona/version.rb +1 -1
- data/lib/trusona.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aed0dfc5cc1aa759713bc5b7203d92fcf49d1e92
|
4
|
+
data.tar.gz: 0054a20b22545c79d620f503c75ede3c81288b53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b0135e59e32aec39c45e53f429d7ac6ea20e0f2c0b77d0e30d5930440bf414f4d2fb306ed7320aac72493ffcb0776b28d9ddbbc8075c9fc8c1115a0da4d7d9e
|
7
|
+
data.tar.gz: 58631efaa56d4999fdaef324f192ffb4ec4141d637355e76481b884522775b8e8b170c17ff828f2b70b55cd68ee4621f4f26f46da18d9efd186bf392dc82ca49
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.env.example
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,7 @@ Configuring the Trusona gem is easy. We recommend using environment variables an
|
|
38
38
|
|
39
39
|
```ruby
|
40
40
|
Trusona.config do |c|
|
41
|
-
c.tru_codes_host = ENV['
|
41
|
+
c.tru_codes_host = ENV['TRU_CODES_HOST']
|
42
42
|
c.api_host = ENV['TRUSONA_API_HOST']
|
43
43
|
c.secret = ENV['TRUSONA_SECRET']
|
44
44
|
c.token = ENV['TRUSONA_TOKEN']
|
@@ -151,7 +151,6 @@ use cases, except you use the `email` parameter rather than `user_identifier` or
|
|
151
151
|
| Tru Code ID | `trucode_id` | N[^1] | A Tru Code ID that has/will be paired by a device using the Trusona Mobile SDK that can be used to lookup the `device_identifier` |
|
152
152
|
| User Presence | `user_presence` | N | Should the user be required to demonstrate presence (e.g. via Biometric) when accepting this Trusonafication? Defaults to `true`. |
|
153
153
|
| Prompt | `prompt` | N | Should the user be prompted to Accept or Reject this Trusonafication? Defaults to `true`. |
|
154
|
-
| Callback URL | `callback_url` | N | A URL that will be called when the Trusonafication is completed. |
|
155
154
|
| Expiration | `expires_at` | N | The ISO-8601 UTC timestamp of the Trusonafication's expiration. Defaults to 90 seconds from creation. |
|
156
155
|
|
157
156
|
[^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`.
|
@@ -263,6 +262,23 @@ continuous integration builds.
|
|
263
262
|
|
264
263
|
Included in the `integrations` directory are a set of ever growing integration tests which rely on the Trusona config variables in your environment (try `.env`.)
|
265
264
|
|
265
|
+
##### One time setup
|
266
|
+
|
267
|
+
```bash
|
268
|
+
cp .env.example .env
|
269
|
+
```
|
270
|
+
|
271
|
+
Edit .env:
|
272
|
+
|
273
|
+
```txt
|
274
|
+
TRUSONA_TOKEN=<A Server RP token that can send trusonafications to your email>
|
275
|
+
TRUSONA_SECRET=<The Server RP secret>
|
276
|
+
TRUSONA_API_HOST=https://api.staging.trusona.net
|
277
|
+
INTEGRATION_TEST_EMAIL=<your UAT email>
|
278
|
+
```
|
279
|
+
|
280
|
+
##### Running the tests
|
281
|
+
|
266
282
|
`bundle exec rspec integrations/`
|
267
283
|
|
268
284
|
#### Code Coverage
|
@@ -1,17 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe 'Identity Documents' do
|
6
|
-
before do
|
7
|
-
Trusona.config do |c|
|
8
|
-
c.tru_codes_host = ENV['TRUCODES_HOST']
|
9
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
10
|
-
c.secret = ENV['TRUSONA_SECRET']
|
11
|
-
c.token = ENV['TRUSONA_TOKEN']
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
6
|
describe 'finding all documents for a user identifier' do
|
16
7
|
it 'should work' do
|
17
8
|
result = Trusona::IdentityDocument.all(user_identifier: SecureRandom.uuid)
|
data/integrations/spec_helper.rb
CHANGED
@@ -1,19 +1,10 @@
|
|
1
1
|
# frozen_string_literal:true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
require 'tempfile'
|
5
5
|
|
6
6
|
# rubocop:disable Metrics/BlockLength
|
7
7
|
RSpec.describe 'TruCodes' do
|
8
|
-
before do
|
9
|
-
Trusona.config do |c|
|
10
|
-
c.tru_codes_host = ENV['TRUCODES_HOST']
|
11
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
12
|
-
c.secret = ENV['TRUSONA_SECRET']
|
13
|
-
c.token = ENV['TRUSONA_TOKEN']
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
8
|
describe 'creating a TruCode to show on your website' do
|
18
9
|
before do
|
19
10
|
@reference_id = SecureRandom.uuid
|
@@ -28,18 +19,12 @@ RSpec.describe 'TruCodes' do
|
|
28
19
|
|
29
20
|
result = Trusona::TruCode.create(code)
|
30
21
|
|
31
|
-
expect(result.tru_code).to be
|
32
|
-
expect(result.signature).to be
|
33
22
|
expect(result.relying_party_id).to be
|
34
|
-
expect(result.
|
35
|
-
expect(result.
|
36
|
-
expect(result.tru_code.payload).to be
|
37
|
-
expect(result.tru_code.image).to be
|
38
|
-
expect(result.tru_code.id).to be
|
39
|
-
expect(result.tru_code.reference_id).to eq(@reference_id)
|
23
|
+
expect(result.id).to be
|
24
|
+
expect(result.payload).to be
|
40
25
|
end
|
41
26
|
|
42
|
-
|
27
|
+
xdescribe 'and when you want to check the status of that TruCode' do
|
43
28
|
before do
|
44
29
|
@qr = Tempfile.new('tru_code')
|
45
30
|
code = Trusona::Resources::TruCode.new(
|
@@ -1,21 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
|
5
5
|
# rubocop:disable Metrics/BlockLength
|
6
6
|
RSpec.describe 'Trusonafications' do
|
7
7
|
before do
|
8
|
-
Trusona.config do |c|
|
9
|
-
c.tru_codes_host = ENV['TRUCODES_HOST']
|
10
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
11
|
-
c.secret = ENV['TRUSONA_SECRET']
|
12
|
-
c.token = ENV['TRUSONA_TOKEN']
|
13
|
-
end
|
14
|
-
|
15
8
|
@parameters = {
|
16
9
|
resource: 'integration test suite',
|
17
10
|
action: 'verify',
|
18
|
-
|
11
|
+
email: ENV['INTEGRATION_TEST_EMAIL']
|
19
12
|
}
|
20
13
|
|
21
14
|
@timeout = 5
|
@@ -29,7 +22,7 @@ RSpec.describe 'Trusonafications' do
|
|
29
22
|
|
30
23
|
it 'just works' do
|
31
24
|
expect(@trusonafication.status).to eq(:in_progress)
|
32
|
-
expect(@trusonafication.
|
25
|
+
expect(@trusonafication.email).to eq(ENV['INTEGRATION_TEST_EMAIL'])
|
33
26
|
expect(@trusonafication.resource).to eq('integration test suite')
|
34
27
|
expect(@trusonafication.action).to eq('verify')
|
35
28
|
expect(@trusonafication.level).to eq(2)
|
@@ -49,12 +42,13 @@ RSpec.describe 'Trusonafications' do
|
|
49
42
|
end
|
50
43
|
describe 'creating a trusonafication for an unknown trusona user' do
|
51
44
|
it 'as expected, does not work' do
|
52
|
-
@parameters[:
|
53
|
-
trusonafication = Trusona::Trusonafication.create(
|
54
|
-
params: @parameters, timeout: @timeout
|
55
|
-
)
|
45
|
+
@parameters[:email] = "#{Time.now.to_i}@example.com"
|
56
46
|
|
57
|
-
expect
|
47
|
+
expect {
|
48
|
+
Trusona::Trusonafication.create(
|
49
|
+
params: @parameters, timeout: @timeout
|
50
|
+
)
|
51
|
+
}.to raise_error(Trusona::InvalidResourceError)
|
58
52
|
end
|
59
53
|
end
|
60
54
|
end
|
@@ -1,19 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
|
5
5
|
# rubocop:disable Metrics/BlockLength
|
6
6
|
RSpec.describe 'Trusona User Accounts' do
|
7
7
|
before do
|
8
|
-
Trusona.config do |c|
|
9
|
-
c.tru_codes_host = ENV['TRUCODES_HOST']
|
10
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
11
|
-
c.secret = ENV['TRUSONA_SECRET']
|
12
|
-
c.token = ENV['TRUSONA_TOKEN']
|
13
|
-
end
|
14
|
-
|
15
8
|
@account_lookup = { trusona_id: '167791378' }
|
16
|
-
@email_lookup = { email: '
|
9
|
+
@email_lookup = { email: ENV['INTEGRATION_TEST_EMAIL'] }
|
17
10
|
end
|
18
11
|
|
19
12
|
describe 'retrieving a user account with their Trusona ID' do
|
@@ -1,15 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe 'Trusona User Identifiers' do
|
6
6
|
before do
|
7
|
-
Trusona.config do |c|
|
8
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
9
|
-
c.secret = ENV['TRUSONA_SECRET']
|
10
|
-
c.token = ENV['TRUSONA_TOKEN']
|
11
|
-
end
|
12
|
-
|
13
7
|
@identifier = Trusona::Resources::UserIdentifier.new(identifier: 'am9uZXNAdGFjb3MubmV0Cg==', trusona_id: '264683802')
|
14
8
|
end
|
15
9
|
|
@@ -22,7 +16,7 @@ RSpec.describe 'Trusona User Identifiers' do
|
|
22
16
|
end
|
23
17
|
end
|
24
18
|
|
25
|
-
|
19
|
+
xcontext 'when a valid identifier exists' do
|
26
20
|
it 'should be successful' do
|
27
21
|
res = Trusona::UserIdentifier.find_by(identifier: @identifier.identifier)
|
28
22
|
expect(res.trusona_id).to eq @identifier.trusona_id
|
@@ -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, :
|
14
|
+
:user_presence, :prompt
|
15
15
|
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
17
17
|
# rubocop:disable Metrics/MethodLength
|
@@ -31,7 +31,6 @@ module Trusona
|
|
31
31
|
self.trusona_id = @params[:trusona_id]
|
32
32
|
self.prompt = defaulting_to(true, @params[:prompt])
|
33
33
|
self.user_presence = defaulting_to(true, @params[:user_presence])
|
34
|
-
self.callback_url = @params[:callback_url]
|
35
34
|
|
36
35
|
@status = @params[:status]
|
37
36
|
end
|
@@ -56,7 +55,6 @@ module Trusona
|
|
56
55
|
status: @status,
|
57
56
|
prompt: prompt,
|
58
57
|
user_presence: user_presence,
|
59
|
-
callback_url: callback_url,
|
60
58
|
expires_at: expires_at&.iso8601)
|
61
59
|
end
|
62
60
|
# rubocop:enable Metrics/MethodLength
|
@@ -53,8 +53,6 @@ module Trusona
|
|
53
53
|
# Trusonafication?
|
54
54
|
# @option params [Boolean] :prompt (true) Should the user be prompted to
|
55
55
|
# Accept or Reject this Trusonafication?
|
56
|
-
# @option params [String] :callback_url ('') A URL that will be called when
|
57
|
-
# the Trusonafication is completed.
|
58
56
|
# @option params [String] :expires_at ('90 seconds') The ISO-8601 UTC
|
59
57
|
# timestamp of the Trusonafication's expiration.
|
60
58
|
# @param timeout [Int] (30) The max amount of time, in seconds, to wait
|
data/lib/trusona/version.rb
CHANGED
data/lib/trusona.rb
CHANGED
@@ -101,7 +101,7 @@ module Trusona
|
|
101
101
|
# using an instance of +Trusona::Configuration+.
|
102
102
|
#
|
103
103
|
# Trusona.config do |c|
|
104
|
-
# c.tru_codes_host = ENV['
|
104
|
+
# c.tru_codes_host = ENV['TRU_CODES_HOST']
|
105
105
|
# c.api_host = ENV['TRUSONA_API_HOST']
|
106
106
|
# c.secret = ENV['TRUSONA_SECRET']
|
107
107
|
# c.token = ENV['TRUSONA_TOKEN']
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trusona
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
vbhUT8kOS+bZTalorEol37DD/P4Bbv0fMpw+ozetR2RmwhwTKPKJ5r0oQP6tiqHn
|
36
36
|
hQ==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-
|
38
|
+
date: 2018-11-06 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: httparty
|
@@ -332,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
334
|
rubyforge_project:
|
335
|
-
rubygems_version: 2.
|
335
|
+
rubygems_version: 2.6.14
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: Trusona REST API wrapper
|
metadata.gz.sig
CHANGED
Binary file
|