trusona 0.19.0 → 0.20.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.tar.gz.sig +0 -0
- data/README.md +26 -11
- data/lib/trusona/device_user_binding.rb +2 -1
- data/lib/trusona/errors.rb +4 -0
- data/lib/trusona/identity_document.rb +2 -0
- data/lib/trusona/resources/trusonafication.rb +4 -2
- data/lib/trusona/services/base_service.rb +6 -0
- data/lib/trusona/trusonafication.rb +5 -1
- data/lib/trusona/version.rb +1 -1
- data/lib/trusona/workers/trusonafication_creator.rb +1 -1
- data/lib/trusona/workers/trusonafication_finder.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdcf928f661f66469a27da5a6515b3b1ec68b3ce245faaa76158c061f17c1fe7
|
4
|
+
data.tar.gz: dc9389c4b77105a019ee0d0ffb6ca2de767f8eebca50b4fb75201424613b15ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e44c1b04895ecf2b2678276b39b1eeeab62694354f649f688c4977563fc1da549fcb547606a0d9edda41a38d1d6133c0780f801ebf45b1f16aed4501c71e0cb
|
7
|
+
data.tar.gz: 04184f98a61b4fed7906ea170eed8e8dfb2a603ca9fab25bf99794274dc9aad6723995763b74166012616f9105cd443160c342d15d00e651d008d7343904c281
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -87,11 +87,9 @@ The binding requires two values, the user identifier that helps you identify the
|
|
87
87
|
Trusona::DeviceUserBinding.activate(id: binding.id)
|
88
88
|
```
|
89
89
|
|
90
|
-
### Trusonafications
|
90
|
+
### Creating Trusonafications
|
91
91
|
|
92
|
-
#### Creating
|
93
|
-
|
94
|
-
A simple Essential level Trusonafication
|
92
|
+
#### Creating an Essential Trusonafication
|
95
93
|
|
96
94
|
```ruby
|
97
95
|
Trusona::EssentialTrusonafication.create(params: {
|
@@ -101,29 +99,46 @@ A simple Essential level Trusonafication
|
|
101
99
|
})
|
102
100
|
```
|
103
101
|
|
104
|
-
|
102
|
+
By default, Essential Trusonafications are built such that the user's presence is required and a prompt asking the user to "Accept" or "Reject" the Trusonafication is presented by the Trusona Mobile SDK. A user's presence is determined by their ability to interact with the device's OS Security, usually by using a biometric or entering the device passcode.
|
103
|
+
|
104
|
+
#### Creating an Essential Trusonafication, without user presence or a prompt
|
105
105
|
|
106
106
|
```ruby
|
107
|
-
Trusona::
|
107
|
+
Trusona::EssentialTrusonafication.create(params: {
|
108
108
|
action: 'login',
|
109
109
|
resource: 'Acme Bank',
|
110
|
-
device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
|
110
|
+
device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI',
|
111
|
+
user_presence: false,
|
112
|
+
prompt: false
|
111
113
|
})
|
112
114
|
```
|
113
115
|
|
114
|
-
|
116
|
+
In the above example, the addition of `user_presence: false` and `prompt: false` will result in a Trusonafication that can be accepted solely with possession of the device.
|
115
117
|
|
118
|
+
#### Creating an Essential Trusonafication, with the user's email address
|
116
119
|
```ruby
|
117
120
|
Trusona::EssentialTrusonafication.create(params: {
|
118
121
|
action: 'login',
|
119
122
|
resource: 'Acme Bank',
|
120
|
-
|
121
|
-
user_presence: false,
|
122
|
-
prompt: false
|
123
|
+
email: 'user@domain.com'
|
123
124
|
})
|
124
125
|
```
|
126
|
+
In some cases you may be able to send a Trusonafication to a user
|
127
|
+
by specifying their email address. This is the case if one of the following is true:
|
128
|
+
- You have verified ownership of a domain through the Trusona Developer's site
|
129
|
+
- You have an agreement with Trusona allowing you to send Trusonafications to any email address.
|
130
|
+
Creating a Trusonafication with an email address is similar to the other
|
131
|
+
use cases, except you use the `email` parameter rather than `user_identifier` or `device_identifier`.
|
125
132
|
|
133
|
+
#### An Executive level Trusonafication
|
126
134
|
|
135
|
+
```ruby
|
136
|
+
Trusona::ExecutiveTrusonafication.create(params: {
|
137
|
+
action: 'login',
|
138
|
+
resource: 'Acme Bank',
|
139
|
+
device_identifier: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
|
140
|
+
})
|
141
|
+
```
|
127
142
|
|
128
143
|
#### Trusonafication Options
|
129
144
|
|
@@ -30,10 +30,10 @@ module Trusona
|
|
30
30
|
# device: 'PBanKaajTmz_Cq1pDkrRzyeISBSBoGjExzp5r6-UjcI'
|
31
31
|
# )
|
32
32
|
#
|
33
|
-
|
34
33
|
def self.create(user: nil, device: nil)
|
35
34
|
raise ArgumentError, 'User is missing' if user.nil? || user.empty?
|
36
35
|
raise ArgumentError, 'Device is missing' if device.nil? || device.empty?
|
36
|
+
|
37
37
|
Trusona::Workers::DeviceUserBindingCreator.new.create(
|
38
38
|
user: user, device: device
|
39
39
|
)
|
@@ -50,6 +50,7 @@ module Trusona
|
|
50
50
|
|
51
51
|
def self.activate(id: nil)
|
52
52
|
raise ArgumentError if id.nil? || id.empty?
|
53
|
+
|
53
54
|
Trusona::Workers::DeviceUserBindingActivator.new.activate(id: id)
|
54
55
|
end
|
55
56
|
end
|
data/lib/trusona/errors.rb
CHANGED
@@ -39,6 +39,10 @@ module Trusona
|
|
39
39
|
# An error resulting from 400 errors from the Trusona REST API
|
40
40
|
class BadRequestError < RequestError; end
|
41
41
|
|
42
|
+
##
|
43
|
+
# An error resulting from 422 errors from the Trusona REST API
|
44
|
+
class UnprocessableEntityError < RequestError; end
|
45
|
+
|
42
46
|
##
|
43
47
|
# An error resulting from 424 errors from the Trusona REST API
|
44
48
|
class FailedDependencyError < RequestError; end
|
@@ -30,6 +30,7 @@ module Trusona
|
|
30
30
|
def self.all(user_identifier: nil)
|
31
31
|
# rubocop:disable Metrics/LineLength
|
32
32
|
raise ArgumentError, 'A user identifier is required.' unless user_identifier
|
33
|
+
|
33
34
|
# rubocop:enable Metrics/LineLength
|
34
35
|
|
35
36
|
Trusona::Workers::IdentityDocumentFinder.new.find_all(user_identifier)
|
@@ -56,6 +57,7 @@ module Trusona
|
|
56
57
|
def self.find(id: nil)
|
57
58
|
# rubocop:disable Metrics/LineLength
|
58
59
|
raise ArgumentError, 'An Identity Document identifier is required.' unless id
|
60
|
+
|
59
61
|
# rubocop:enable Metrics/LineLength
|
60
62
|
|
61
63
|
Trusona::Workers::IdentityDocumentFinder.new.find(id)
|
@@ -9,7 +9,7 @@ module Trusona
|
|
9
9
|
include Trusona::Helpers::TimeNormalizer
|
10
10
|
|
11
11
|
attr_accessor :device_identifier, :user_identifier, :trucode_id,
|
12
|
-
:resource, :action, :level, :id,
|
12
|
+
:resource, :action, :level, :id, :email,
|
13
13
|
:accepted_level, :trusona_id, :expires_at,
|
14
14
|
:user_presence, :callback_url, :prompt
|
15
15
|
|
@@ -23,6 +23,7 @@ module Trusona
|
|
23
23
|
self.device_identifier = @params[:device_identifier]
|
24
24
|
self.user_identifier = @params[:user_identifier]
|
25
25
|
self.trucode_id = @params[:trucode_id]
|
26
|
+
self.email = @params[:email]
|
26
27
|
self.expires_at = normalize_time(@params[:expires_at])
|
27
28
|
self.id = @params[:id]
|
28
29
|
self.level = @params[:level]
|
@@ -47,6 +48,7 @@ module Trusona
|
|
47
48
|
user_identifier: user_identifier,
|
48
49
|
trucode_id: trucode_id,
|
49
50
|
trusona_id: trusona_id,
|
51
|
+
email: email,
|
50
52
|
resource: resource,
|
51
53
|
action: action,
|
52
54
|
desired_level: level,
|
@@ -130,7 +132,7 @@ module Trusona
|
|
130
132
|
end
|
131
133
|
|
132
134
|
def identifier
|
133
|
-
device_identifier || user_identifier || trucode_id || trusona_id
|
135
|
+
device_identifier || user_identifier || trucode_id || trusona_id || email
|
134
136
|
end
|
135
137
|
end
|
136
138
|
end
|
@@ -67,6 +67,8 @@ module Trusona
|
|
67
67
|
not_found
|
68
68
|
when 403
|
69
69
|
unauthorized
|
70
|
+
when 422
|
71
|
+
unprocessable_entity
|
70
72
|
when 424
|
71
73
|
failed_dependency
|
72
74
|
when 500..599
|
@@ -87,6 +89,10 @@ module Trusona
|
|
87
89
|
raise Trusona::BadRequestError, readable_error
|
88
90
|
end
|
89
91
|
|
92
|
+
def unprocessable_entity
|
93
|
+
raise Trusona::UnprocessableEntityError, readable_error
|
94
|
+
end
|
95
|
+
|
90
96
|
def failed_dependency
|
91
97
|
raise Trusona::FailedDependencyError, readable_error
|
92
98
|
end
|
@@ -42,6 +42,9 @@ module Trusona
|
|
42
42
|
# @option params [String] :user_identifier The user identifier,
|
43
43
|
# previously registered with Trusona, of the user to which this
|
44
44
|
# Trusonafication will be sent.
|
45
|
+
# @option params [String] :email The user email address,
|
46
|
+
# previously registered with Trusona, of the user to which this
|
47
|
+
# Trusonafication will be sent.
|
45
48
|
# @option params [String] :trucode_id The TruCode ID that has either been
|
46
49
|
# scanned or will be scanned using the mobile SDK that will be used to
|
47
50
|
# determine which device to send the Trusonafication to.
|
@@ -86,7 +89,8 @@ module Trusona
|
|
86
89
|
normalized_params[:user_identifier] ||
|
87
90
|
normalized_params[:device_identifier] ||
|
88
91
|
normalized_params[:trucode_id] ||
|
89
|
-
normalized_params[:trusona_id]
|
92
|
+
normalized_params[:trusona_id] ||
|
93
|
+
normalized_params[:email]
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
data/lib/trusona/version.rb
CHANGED
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: 0.20.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-10-24 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: httparty
|
metadata.gz.sig
CHANGED
Binary file
|