soar-registry-identity 1.0.0 → 1.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: 9437adb33b4379cc43f32fd3114f5747f232f6c8
4
- data.tar.gz: 8da8b86504e04fe071dc025023ce0dd09df82a16
3
+ metadata.gz: 61e1631e0c686f692e76bcdcbb79b81e959650eb
4
+ data.tar.gz: bdbc70c78f68790210ce731a92c17832ad586a99
5
5
  SHA512:
6
- metadata.gz: 3a8048aaeb8838dbe4addf80b864b2792790a7ad13ea432c8aa244feee4f807b409498cb859d8c3e206181643c2049b3d6402681f6ac7e81e1a0cdddcae19821
7
- data.tar.gz: a35ba39309eee4ed3ded67690cca8090f52b09e906b17ab4bfb039eef8a98998948c42d442d87e94aad131a9690c26a5dd36ce6974a6c903f2586734b215b4b3
6
+ metadata.gz: 7143547d7152478e3b0659975cc0cacea568ec0e427946aeb481b433bbb5df093666d92848a987cc88d154561b667601547e6f88498b8d9199472ec63d857130
7
+ data.tar.gz: 535393b98c3092d75de8e32d2870c69c4c0965a8731a04e0d75d4c95cc84e29130b9ecd28d7df8e5280476e75807c72cdca7b23dbb857a72503148946d947f68
data/README.md CHANGED
@@ -6,7 +6,6 @@
6
6
  ```javascript
7
7
  "identities" = [{
8
8
  "uuid": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
9
- "entity_id": "entity-2d931510-d99f-494a-8c67-87feb05e1594",
10
9
  "email": "test+publisher@hetzner.co.za",
11
10
  "roles": {
12
11
  "staff": {
@@ -26,8 +25,7 @@ Create a directory provider
26
25
  require 'soar/registry/directory'
27
26
  directory_provider = Soar::Registry::Directory::Provider::Stub.new(
28
27
  table: "identities",
29
- primary_key: "uuid",
30
- index: ["uuid", "entity_id", "email"]
28
+ index: ["uuid", "email"]
31
29
  )
32
30
  ```
33
31
 
@@ -37,7 +35,7 @@ directory = Soar::Registry::Directory.new(directory_provider)
37
35
  ```
38
36
 
39
37
  ### Staff UUID IDR
40
- Search for staff by UUID.
38
+ Search for roles, attributes or identifiers by UUID. Used by [policies](https://gitlab.host-h.net/policies) to determine authorization.
41
39
 
42
40
  Create an identity provider.
43
41
  ```ruby
@@ -51,7 +49,7 @@ Create an IDR
51
49
  ```
52
50
 
53
51
  ### Staff Email IDR
54
- Search for staff by email address.
52
+ Search for identifiers by email address. Used by [soar-authentication-identity](https://github.com/hetznerZA/soar-authentication-identity) to translate an authenticated identifier to an UUID.
55
53
  ```ruby
56
54
  require 'soar/registry/identity'
57
55
  identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directory: directory)
@@ -72,7 +70,6 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
72
70
  ### Getting a list of roles
73
71
  ```ruby
74
72
  > roles = @id_idr.get_roles("identity-820d5660-2204-4f7d-8c04-746313439b81")
75
- > roles = @email_idr.get_roles("admin@hetzner.co.za")
76
73
  > puts roles.inspect
77
74
  ["staff", "configuration_publisher", "configuration_consumer"]
78
75
  ```
@@ -81,7 +78,6 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
81
78
  ```ruby
82
79
  > role = 'staff'
83
80
  > attributes = @id_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81", role)
84
- > attributes = @email_idr.get_attributes("admin@hetzner.co.za", role)
85
81
  > puts attributes.inspect
86
82
  {
87
83
  "staff": {
@@ -94,7 +90,6 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
94
90
  ### Getting a hash of all attributes
95
91
  ```ruby
96
92
  > attributes = @id_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81")
97
- > attributes = @email_idr.get_attributes("admin@hetzner.co.za")
98
93
  > puts attributes.inspect
