soar-registry-identity 5.0.0 → 5.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 821dd803bad9432b1c2206c11c46708bed15d4e0
4
- data.tar.gz: baea63429adf243703b68e74f9b3d0d46aac8d41
3
+ metadata.gz: 79231792c26830f1ef26bf12dd425bc9f5f3384b
4
+ data.tar.gz: 42fa83abb9dcd2d28ee9a01f8da502273877cc69
5
5
  SHA512:
6
- metadata.gz: bf1e42b3b28c05e5f01c0b72a77fc82c287c9cfd2d8334b25dae439b3cae1663a06b6710acebb500d69659f3cf9669ed8f9fa13706324f31d2db21218ce0c09e
7
- data.tar.gz: b577f82ccedd6db4a7b8d4a5b5f8f5798d4001623a67ad006defac2de9af286f71333f244e543684b731392e9832b13b60139820093c3027bc86766ee0b028c0
6
+ metadata.gz: c6f877cfc8a01e27627c66fe27617f40d8b1b6bca76b1cf3f0eb85676a1d3f1670e5925684b77b1b046fb22ad7c3809a0f72ee278e3884ba89993afea1e8b214
7
+ data.tar.gz: 6f195c1646a9178dd7c769cc124779c9d5cca769c7337bc3ea83c296945e5d6b30ea045ec5d84bdf0d243379c7f9ab320b4d1356b1639cfd1cc4451087762269
data/README.md CHANGED
@@ -181,6 +181,12 @@ Soar::Registry::Identity::Provider::Staff::Uuid
181
181
  $ STAFF_DIRECTORY_CONFIG_FILE=config.ldap.yml ROLES_DIRECTORY_CONFIG_FILE=config.dynamo_db.yml TEST_ORCHESTRATION_PROVIDER=Staff::Uuid bundle exec cucumber
182
182
  ```
183
183
 
184
+ Soar::Registry::Identity::Provider::Stub::Uuid
185
+
186
+ ```bash
187
+ $ TEST_ORCHESTRATION_PROVIDER=Stub::Uuid bundle exec cucumber
188
+ ```
189
+
184
190
  Soar::Registry::Identity::Provider::Staff::Email
185
191
 
186
192
  ```bash
@@ -207,6 +213,15 @@ $ bundle exec rspec spec/authenticated_identity_factory_spec.rb spec/identity_uu
207
213
 
208
214
  ### CI
209
215
 
216
+ Soar::Registry::Identity::Provider::Stub::Uuid
217
+
218
+ ```bash
219
+ docker-compose --file docker-compose.ci.stub-uuid.yml --project-name soar-registry-identity-provider-stub-uuid up --abort-on-container-exit --remove-orphans --build --force-recreate
220
+ EXIT_CODE=$(docker ps -a -f "name=soarregistryidentityproviderstubuuid_tests" -q | xargs docker inspect -f "{{ .State.ExitCode }}");
221
+ docker-compose --file docker-compose.ci.staff-email.yml --project-name soar-registry-identity-provider-stub-uuid down --rmi local
222
+ exit $EXIT_CODE;
223
+ ```
224
+
210
225
  Soar::Registry::Identity::Provider::Staff::Email
211
226
 
