soar-authentication-identity_uuid_translator 1.0.3 → 1.0.4
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/Dockerfile.dynamo_db +1 -1
- data/Dockerfile.features +1 -1
- data/config/config.ci.dynamo_db.yml +1 -1
- data/lib/soar/authentication/identity_uuid_translator/provider/customer.rb +2 -1
- data/lib/soar/authentication/identity_uuid_translator/provider/staff.rb +3 -1
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/base.rb +10 -10
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb +11 -1
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer_email.rb +1 -1
- data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/staff.rb +41 -27
- data/lib/soar/authentication/identity_uuid_translator/test/orchestrator.rb +4 -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: 62918fb1409f0b7fd6a28ba4c0e5d7e06a84fd0f
|
4
|
+
data.tar.gz: 154f26e6dba8e4841badb6219348beee137747b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe73df28bd768f251b1ba099fc92e7030c78f2e5b56ea6cf98f0e102451381d429feae83bf0336d0200ae8cd19237a5934873c6adec989af4224c5f7db3dc3e
|
7
|
+
data.tar.gz: 8b06e5067c6d8026865fa03be6eaf3da9db932b07b08efb826a253638c3fc2aec4034607fada8f89e677c2c068007a07c0449a6a0550020b6f9851732402c0dc
|
data/.gemspec
CHANGED
data/Dockerfile.dynamo_db
CHANGED
@@ -2,4 +2,4 @@ FROM openjdk:7
|
|
2
2
|
WORKDIR /opt/dynamodb_local
|
3
3
|
RUN wget -q -O - http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz | tar -xzf - -C /opt/dynamodb_local
|
4
4
|
EXPOSE 8000
|
5
|
-
ENTRYPOINT ["/usr/bin/java", "-Djava.library.path=/opt/dynamodb_local/DynamoDBLocal_lib", "-jar", "DynamoDBLocal.jar"
|
5
|
+
ENTRYPOINT ["/usr/bin/java", "-Djava.library.path=/opt/dynamodb_local/DynamoDBLocal_lib", "-jar", "DynamoDBLocal.jar"]
|
data/Dockerfile.features
CHANGED
@@ -8,7 +8,7 @@ module Soar
|
|
8
8
|
class Customer
|
9
9
|
|
10
10
|
ROLE = "customer_profile_administrator"
|
11
|
-
PREFIX = "genie:client:id:"
|
11
|
+
PREFIX = "mysql:genie:client:id:"
|
12
12
|
|
13
13
|
##
|
14
14
|
# @param [String] identifier
|
@@ -29,6 +29,7 @@ module Soar
|
|
29
29
|
@uuid = @uuid_generator.nil? ? @identifiers[0] : @uuid_generator::generate("#{PREFIX}#{@identifiers[0]}")
|
30
30
|
@role_generator.generate({
|
31
31
|
"identity_uuid" => uuid,
|
32
|
+
"identity_source" => "#{PREFIX}#{@identifiers[0]}",
|
32
33
|
"identity_role" => ROLE,
|
33
34
|
"identity_role_attributes" => {
|
34
35
|
"profiles" => [client_number].compact
|
@@ -7,6 +7,7 @@ module Soar
|
|
7
7
|
class Staff
|
8
8
|
|
9
9
|
ROLE = "hetzner_staff_member"
|
10
|
+
PREFIX = "ldap:people:genieuser:entryuuid:"
|
10
11
|
|
11
12
|
def initialize(identifier: , identity_registry: , role_generator: nil)
|
12
13
|
@identifier = identifier
|
@@ -19,7 +20,8 @@ module Soar
|
|
19
20
|
identifiers = @idr.get_identifiers(@identifier)
|
20
21
|
@uuid = identifiers[0]
|
21
22
|
@role_generator.generate({
|
22
|
-
"identity_uuid" => uuid,
|
23
|
+
"identity_uuid" => @uuid,
|
24
|
+
"identity_source" => "#{PREFIX}#{@uuid}",
|
23
25
|
"identity_role" => ROLE
|
24
26
|
}) if not @role_generator.nil?
|
25
27
|
return @uuid
|
@@ -13,8 +13,8 @@ module Soar
|
|
13
13
|
module OrchestrationProvider
|
14
14
|
class Base
|
15
15
|
|
16
|
-
SLEEP_SECONDS =
|
17
|
-
CONNECTION_RETRIES =
|
16
|
+
SLEEP_SECONDS = 5
|
17
|
+
CONNECTION_RETRIES = 10
|
18
18
|
|
19
19
|
def initialize
|
20
20
|
@connection_retries = CONNECTION_RETRIES
|
@@ -22,14 +22,14 @@ module Soar
|
|
22
22
|
|
23
23
|
def given_roles_directory
|
24
24
|
begin
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
roles_directory_configuration = YAML.load_file("config/#{ENV['ROLES_DIRECTORY_CONFIG_FILE']}")
|
26
|
+
@roles_directory = Soar::Registry::Directory.new(
|
27
|
+
Soar::Registry::Directory::Provider::DynamoDb.new(Hashie.symbolize_keys(roles_directory_configuration['config']))
|
28
|
+
)
|
29
|
+
@roles_directory.provider.recreate_table({
|
30
|
+
name: roles_directory_configuration['config']['table'][:name],
|
31
|
+
structure: JSON.parse(File.read("lib/soar/authentication/identity_uuid_translator/test/fixtures/roles_table.json"))
|
32
|
+
})
|
33
33
|
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
34
34
|
raise if @connection_retries == 0
|
35
35
|
sleep(SLEEP_SECONDS)
|
data/lib/soar/authentication/identity_uuid_translator/test/orchestration_provider/customer.rb
CHANGED
@@ -10,11 +10,21 @@ module Soar
|
|
10
10
|
def given_existing_role_and_attributes
|
11
11
|
@roles_directory.put({
|
12
12
|
"identity_uuid" => Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}"),
|
13
|
+
"identity_source" => "#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}",
|
13
14
|
"identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE,
|
14
15
|
"identity_role_attributes" => [Faker::Number.unique.number(10)].compact
|
15
16
|
})
|
16
17
|
end
|
17
18
|
|
19
|
+
def source?
|
20
|
+
primary_key = {
|
21
|
+
"identity_uuid" => @uuid,
|
22
|
+
"identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE
|
23
|
+
}
|
24
|
+
identity = @roles_directory.fetch(primary_key)
|
25
|
+
return identity['identity_source'] == "#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[:ID]}"
|
26
|
+
end
|
27
|
+
|
18
28
|
def role?
|
19
29
|
begin
|
20
30
|
primary_key = {
|
@@ -23,7 +33,7 @@ module Soar
|
|
23
33
|
}
|
24
34
|
identity = @roles_directory.fetch(primary_key)
|
25
35
|
identity['identity_role'] == Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE
|
26
|
-
return identity['identity_role_attributes'].include?(@identity[:Client_Number])
|
36
|
+
return identity['identity_role_attributes']['profiles'].include?(@identity[:Client_Number])
|
27
37
|
rescue Soar::Registry::Directory::Error::NoEntriesFoundError => e
|
28
38
|
return false
|
29
39
|
end
|
@@ -16,51 +16,56 @@ module Soar
|
|
16
16
|
@identity = {
|
17
17
|
dn: "cn=John Smith,#{@identity_directory_configuration['config']['base']}",
|
18
18
|
attributes: {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
cn: "John Smith",
|
20
|
+
mail: @identifier,
|
21
|
+
objectclass: ["inetOrgPerson", "top"],
|
22
|
+
sn: "Smith"
|
23
|
+
}
|
24
24
|
}
|
25
25
|
@identity_directory.provider.delete(@identity[:dn])
|
26
26
|
@identity_directory.put(@identity)
|
27
27
|
rescue Soar::Registry::Directory::Error::DuplicateEntryError => e
|
28
28
|
true
|
29
|
+
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
30
|
+
raise if @connection_retries == 0
|
31
|
+
sleep(SLEEP_SECONDS)
|
32
|
+
@connection_retries -= 1
|
33
|
+
given_existing_identity
|
29
34
|
end
|
30
35
|
end
|
31
36
|
|
32
37
|
|
33
38
|
def given_existing_role_and_attributes
|
34
|
-
@roles_directory.put({
|
35
|
-
"identity_uuid" => @identity_registry.get_identifiers(@identifier)[0],
|
36
|
-
"identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Staff::ROLE
|
37
|
-
})
|
38
|
-
end
|
39
|
-
|
40
|
-
def given_identity_registry
|
41
|
-
|
42
39
|
begin
|
43
|
-
@
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
)
|
48
|
-
|
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
|
-
)
|
40
|
+
@roles_directory.put({
|
41
|
+
"identity_uuid" => @identity_registry.get_identifiers(@identifier)[0],
|
42
|
+
"identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Staff::ROLE
|
43
|
+
})
|
56
44
|
rescue Soar::Registry::Directory::Error::NetworkingError => e
|
57
45
|
raise if @connection_retries == 0
|
58
46
|
sleep(SLEEP_SECONDS)
|
59
47
|
@connection_retries -= 1
|
60
|
-
|
48
|
+
given_existing_role_and_attributes
|
61
49
|
end
|
62
50
|
end
|
63
51
|
|
52
|
+
def given_identity_registry
|
53
|
+
|
54
|
+
@identity_directory_configuration = YAML.load_file("config/#{ENV['IDENTITY_DIRECTORY_CONFIG_FILE']}")
|
55
|
+
|
56
|
+
@identity_directory = Soar::Registry::Directory.new(
|
57
|
+
Soar::Registry::Directory::Provider::Ldap.new(Hashie.symbolize_keys(@identity_directory_configuration['config']))
|
58
|
+
)
|
59
|
+
|
60
|
+
@identity_registry = Soar::Registry::Identity.new(
|
61
|
+
Soar::Registry::Identity::Provider::Staff::Email.new({
|
62
|
+
directory: @identity_directory,
|
63
|
+
fetch_index: 'entryuuid',
|
64
|
+
search_index: 'mail'
|
65
|
+
})
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
64
69
|
def role?
|
65
70
|
begin
|
66
71
|
primary_key = {
|
@@ -78,6 +83,15 @@ module Soar
|
|
78
83
|
@uuid == @identity_registry.get_identifiers(@identifier)[0]
|
79
84
|
end
|
80
85
|
|
86
|
+
def source?
|
87
|
+
primary_key = {
|
88
|
+
"identity_uuid" => @uuid,
|
89
|
+
"identity_role" => Soar::Authentication::IdentityUuidTranslator::Provider::Staff::ROLE
|
90
|
+
}
|
91
|
+
identity = @roles_directory.fetch(primary_key)
|
92
|
+
identity['identity_source'] == "#{Soar::Authentication::IdentityUuidTranslator::Provider::Staff::PREFIX}#{@uuid}"
|
93
|
+
end
|
94
|
+
|
81
95
|
end
|
82
96
|
end
|
83
97
|
end
|
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.4
|
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-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar-registry-identity
|