@toa.io/extensions.exposition 1.0.0-alpha.92 → 1.0.0-alpha.93

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.
Files changed (25) hide show
  1. package/components/identity.federation/manifest.toa.yaml +8 -2
  2. package/components/identity.federation/operations/authenticate.d.ts +13 -2
  3. package/components/identity.federation/operations/authenticate.js +1 -1
  4. package/components/identity.federation/operations/authenticate.js.map +1 -1
  5. package/components/identity.federation/operations/incept.js +1 -1
  6. package/components/identity.federation/operations/incept.js.map +1 -1
  7. package/components/identity.federation/operations/lib/jwt.d.ts +1 -1
  8. package/components/identity.federation/operations/lib/jwt.js +3 -3
  9. package/components/identity.federation/operations/lib/jwt.js.map +1 -1
  10. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  11. package/components/identity.federation/operations/types/context.d.ts +0 -10
  12. package/components/identity.federation/source/authenticate.ts +16 -5
  13. package/components/identity.federation/source/incept.ts +2 -3
  14. package/components/identity.federation/source/lib/jwt.ts +2 -2
  15. package/components/identity.federation/source/types/context.ts +0 -12
  16. package/features/access.feature +2 -2
  17. package/features/authorities.federation.feature +12 -9
  18. package/features/etag.feature +1 -1
  19. package/features/identity.basic.feature +2 -2
  20. package/features/identity.federation.feature +57 -2
  21. package/features/octets.feature +1 -1
  22. package/package.json +8 -8
  23. package/source/directives/flow/Compose.ts +1 -1
  24. package/transpiled/directives/flow/Compose.js.map +1 -1
  25. package/transpiled/tsconfig.tsbuildinfo +1 -1
@@ -53,15 +53,3 @@ export interface IdToken {
53
53
  iat: number
54
54
  nbf?: number
55
55
  }
56
-
57
- export interface AuthenticateInput {
58
- authority: string
59
- credentials: string
60
- }
61
-
62
- export interface AuthenticateOutput {
63
- identity: {
64
- id: string
65
- claim: Pick<IdToken, 'iss' | 'sub' | 'aud'>
66
- }
67
- }
@@ -421,12 +421,12 @@ Feature: Access authorization
421
421
  """
422
422
  403 Forbidden
423
423
 
424
- Basic authentication scheme is required to access this resource.
424
+ Basic authentication scheme is required to access this resource
425
425
  """
426
426
 
427
427
  Scenario: Adding a role without required permissions
428
428
 
429
- Trunk directives should not be applied to the Identity management resources.
429
+ Trunk directives should not be applied to the Identity management resources
430
430
 
431
431
  Given the annotation:
432
432
  """yaml
@@ -1,5 +1,15 @@
1
1
  Feature: OIDC tokens with authorities
2
2
 
3
+ Background:
4
+ Given local IDP is running
5
+ And the `identity.federation` database is empty
6
+ And the `identity.federation` configuration:
7
+ """yaml
8
+ trust:
9
+ - iss: http://localhost:44444
10
+ """
11
+
12
+
3
13
  Scenario: OIDC tokens are scoped to authorities
4
14
  Given the annotation:
5
15
  """yaml
@@ -11,13 +21,6 @@ Feature: OIDC tokens with authorities
11
21
  GET:
12
22
  dev:stub: Hello
13
23
  """
14
- And local IDP is running
15
- And the `identity.federation` database is empty
16
- And the `identity.federation` configuration:
17
- """yaml
18
- trust:
19
- - iss: http://localhost:44444
20
- """
21
24
  And the IDP token for One is issued
22
25
  And the IDP token for Two is issued
23
26
 
@@ -29,7 +32,7 @@ Feature: OIDC tokens with authorities
29
32
  accept: application/yaml
30
33
  content-type: application/yaml
31
34
 
32
- credentials: ${{ One.id_token }}
35
+ token: ${{ One.id_token }}
33
36
  """
34
37
  Then the following reply is sent:
35
38
  """
@@ -44,7 +47,7 @@ Feature: OIDC tokens with authorities
44
47
  accept: application/yaml
45
48
  content-type: application/yaml
46
49
 
47
- credentials: ${{ Two.id_token }}
50
+ token: ${{ Two.id_token }}
48
51
  """
49
52
  Then the following reply is sent:
50
53
  """
@@ -176,7 +176,7 @@ Feature: Optimistic concurrency control
176
176
  """
177
177
  400 Bad Request
178
178
 
179
- Invalid ETag.
179
+ Invalid ETag
180
180
  """
181
181
 
182
182
  Scenario: Etag with non-queryable operation
@@ -207,7 +207,7 @@ Feature: Basic authentication
207
207
  422 Unprocessable Entity
208
208
 
209
209
  code: <code>
210
- message: <problem> is not meeting the requirements.
210
+ message: <problem> is not meeting the requirements
211
211
  """
212
212
  Examples:
213
213
  | username | password | problem | code |
@@ -318,7 +318,7 @@ Feature: Basic authentication
318
318
  422 Unprocessable Entity
319
319
 
320
320
  code: PRINCIPAL_LOCKED
321
- message: Principal username cannot be changed.
321
+ message: Principal username cannot be changed
322
322
  """
323
323
 
324
324
  Scenario: Creating an Identity using inception with existing credentials
@@ -18,7 +18,6 @@ Feature: Identity Federation
18
18
  host: nex.toa.io
19
19
  authorization: Bearer ${{ User.id_token }}
20
20
  accept: application/yaml
21
- content-type: application/yaml
22
21
  """
23
22
  Then the following reply is sent:
24
23
  """
@@ -76,7 +75,6 @@ Feature: Identity Federation
76
75
  host: nex.toa.io
77
76
  authorization: Bearer ${{ GoodUser.id_token }}
78
77
  accept: application/yaml
79
- content-type: application/yaml
80
78
  """
