trusona 1.0.1 → 2.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.tar.gz.sig +0 -0
- data/.travis.yml +5 -6
- data/DEVELOP.md +74 -0
- data/README.md +8 -72
- data/integrations/spec_helper.rb +0 -1
- data/lib/trusona.rb +11 -29
- data/lib/trusona/services/tru_codes_service.rb +1 -1
- data/lib/trusona/version.rb +1 -1
- metadata +4 -4
- metadata.gz.sig +0 -0
- data/release-gem +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d7dcf565b866754150b98eff9c086093ef77bb1
|
4
|
+
data.tar.gz: 32c9eb74488c07fe534f3c1fc6060bce95c19a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511921672c8a23e8b1d67a58911bfba6329ad9a687e8319eb29a83e380774aedb8a8b4fe00025db150c0412b1fc10dda680511a39d8910966cecb86b02fb14ab
|
7
|
+
data.tar.gz: 3be6d6bee99c64e6b0c2dd2c7a05afca8b0309d27713e4510ad468a0cfb4c7b8faeee71efd83837109529dd9ce004de0dc57e8b20937b0c8c9296087e5d767cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -7,7 +7,6 @@ rvm:
|
|
7
7
|
- 2.5.1
|
8
8
|
before_install:
|
9
9
|
- openssl aes-256-cbc -K $encrypted_b73e363d372e_key -iv $encrypted_b73e363d372e_iv -in trusona.key.pem.enc -out trusona.key.pem -d
|
10
|
-
- gem install bundler -v 1.15.1
|
11
10
|
before_script:
|
12
11
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
12
|
- chmod +x ./cc-test-reporter
|
@@ -18,12 +17,12 @@ script:
|
|
18
17
|
- gem build trusona.gemspec
|
19
18
|
after_script:
|
20
19
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
21
|
-
before_deploy:
|
22
|
-
- gem install bundler -v 1.15.1
|
23
20
|
deploy:
|
21
|
+
provider: rubygems
|
22
|
+
api_key: $RUBYGEMS_API_KEY
|
23
|
+
gem: trusona
|
24
|
+
gemspec: trusona.gemspec
|
24
25
|
skip_cleanup: true
|
25
|
-
provider: script
|
26
|
-
script: "./release-gem"
|
27
26
|
on:
|
28
27
|
tags: true
|
29
|
-
rvm: '2.
|
28
|
+
rvm: '2.4.3'
|
data/DEVELOP.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
## Development
|
2
|
+
|
3
|
+
### Patterns
|
4
|
+
|
5
|
+
The Trusona gem is built with a few principles in mind:
|
6
|
+
|
7
|
+
1. Provide a simple, idomatic, rails-like public interface.
|
8
|
+
1. Reduce the scope of the internals exposed to the end-user of the gem.
|
9
|
+
|
10
|
+
#### Workers
|
11
|
+
|
12
|
+
Behind the public facing API are a variety of Workers that complete simple, single-focused tasks. For example, when creating a Trusonafication, the responsibility of creation is offloaded to the `Trusona::Workers::TrusonaficationCreator`. This pattern is used for nearly all aspects of the SDK internals.
|
13
|
+
|
14
|
+
#### Services
|
15
|
+
|
16
|
+
Communicating with the Trusona API is done via a set of `Trusona::Services` which are responsible for making HMAC'd requests to the Trusona API and verifying the HMAC'd responses from the Trusona API.
|
17
|
+
|
18
|
+
#### Resources
|
19
|
+
|
20
|
+
Resources are designed to be simple representations of entities which are represented by the Trusona API.
|
21
|
+
|
22
|
+
#### Mappers
|
23
|
+
|
24
|
+
Mappers help translate JSON representations of Trusona API entities to Resource objects.
|
25
|
+
|
26
|
+
### Rubocop
|
27
|
+
|
28
|
+
`Rubocop` is used to ensure adherence to an known style guide. It can be run
|
29
|
+
from the command line. Rubocop standards are currently _not_ enforced during
|
30
|
+
continuous integration builds.
|
31
|
+
|
32
|
+
`bundle exec rubocop lib`
|
33
|
+
|
34
|
+
### Testing
|
35
|
+
|
36
|
+
`bundle exec rake`
|
37
|
+
|
38
|
+
#### Integration Tests
|
39
|
+
|
40
|
+
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`.)
|
41
|
+
|
42
|
+
##### One time setup
|
43
|
+
|
44
|
+
```bash
|
45
|
+
cp .env.example .env
|
46
|
+
```
|
47
|
+
|
48
|
+
Edit .env:
|
49
|
+
|
50
|
+
```txt
|
51
|
+
TRUSONA_TOKEN=<A Server RP token that can send trusonafications to your email>
|
52
|
+
TRUSONA_SECRET=<The Server RP secret>
|
53
|
+
TRUSONA_API_HOST=https://api.staging.trusona.net
|
54
|
+
INTEGRATION_TEST_EMAIL=<your UAT email>
|
55
|
+
```
|
56
|
+
|
57
|
+
##### Running the tests
|
58
|
+
|
59
|
+
`bundle exec rspec integrations/`
|
60
|
+
|
61
|
+
#### Code Coverage
|
62
|
+
|
63
|
+
Code coverage is calculated used `SimpleCov` and can be found in the `coverage`
|
64
|
+
directory after running the tests
|
65
|
+
|
66
|
+
### Deployment
|
67
|
+
|
68
|
+
To deploy a new version of the gem to Artifactory, use `bump` to bump the
|
69
|
+
version by either `major`, `minor` or `patch` and then push the tags to
|
70
|
+
github. Travis CI will build and deploy any tagged commits.
|
71
|
+
|
72
|
+
1. Ensure a clean working directory
|
73
|
+
1. `bundle exec bump patch --tag`
|
74
|
+
1. `git push; and git push origin --tags`
|
data/README.md
CHANGED
@@ -38,8 +38,6 @@ 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['TRU_CODES_HOST']
|
42
|
-
c.api_host = ENV['TRUSONA_API_HOST']
|
43
41
|
c.secret = ENV['TRUSONA_SECRET']
|
44
42
|
c.token = ENV['TRUSONA_TOKEN']
|
45
43
|
end
|
@@ -221,77 +219,15 @@ You may wish to disable a user from having the ability to authenticate from any
|
|
221
219
|
|
222
220
|
The deactivated user can be reactivated at a later date by binding them to a new device in Trusona.
|
223
221
|
|
224
|
-
## Development
|
225
222
|
|
226
|
-
###
|
223
|
+
### Using a specific Trusona region
|
227
224
|
|
228
|
-
|
225
|
+
All users are provisioned in the default region. Unless otherwise noted, you will not need to configure Trusona to use a specific region. If you have been provisioned in a specific region, you will need to point the SDK to use that region. This can be done by configuring the region endpoint as the `api_host`. For example:
|
229
226
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
#### Services
|
238
|
-
|
239
|
-
Communicating with the Trusona API is done via a set of `Trusona::Services` which are responsible for making HMAC'd requests to the Trusona API and verifying the HMAC'd responses from the Trusona API.
|
240
|
-
|
241
|
-
#### Resources
|
242
|
-
|
243
|
-
Resources are designed to be simple representations of entities which are represented by the Trusona API.
|
244
|
-
|
245
|
-
#### Mappers
|
246
|
-
|
247
|
-
Mappers help translate JSON representations of Trusona API entities to Resource objects.
|
248
|
-
|
249
|
-
### Rubocop
|
250
|
-
|
251
|
-
`Rubocop` is used to ensure adherence to an known style guide. It can be run
|
252
|
-
from the command line. Rubocop standards are currently _not_ enforced during
|
253
|
-
continuous integration builds.
|
254
|
-
|
255
|
-
`bundle exec rubocop lib`
|
256
|
-
|
257
|
-
### Testing
|
258
|
-
|
259
|
-
`bundle exec rake`
|
260
|
-
|
261
|
-
#### Integration Tests
|
262
|
-
|
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`.)
|
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>
|
227
|
+
```ruby
|
228
|
+
Trusona.config do |c|
|
229
|
+
c.api_host = 'https://api.ap.trusona.net'
|
230
|
+
c.secret = ENV['TRUSONA_SECRET']
|
231
|
+
c.token = ENV['TRUSONA_TOKEN']
|
232
|
+
end
|
278
233
|
```
|
279
|
-
|
280
|
-
##### Running the tests
|
281
|
-
|
282
|
-
`bundle exec rspec integrations/`
|
283
|
-
|
284
|
-
#### Code Coverage
|
285
|
-
|
286
|
-
Code coverage is calculated used `SimpleCov` and can be found in the `coverage`
|
287
|
-
directory after running the tests
|
288
|
-
|
289
|
-
### Deployment
|
290
|
-
|
291
|
-
To deploy a new version of the gem to Artifactory, use `bump` to bump the
|
292
|
-
version by either `major`, `minor` or `patch` and then push the tags to
|
293
|
-
github. Travis CI will build and deploy any tagged commits.
|
294
|
-
|
295
|
-
1. Ensure a clean working directory
|
296
|
-
1. `bundle exec bump patch --tag`
|
297
|
-
1. `git push origin --tags`
|
data/integrations/spec_helper.rb
CHANGED
data/lib/trusona.rb
CHANGED
@@ -101,16 +101,18 @@ module Trusona
|
|
101
101
|
# using an instance of +Trusona::Configuration+.
|
102
102
|
#
|
103
103
|
# Trusona.config do |c|
|
104
|
-
# c.tru_codes_host = ENV['TRU_CODES_HOST']
|
105
104
|
# c.api_host = ENV['TRUSONA_API_HOST']
|
106
105
|
# c.secret = ENV['TRUSONA_SECRET']
|
107
106
|
# c.token = ENV['TRUSONA_TOKEN']
|
108
107
|
# end
|
109
108
|
#
|
110
109
|
def self.config
|
111
|
-
|
110
|
+
if block_given?
|
111
|
+
@config = Configuration.new
|
112
|
+
yield(@config)
|
113
|
+
end
|
112
114
|
|
113
|
-
@config
|
115
|
+
@config
|
114
116
|
end
|
115
117
|
|
116
118
|
##
|
@@ -124,39 +126,19 @@ module Trusona
|
|
124
126
|
#
|
125
127
|
# @attr_reader api_host [String] The full URL of the Trusona API
|
126
128
|
# (e.g. +https://api.trusona.net+)
|
127
|
-
#
|
128
|
-
# @attr_reader tru_codes_host [String] The full URL of the host responsible
|
129
|
-
# for managing TruCode tru_codes
|
130
|
-
# (e.g. +https://tru_codes.trusona.net+)
|
131
129
|
class Configuration
|
132
130
|
attr_accessor :token, :secret
|
133
|
-
attr_reader :api_host
|
131
|
+
attr_reader :api_host
|
132
|
+
|
133
|
+
def initialize()
|
134
|
+
@api_host = 'api.trusona.net'
|
135
|
+
end
|
134
136
|
|
135
137
|
##
|
136
138
|
# sets the API host by first ensuring the proper format
|
137
139
|
# @param host [String] The full URL of the Trusona API
|
138
140
|
def api_host=(host)
|
139
|
-
@api_host =
|
140
|
-
end
|
141
|
-
|
142
|
-
##
|
143
|
-
# sets the TruCodes host by first ensuring the proper format
|
144
|
-
# @param host [String] The full URL of the TruCodes API
|
145
|
-
def tru_codes_host=(host)
|
146
|
-
@tru_codes_host = parse_host(host)
|
147
|
-
end
|
148
|
-
|
149
|
-
private
|
150
|
-
|
151
|
-
def parse_host(maybe_host)
|
152
|
-
parsed = URI('')
|
153
|
-
begin
|
154
|
-
parsed = URI(maybe_host).host
|
155
|
-
rescue StandardError
|
156
|
-
parsed = URI('')
|
157
|
-
end
|
158
|
-
|
159
|
-
parsed
|
141
|
+
@api_host = URI(host).host || host
|
160
142
|
end
|
161
143
|
end
|
162
144
|
end
|
@@ -6,7 +6,7 @@ module Trusona
|
|
6
6
|
## A service for interacting with TruCode TruCodes
|
7
7
|
class TruCodesService < BaseService
|
8
8
|
def initialize(
|
9
|
-
client: Trusona::Api::HTTPClient.new(Trusona.config.
|
9
|
+
client: Trusona::Api::HTTPClient.new(Trusona.config.api_host),
|
10
10
|
mapper: Trusona::Mappers::TruCodeMapper.new
|
11
11
|
)
|
12
12
|
@client = client
|
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:
|
4
|
+
version: 2.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-12-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: httparty
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- ".rspec"
|
232
232
|
- ".ruby-version"
|
233
233
|
- ".travis.yml"
|
234
|
+
- DEVELOP.md
|
234
235
|
- Gemfile
|
235
236
|
- Guardfile
|
236
237
|
- LICENSE
|
@@ -308,7 +309,6 @@ files:
|
|
308
309
|
- lib/trusona/workers/user_deactivator.rb
|
309
310
|
- lib/trusona/workers/user_identifier_creator.rb
|
310
311
|
- lib/trusona/workers/user_identifier_finder.rb
|
311
|
-
- release-gem
|
312
312
|
- trusona.gemspec
|
313
313
|
- trusona.key.pem.enc
|
314
314
|
homepage: https://trusona.com
|
@@ -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
|
data/release-gem
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Add the artifactory gem source
|
4
|
-
gem source -a https://$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD@trusona.jfrog.io/trusona/api/gems/trusona-rubygems/
|
5
|
-
|
6
|
-
# fetch the gem credentials file from artifactory
|
7
|
-
curl -u$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD https://trusona.jfrog.io/trusona/api/gems/trusona-rubygems/api/v1/api_key.yaml > ~/.gem/credentials
|
8
|
-
|
9
|
-
# change permissions on the fetched credentials file
|
10
|
-
chmod 600 ~/.gem/credentials
|
11
|
-
|
12
|
-
# build the gem
|
13
|
-
gem build trusona.gemspec
|
14
|
-
|
15
|
-
# push the gem to artifactory
|
16
|
-
gem push trusona-*.gem --host https://trusona.jfrog.io/trusona/api/gems/trusona-rubygems
|
17
|
-
|
18
|
-
# push to rubygems
|
19
|
-
echo -e "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials
|
20
|
-
gem push trusona-*.gem
|