soar-authentication-identity_uuid_translator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +1 -1
- data/README.md +1 -2
- data/docker-compose.ci.role_generator.yml +0 -11
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/base.rb +14 -0
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb +0 -9
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer_client_number.rb +25 -22
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer_email.rb +26 -22
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/staff.rb +18 -11
- data/lib/soar/authentication/identity_uuid_translator/uuid_generator.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5170d8db19db7393f57f5ce3d9e165243bd6d26f
|
4
|
+
data.tar.gz: d53f8635ad1f27d24316de2595a5e33bc85720ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e71c0fc96fa08683a6a8db684e19277bfd9b29911609649049ada997b8fbf3ea8313cda51b9dc4a31731150fd32f3552c23814f076f928d1862352a7bba8c2a
|
7
|
+
data.tar.gz: ea06b97cdd7255bad0e97fc41be960040ece69a5250218b8b8153b69e8311cca72b822878e2a24cabd399a198ee3d8291affe63994e42fc59fa653389f38e67c
|
data/.gemspec
CHANGED
data/README.md
CHANGED
@@ -17,8 +17,7 @@ $ bundle exec rspec spec/factory_spec.rb
|
|
17
17
|
|
18
18
|
#### Soar::Authentication::IdentityUuidTranslator::RoleGenerator
|
19
19
|
```bash
|
20
|
-
$
|
21
|
-
$ ROLES_DIRECTORY_CONFIG_FILE=config.dynamo_db.yml bundle exec rspec spec/role_generator_spec.rb
|
20
|
+
$ bundle exec rspec spec/role_generator_spec.rb
|
22
21
|
```
|
23
22
|
|
24
23
|
#### Soar::Authentication::IdentityUuidTranslator::Provider::Customer
|
@@ -1,26 +1,15 @@
|
|
1
1
|
version: "2"
|
2
2
|
services:
|
3
3
|
|
4
|
-
dynamodb:
|
5
|
-
build:
|
6
|
-
context: .
|
7
|
-
dockerfile: Dockerfile.dynamo_db
|
8
|
-
expose:
|
9
|
-
- "8000"
|
10
|
-
|
11
4
|
tests:
|
12
5
|
build:
|
13
6
|
context: .
|
14
7
|
dockerfile: Dockerfile.rspec
|
15
|
-
links:
|
16
|
-
- dynamodb
|
17
8
|
command:
|
18
9
|
- bundle
|
19
10
|
- exec
|
20
11
|
- rspec
|
21
12
|
- "spec/role_generator_spec.rb"
|
22
|
-
environment:
|
23
|
-
- ROLES_DIRECTORY_CONFIG_FILE=config.ci.dynamo_db.yml
|
24
13
|
|
25
14
|
|
26
15
|
|
@@ -13,7 +13,15 @@ module Soar
|
|
13
13
|
module OrchestrationProvider
|
14
14
|
class Base
|
15
15
|
|
16
|
+
SLEEP_SECONDS = 1
|
17
|
+
CONNECTION_RETRIES = 6
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@connection_retries = CONNECTION_RETRIES
|
21
|
+
end
|
22
|
+
|
16
23
|
def given_roles_directory
|
24
|
+
begin
|
17
25
|
roles_directory_configuration = YAML.load_file("config/#{ENV['ROLES_DIRECTORY_CONFIG_FILE']}")
|
18
26
|
@roles_directory = Soar::Registry::Directory.new(
|
19
27
|
Soar::Registry::Directory::Provider::DynamoDb.new(Hashie.symbolize_keys(roles_directory_configuration['config']))
|
@@ -22,6 +30,12 @@ module Soar
|
|
22
30
|
name: roles_directory_configuration['config']['table'][:name],
|
23
31
|
structure: JSON.parse(File.read("lib/soar/authentication/identity_uuid_translator/test/fixtures/roles_table.json"))
|
24
32
|
})
|
33
|
+
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
34
|
+
raise if @connection_retries == 0
|
35
|
+
sleep(SLEEP_SECONDS)
|
36
|
+
@connection_retries -= 1
|
37
|
+
given_roles_directory
|
38
|
+
end
|
25
39
|
end
|
26
40
|
|
27
41
|
def given_role_generator
|
data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb
CHANGED
@@ -33,15 +33,6 @@ module Soar
|
|
33
33
|
@uuid == Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}")
|
34
34
|
end
|
35
35
|
|
36
|
-
protected
|
37
|
-
|
38
|
-
##
|
39
|
-
# Execute command using mysql client on terminal
|
40
|
-
##
|
41
|
-
def recreate_table(host:, username:, password:, filepath:)
|
42
|
-
`mysql -h #{host} -u#{username} -p#{password} konsoleh_genie < '#{filepath}'`
|
43
|
-
end
|
44
|
-
|
45
36
|
end
|
46
37
|
end
|
47
38
|
end
|
@@ -9,33 +9,36 @@ module Soar
|
|
9
9
|
|
10
10
|
def given_identity_registry
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Soar::Registry::
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
12
|
+
begin
|
13
|
+
|
14
|
+
directory_configuration = YAML.load_file("config/#{ENV['IDENTITY_DIRECTORY_CONFIG_FILE']}")
|
15
|
+
|
16
|
+
provider = Soar::Registry::Directory::Provider::Mysql.new(Hashie.symbolize_keys(directory_configuration['config']))
|
17
|
+
provider.client.query("DROP TABLE IF EXISTS `Client`")
|
18
|
+
provider.client.query("CREATE TABLE Client ( ID int(11) NOT NULL AUTO_INCREMENT, Client_Number varchar(15) NOT NULL DEFAULT '', First_Name varchar(70) DEFAULT NULL, Surname varchar(70) DEFAULT NULL, Notifyemail_Invoice text, PRIMARY KEY (ID), KEY Notifyemail_Invoice (Notifyemail_Invoice(20)), KEY Client_Number (Client_Number))")
|
19
|
+
|
20
|
+
@directory = Soar::Registry::Directory.new(provider)
|
21
|
+
|
22
|
+
@identity_registry = Soar::Registry::Identity.new(
|
23
|
+
Soar::Registry::Identity::Provider::Customer::ClientNumber.new({
|
24
|
+
directory: @directory,
|
25
|
+
fetch_index: 'ID',
|
26
|
+
search_index: 'Client_Number'
|
27
|
+
})
|
28
|
+
)
|
29
|
+
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
30
|
+
raise if @connection_retries == 0
|
31
|
+
sleep(SLEEP_SECONDS)
|
32
|
+
@connection_retries -= 1
|
33
|
+
given_identity_registry
|
34
|
+
end
|
32
35
|
end
|
33
36
|
|
34
37
|
def given_existing_identity
|
35
38
|
@identity = {
|
36
39
|
ID: Faker::Number.number(4),
|
37
|
-
|
38
|
-
|
40
|
+
Notifyemail_Invoice: Faker::Internet.email,
|
41
|
+
Client_Number: @identifier
|
39
42
|
}
|
40
43
|
@directory.put(@identity)
|
41
44
|
end
|
data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer_email.rb
CHANGED
@@ -9,33 +9,37 @@ module Soar
|
|
9
9
|
|
10
10
|
def given_identity_registry
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Soar::Registry::
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
12
|
+
begin
|
13
|
+
directory_configuration = YAML.load_file("config/#{ENV['IDENTITY_DIRECTORY_CONFIG_FILE']}")
|
14
|
+
|
15
|
+
provider = Soar::Registry::Directory::Provider::Mysql.new(Hashie.symbolize_keys(directory_configuration['config']))
|
16
|
+
|
17
|
+
provider.client.query("DROP TABLE IF EXISTS `Client`")
|
18
|
+
provider.client.query("CREATE TABLE Client ( ID int(11) NOT NULL AUTO_INCREMENT, Client_Number varchar(15) NOT NULL DEFAULT '', First_Name varchar(70) DEFAULT NULL, Surname varchar(70) DEFAULT NULL, Notifyemail_Invoice text, PRIMARY KEY (ID), KEY Notifyemail_Invoice (Notifyemail_Invoice(20)), KEY Client_Number (Client_Number))")
|
19
|
+
|
20
|
+
@directory = Soar::Registry::Directory.new(provider)
|
21
|
+
|
22
|
+
@identity_registry = Soar::Registry::Identity.new(
|
23
|
+
Soar::Registry::Identity::Provider::Customer::Email.new({
|
24
|
+
directory: @directory,
|
25
|
+
fetch_index: 'ID',
|
26
|
+
search_index: 'Notifyemail_Invoice'
|
27
|
+
})
|
28
|
+
)
|
29
|
+
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
30
|
+
raise if @connection_retries == 0
|
31
|
+
sleep(self::SLEEP_SECONDS)
|
32
|
+
@connection_retries -= 1
|
33
|
+
given_identity_registry
|
34
|
+
end
|
35
|
+
|
32
36
|
end
|
33
37
|
|
34
38
|
def given_existing_identity
|
35
39
|
@identity = {
|
36
40
|
ID: Faker::Number.number(4),
|
37
|
-
|
38
|
-
|
41
|
+
Notifyemail_Invoice: @identifier,
|
42
|
+
Client_Number: "C#{Faker::Number.unique.number(10)}"
|
39
43
|
}
|
40
44
|
@directory.put(@identity)
|
41
45
|
end
|
@@ -39,19 +39,26 @@ module Soar
|
|
39
39
|
|
40
40
|
def given_identity_registry
|
41
41
|
|
42
|
-
|
42
|
+
begin
|
43
|
+
@identity_directory_configuration = YAML.load_file("config/#{ENV['IDENTITY_DIRECTORY_CONFIG_FILE']}")
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
@identity_directory = Soar::Registry::Directory.new(
|
46
|
+
Soar::Registry::Directory::Provider::Ldap.new(Hashie.symbolize_keys(@identity_directory_configuration['config']))
|
47
|
+
)
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
@identity_registry = Soar::Registry::Identity.new(
|
50
|
+
Soar::Registry::Identity::Provider::Staff::Email.new({
|
51
|
+
directory: @identity_directory,
|
52
|
+
fetch_index: 'entryuuid',
|
53
|
+
search_index: 'mail'
|
54
|
+
})
|
55
|
+
)
|
56
|
+
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
57
|
+
raise if @connection_retries == 0
|
58
|
+
sleep(SLEEP_SECONDS)
|
59
|
+
@connection_retries -= 1
|
60
|
+
given_identity_registry
|
61
|
+
end
|
55
62
|
end
|
56
63
|
|
57
64
|
def role?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar-authentication-identity_uuid_translator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.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-
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar-registry-identity
|