212
227
  ```bash
@@ -3,6 +3,7 @@ require 'soar/registry/identity/provider/staff/uuid'
3
3
  require 'soar/registry/identity/provider/customer/client_number'
4
4
  require 'soar/registry/identity/provider/customer/email'
5
5
  require 'soar/registry/identity/provider/customer/uuid'
6
+ require 'soar/registry/identity/provider/stub/uuid'
6
7
 
7
8
  module Soar
8
9
  module Registry
@@ -0,0 +1,70 @@
1
+ require 'soar_idm/soar_idm'
2
+
3
+ module Soar
4
+ module Registry
5
+ module Identity
6
+ module Provider
7
+ module Stub
8
+
9
+ ##
10
+ # Work in progress. Do not use.
11
+ ##
12
+ class Uuid < SoarIdm::IdmApi
13
+
14
+ ##
15
+ # @param [Array<Hash{String => Hash, String, Number}>] identities
16
+ # @param [Soar::Registry::Directory] directory
17
+ # @raise [ArgumentError]
18
+ ##
19
+ def initialize(directory:)
20
+ @directory = directory
21
+ end
22
+
23
+ ##
24
+ # @param [Hash{String => String,Number}] identity
25
+ # @return [Array<String>] list of roles
26
+ ##
27
+ def calculate_roles(identity)
28
+ return identity.key?('roles') ? identity['roles'].keys : []
29
+ end
30
+
31
+ ##
32
+ # @param [Hash{String => String, Number}] identity
33
+ # @return [Array<String,Number>] list of identifiers
34
+ ##
35
+ def calculate_identifiers(identity)
36
+ end
37
+
38
+ ##
39
+ # @param [Hash{String => String, Number}] identity
40
+ # @param [String] role
41
+ # @return [Hash{String => String, Number, Hash, Array}] A hash of attributes
42
+ ##
43
+ def calculate_attributes(identity, role)
44
+ return {
45
+ role => identity['roles'].key?(role) ? identity['roles'][role] : {}
46
+ }
47
+ end
48
+
49
+ ##
50
+ # @param [Hash{String => String, Number}] identity
51
+ # @return [Hash{String => String, Number, Hash, Array}] A hash of attributes
52
+ def calculate_all_attributes(identity)
53
+ return identity
54
+ end
55
+
56
+ ##
57
+ # @param [String] identifier a string that uniquely identifies an identity
58
+ # @return [Array<Hash{String => String, Number }>] identities
59
+ ##
60
+ def calculate_identities(identifier)
61
+ return [@directory.fetch(identifier)]
62
+ end
63
+
64
+
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,122 @@
1
+ require 'faker'
2
+ require 'soar/registry/identity'
3
+ require 'soar/registry/directory'
4
+ require 'soar/authentication/identity_uuid_translator/provider/customer'
5
+ require 'soar/authentication/identity_uuid_translator/uuid_generator'
6
+
7
+ module Soar
8
+ module Registry
9
+ module Identity
10
+ module Test
11
+ module OrchestrationProvider
12
+ module Stub
13
+ class Uuid
14
+
15
+ def initialize
16
+ Faker::UniqueGenerator.clear
17
+ @identity_uuid = SecureRandom.uuid
18
+ end
19
+
20
+ def given_identity_directory
21
+ @directory = Soar::Registry::Directory.new(
22
+ Soar::Registry::Directory::Provider::Stub.new(
23
+ table: 'identities',
24
+ index: ['identity_uuid']
25
+ )
26
+ )
27
+ end
28
+
29
+ def given_roles_directory
30
+ true
31
+ end
32
+
33
+ def given_roles
34
+ @identity['roles'] = {
35
+ Faker::Company.unique.profession => {}
36
+ }
37
+ @roles = @identity['roles'].keys
38
+ end
39
+
40
+ def given_role_with_attributes
41
+ @identity['roles'] = {
42
+ Faker::Company.unique.profession => {
43
+ Faker::Hacker.noun => Faker::Hacker.verb
44
+ }
45
+ }
46
+ @roles = @identity['roles'].keys
47
+ end
48
+
49
+ def given_identity
50
+ @identity = {
51
+ "identity_uuid" => @identity_uuid,
52
+ "firstname" => Faker::Name.unique.first_name,
53
+ "lastname" => Faker::Name.unique.last_name,
54
+ "email" => Faker::Internet.unique.email
55
+ }
56
+ end
57
+
58
+ def given_identity_registry
59
+ @directory.put(@identity) if not @identity.nil?
60
+ @idr = Soar::Registry::Identity.new(
61
+ Soar::Registry::Identity::Provider::Stub::Uuid.new(
62
+ directory: @directory
63
+ )
64
+ )
65
+ end
66
+
67
+ def get_roles
68
+ begin
69
+ @result = @idr.get_roles(@identity_uuid)
70
+ rescue SoarIdm::IdentityError => e
71
+ @error = e
72
+ end
73
+ end
74
+
75
+ def get_role_attributes
76
+ @result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0])
77
+ end
78
+
79
+ def get_identity_attributes
80
+ @result = @idr.get_attributes(@identity_uuid)
81
+ end
82
+
83
+ def identity_attributes?
84
+ @result == @identity
85
+ end
86
+
87
+ def nil?
88
+ @result == nil
89
+ end
90
+
91
+ def role_with_empty_attributes?
92
+ @result == {
93
+ @roles[0] => {}
94
+ }
95
+ end
96
+
97
+ def role_with_attributes?
98
+ role_with_attributes = {
99
+ @roles[0] => @identity['roles'][@roles[0]]
100
+ }
101
+ @result == role_with_attributes
102
+ end
103
+
104
+ def roles?
105
+ @result.sort == @roles.sort
106
+ end
107
+
108
+ def no_roles?
109
+ @result == []
110
+ end
111
+
112
+ def identity_error?
113
+ @error.is_a?(SoarIdm::IdentityError)
114
+ end
115
+
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar-registry-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Mulder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: soar_idm
@@ -68,10 +68,12 @@ files:
68
68
  - lib/soar/registry/identity/provider/customer/uuid.rb
69
69
  - lib/soar/registry/identity/provider/staff/email.rb
70
70
  - lib/soar/registry/identity/provider/staff/uuid.rb
71
+ - lib/soar/registry/identity/provider/stub/uuid.rb
71
72
  - lib/soar/registry/identity/test/fixtures/client_table.sql
72
73
  - lib/soar/registry/identity/test/fixtures/roles_table.json
73
74
  - lib/soar/registry/identity/test/orchestration_provider/customer/uuid.rb
74
75
  - lib/soar/registry/identity/test/orchestration_provider/staff/uuid.rb
76
+ - lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb
75
77
  - lib/soar/registry/identity/test/orchestrator.rb
76
78
  homepage: https://gitlab.host-h.net/registries/identity
77
79
  licenses: