@toa.io/extensions.exposition 1.0.0-alpha.185 → 1.0.0-alpha.187
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.
- package/components/identity.basic/manifest.toa.yaml +18 -3
- package/components/identity.basic/operations/add.d.ts +3 -0
- package/components/identity.basic/operations/add.js +16 -0
- package/components/identity.basic/operations/add.js.map +1 -0
- package/components/identity.basic/operations/transit.js +5 -1
- package/components/identity.basic/operations/transit.js.map +1 -1
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/operations/types.d.ts +7 -1
- package/components/identity.basic/source/add.ts +14 -0
- package/components/identity.basic/source/transit.ts +6 -2
- package/components/identity.basic/source/types.ts +8 -1
- package/components/identity.otp/manifest.toa.yaml +13 -4
- package/components/identity.otp/operations/issue.d.ts +1 -0
- package/components/identity.otp/operations/issue.js +3 -2
- package/components/identity.otp/operations/issue.js.map +1 -1
- package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/source/issue.ts +5 -3
- package/documentation/components.md +10 -2
- package/features/identity.basic.feature +50 -0
- package/package.json +2 -2
- package/components/identity.basic/operations/assert.d.ts +0 -5
- package/components/identity.basic/operations/assert.js +0 -7
- package/components/identity.basic/operations/assert.js.map +0 -1
|
@@ -4,17 +4,19 @@ export async function effect (input: Input, context: Context): Promise<Output> {
|
|
|
4
4
|
const { authority, username } = input
|
|
5
5
|
const code = Math.floor(100000 + Math.random() * 900000).toString()
|
|
6
6
|
const key = `${authority}:${username}:${code}`
|
|
7
|
+
const lifetime = input.lifetime ?? context.configuration.lifetime
|
|
7
8
|
|
|
8
|
-
context.logs.debug('Issue OTP', { authority, username, code })
|
|
9
|
-
|
|
10
|
-
await context.stash.set(key, 1, 'EX', context.configuration.lifetime)
|
|
9
|
+
context.logs.debug('Issue OTP', { authority, username, code, lifetime })
|
|
11
10
|
|
|
11
|
+
await context.stash.set(key, 1, 'EX', lifetime)
|
|
12
|
+
|
|
12
13
|
return { code }
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
interface Input {
|
|
16
17
|
authority: string
|
|
17
18
|
username: string
|
|
19
|
+
lifetime?: number
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
interface Output {
|
|
@@ -95,14 +95,22 @@ password?: string
|
|
|
95
95
|
|
|
96
96
|
Access requires basic credentials of the modified Identity or `system:identity:basic` role.
|
|
97
97
|
|
|
98
|
+
<code>POST</code> Incept new basic credentials. Request body is as follows:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
username: string
|
|
102
|
+
password: string
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Identity should not have associated basic credentials. Access requires any credentials of the Identity.
|
|
106
|
+
|
|
98
107
|
#### `/identity/basic/usernames/:username/`
|
|
99
108
|
|
|
100
109
|
<code>GET</code> Check if the username is available.
|
|
101
110
|
|
|
102
111
|
`username` must be Base64 URL encoded.
|
|
103
112
|
|
|
104
|
-
Returns empty response with status `204`
|
|
105
|
-
if the username is already taken or `404` if it is available.
|
|
113
|
+
Returns empty response with status `204` if the username is already taken or `404` if it is available.
|
|
106
114
|
|
|
107
115
|
## Identity federation (OpenID connect)
|
|
108
116
|
|
|
@@ -424,3 +424,53 @@ Feature: Basic authentication
|
|
|
424
424
|
"""
|
|
425
425
|
404 Not Found
|
|
426
426
|
"""
|
|
427
|
+
|
|
428
|
+
Scenario: Adding new basic credentials
|
|
429
|
+
Given transient identity
|
|
430
|
+
When the following request is received:
|
|
431
|
+
"""
|
|
432
|
+
POST /identity/basic/${{ identity.id }}/ HTTP/1.1
|
|
433
|
+
host: nex.toa.io
|
|
434
|
+
authorization: Token ${{ identity.token }}
|
|
435
|
+
accept: application/yaml
|
|
436
|
+
content-type: application/yaml
|
|
437
|
+
|
|
438
|
+
username: developer
|
|
439
|
+
password: secret#1234
|
|
440
|
+
"""
|
|
441
|
+
Then the following reply is sent:
|
|
442
|
+
"""
|
|
443
|
+
201 Created
|
|
444
|
+
"""
|
|
445
|
+
When the following request is received:
|
|
446
|
+
"""
|
|
447
|
+
GET /identity/ HTTP/1.1
|
|
448
|
+
host: nex.toa.io
|
|
449
|
+
authorization: Basic ZGV2ZWxvcGVyOnNlY3JldCMxMjM0
|
|
450
|
+
accept: application/yaml
|
|
451
|
+
"""
|
|
452
|
+
Then the following reply is sent:
|
|
453
|
+
"""
|
|
454
|
+
200 OK
|
|
455
|
+
|
|
456
|
+
id: ${{ id }}
|
|
457
|
+
"""
|
|
458
|
+
|
|
459
|
+
# credentials already exist
|
|
460
|
+
When the following request is received:
|
|
461
|
+
"""
|
|
462
|
+
POST /identity/basic/${{ identity.id }}/ HTTP/1.1
|
|
463
|
+
host: nex.toa.io
|
|
464
|
+
authorization: Token ${{ identity.token }}
|
|
465
|
+
accept: application/yaml
|
|
466
|
+
content-type: application/yaml
|
|
467
|
+
|
|
468
|
+
username: painter
|
|
469
|
+
password: secret#4321
|
|
470
|
+
"""
|
|
471
|
+
Then the following reply is sent:
|
|
472
|
+
"""
|
|
473
|
+
422 Unprocessable Entity
|
|
474
|
+
|
|
475
|
+
code: EXISTS
|
|
476
|
+
"""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.exposition",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.187",
|
|
4
4
|
"description": "Toa Exposition",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
},
|
|
64
64
|
"testEnvironment": "node"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8279dd4f84dd1862f956682551ef418278be2ee8"
|
|
67
67
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../source/assert.ts"],"names":[],"mappings":";;;AAEA,SAAgB,MAAM,CAAC,KAAY,EAAE,OAAgB;AAErD,CAAC;AAFD,wBAEC"}
|