81
79
  Then the following reply is sent:
82
80
  """
@@ -206,3 +204,60 @@ Feature: Identity Federation
206
204
  roles:
207
205
  - system
208
206
  """
207
+
208
+ Scenario: Adding federation to an existing identity
209
+ Given the `identity.federation` configuration:
210
+ """yaml
211
+ trust:
212
+ - iss: http://localhost:44444
213
+ """
214
+ And the `identity.basic` database is empty
215
+
216
+ # create an identity
217
+ When the following request is received:
218
+ """
219
+ POST /identity/basic/ HTTP/1.1
220
+ host: nex.toa.io
221
+ content-type: application/yaml
222
+ accept: application/yaml
223
+
224
+ username: #{{ id | set Bob.username }}
225
+ password: #{{ password 8 | set Bob.password }}
226
+ """
227
+ Then the following reply is sent:
228
+ """
229
+ 201 Created
230
+
231
+ id: ${{ Bob.id }}
232
+ """
233
+
234
+ When the IDP token for Bob is issued
235
+
236
+ # add federation
237
+ When the following request is received:
238
+ """
239
+ POST /identity/federation/${{ User.id }}/ HTTP/1.1
240
+ host: nex.toa.io
241
+ authorization: Basic #{{ basic Bob }}
242
+ content-type: application/yaml
243
+ accept: application/yaml
244
+
245
+ credentials: ${{ Bob.id_token }}
246
+ """
247
+ Then the following reply is sent:
248
+ """
249
+ 201 Created
250
+ """
251
+ And the following request is received:
252
+ """
253
+ GET /identity/ HTTP/1.1
254
+ host: nex.toa.io
255
+ authorization: Bearer ${{ Bob.id_token }}
256
+ accept: application/yaml
257
+ """
258
+ Then the following reply is sent:
259
+ """
260
+ 200 OK
261
+
262
+ id: ${{ Bob.id }}
263
+ """
@@ -243,5 +243,5 @@ Feature: Octets directive family
243
243
  404 Not Found
244
244
  content-type: text/plain
245
245
 
246
- Trailing slash is redundant.
246
+ Trailing slash is redundant
247
247
  """
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.exposition",
3
- "version": "1.0.0-alpha.92",
3
+ "version": "1.0.0-alpha.93",
4
4
  "description": "Toa Exposition",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@isaacs/ttlcache": "1.4.1",
21
- "@toa.io/core": "1.0.0-alpha.92",
22
- "@toa.io/generic": "1.0.0-alpha.63",
23
- "@toa.io/schemas": "1.0.0-alpha.63",
21
+ "@toa.io/core": "1.0.0-alpha.93",
22
+ "@toa.io/generic": "1.0.0-alpha.93",
23
+ "@toa.io/schemas": "1.0.0-alpha.93",
24
24
  "bcryptjs": "2.4.3",
25
25
  "error-value": "0.3.0",
26
26
  "http-cache-semantics": "4.1.1",
@@ -28,7 +28,7 @@
28
28
  "matchacho": "0.3.5",
29
29
  "msgpackr": "1.10.1",
30
30
  "negotiator": "0.6.3",
31
- "openspan": "1.0.0-alpha.92",
31
+ "openspan": "1.0.0-alpha.93",
32
32
  "paseto": "3.1.4"
33
33
  },
34
34
  "jest": {
@@ -50,13 +50,13 @@
50
50
  "features:octets": "cucumber-js features/octets.*"
51
51
  },
52
52
  "devDependencies": {
53
- "@toa.io/agent": "1.0.0-alpha.79",
54
- "@toa.io/extensions.storages": "1.0.0-alpha.92",
53
+ "@toa.io/agent": "1.0.0-alpha.93",
54
+ "@toa.io/extensions.storages": "1.0.0-alpha.93",
55
55
  "@types/bcryptjs": "2.4.3",
56
56
  "@types/cors": "2.8.13",
57
57
  "@types/http-cache-semantics": "4.0.4",
58
58
  "@types/negotiator": "0.6.1",
59
59
  "jest-esbuild": "0.3.0"
60
60
  },
61
- "gitHead": "975ee5af6194354efb6dd8c646b22a89c4d96f7a"
61
+ "gitHead": "8538b10fed0e3f692b6a5b74dbafb9dcbcdd6a47"
62
62
  }
@@ -56,7 +56,7 @@ function json (node: object | string): string {
56
56
  return node
57
57
 
58
58
  if (Array.isArray(node))
59
- return `[${node.map((v) => json(v)).join(',')}]`
59
+ return `[${node.map((v) => json(v as object | string)).join(',')}]`
60
60
 
61
61
  if (node.constructor !== Object)
62
62
  return JSON.stringify(node)
@@ -1 +1 @@
1
- {"version":3,"file":"Compose.js","sourceRoot":"","sources":["../../../source/directives/flow/Compose.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkC;AAClC,oDAAqC;AACrC,6CAAsC;AACtC,uCAAkC;AAKlC,MAAa,OAAO;IACD,UAAU,CAAY;IAEvC,YAAoB,WAAgB;QAClC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,WAAqB,CAAC,CAAA;IAClD,CAAC;IAEM,MAAM,CAAE,OAAgB;QAC7B,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,OAAwB,EAAE,EAAE;YACjE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,YAAY,sBAAQ,CAAC,EAAE,CAAC;gBACxC,kBAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAA;gBAEnE,OAAM;YACR,CAAC;YAED,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,YAAY,sBAAQ,EAAE,+BAA+B,CAAC,CAAA;YAE5E,uEAAuE;YACvE,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,uCAAuC,CAAC,CAAA;YAE1F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