99
94
  {
100
95
  "identity_id" => "identity-820d5660-2204-4f7d-8c04-746313439b81",
@@ -12,7 +12,7 @@ module Soar
12
12
  attr_reader :translator
13
13
 
14
14
  ##
15
- # @param [Hash] configuration
15
+ # @param directory [Hash] directory configuration
16
16
  ##
17
17
  def initialize(directory: nil)
18
18
  @translator = Soar::Registry::Identity::Provider::Staff::Translator::Default.new
@@ -12,7 +12,7 @@ module Soar
12
12
  # @return [Hash] an identity
13
13
  ##
14
14
  def calculate_identities(identifier)
15
- entries = @directory.search("email", identifier )
15
+ entries = @directory.search(@directory.index[1], identifier )
16
16
  return [@translator.get_identity(entries)[0]]
17
17
  end
18
18
 
@@ -1,8 +1,6 @@
1
1
  [
2
2
  {
3
3
  "uuid": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
4
- "entity_id": "entity-2d931510-d99f-494a-8c67-87feb05e1594",
5
- "email": "test+publisher@hetzner.co.za",
6
4
  "roles": {
7
5
  "staff": {
8
6
  "department": "technical"
@@ -14,8 +12,6 @@
14
12
  },
15
13
  {
16
14
  "uuid": "identity-43353f18-8afe-11e6-ae22-56b6b6499611",
17
- "entity_id": "entity-2d931510-d99f-494a-8c67-87feb05e1594",
18
- "email": "test+consumer@hetzner.co.za",
19
15
  "roles": {
20
16
  "staff": {},
21
17
  "configuration_consumer": {
@@ -26,8 +22,6 @@
26
22
  },
27
23
  {
28
24
  "uuid": "identity-820d5660-2204-4f7d-8c04-746313439b81",
29
- "entity_id": "entity-bad85eb9-0713-4da7-8d36-07a8e4b00eab",
30
- "email": "admin@hetzner.co.za",
31
25
  "roles": {
32
26
  "staff": {},
33
27
  "configuration_publisher": {
@@ -37,20 +31,10 @@
37
31
  "configuration_identifiers": ["*"]
38
32
  }
39
33
 
40
- },
41
- "address": {
42
- "detail": "Belvedere Office Park, Unit F",
43
- "street": "Bella Rosa Street",
44
- "suburb": "Tygervalley",
45
- "city": "Durbanville",
46
- "postal": "7550"
47
34
  }
48
35
  },
49
36
  {
50
37
  "uuid": "identity-1ff472a6-8df3-4f13-82c3-89fde26db3cf",
51
- "entity_id": "entity-bad85eb9-0713-4da7-8d36-07a8e4b00eab",
52
- "email": "none@example.com",
53
- "client_nr": "C123456789",
54
38
  "roles": {
55
39
  "customer": {},
56
40
  "reseller": {}
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "entryUUID": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
4
+ "Email": "test+publisher@hetzner.co.za"
5
+ },
6
+ {
7
+ "entryUUID": "identity-43353f18-8afe-11e6-ae22-56b6b6499611",
8
+ "Email": "test+consumer@hetzner.co.za"
9
+ },
10
+ {
11
+ "entryUUID": "identity-820d5660-2204-4f7d-8c04-746313439b81",
12
+ "Email": "admin@hetzner.co.za"
13
+ },
14
+ {
15
+ "entryUUID": "identity-1ff472a6-8df3-4f13-82c3-89fde26db3cf",
16
+ "Email": "none@example.com"
17
+ }
18
+ ]
19
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar-registry-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Mulder
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: 2.0.0
41
41
  description: Registry of identities
42
42
  email: charles.mulder@hetzner.co.za
43
43
  executables: []
@@ -51,7 +51,8 @@ files:
51
51
  - lib/soar/registry/identity/provider/staff/email.rb
52
52
  - lib/soar/registry/identity/provider/staff/id.rb
53
53
  - lib/soar/registry/identity/provider/staff/translator/default.rb
54
- - lib/soar/registry/identity/test/fixtures/entries.json
54
+ - lib/soar/registry/identity/test/fixtures/dynamodb.json
55
+ - lib/soar/registry/identity/test/fixtures/ldap.json
55
56
  homepage: https://gitlab.host-h.net/registries/identity
56
57
  licenses:
57
58
  - MIT