@toa.io/extensions.exposition 1.0.0-alpha.136 → 1.0.0-alpha.138
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/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/manifest.toa.yaml +2 -0
- package/components/identity.federation/operations/authenticate.js +3 -1
- package/components/identity.federation/operations/authenticate.js.map +1 -1
- package/components/identity.federation/operations/decode.js +1 -1
- package/components/identity.federation/operations/decode.js.map +1 -1
- package/components/identity.federation/operations/incept.js +1 -1
- package/components/identity.federation/operations/incept.js.map +1 -1
- package/components/identity.federation/operations/lib/jwt.d.ts +3 -2
- package/components/identity.federation/operations/lib/jwt.js +16 -4
- package/components/identity.federation/operations/lib/jwt.js.map +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/types/configuration.d.ts +1 -1
- package/components/identity.federation/operations/types/context.d.ts +4 -1
- package/components/identity.federation/source/authenticate.ts +4 -1
- package/components/identity.federation/source/decode.ts +1 -1
- package/components/identity.federation/source/incept.ts +1 -1
- package/components/identity.federation/source/lib/jwt.ts +24 -4
- package/components/identity.federation/source/types/configuration.ts +1 -1
- package/components/identity.federation/source/types/context.ts +4 -1
- package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
- package/features/identity.federation.feature +37 -0
- package/features/steps/IdP.ts +29 -0
- package/package.json +2 -2
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -266,3 +266,40 @@ Feature: Identity Federation
|
|
|
266
266
|
|
|
267
267
|
id: ${{ Bob.id }}
|
|
268
268
|
"""
|
|
269
|
+
|
|
270
|
+
Scenario: Tokens with `jti` are one-time
|
|
271
|
+
Given the `identity.federation` configuration:
|
|
272
|
+
"""yaml
|
|
273
|
+
trust:
|
|
274
|
+
- iss: http://localhost:44444
|
|
275
|
+
implicit: true
|
|
276
|
+
"""
|
|
277
|
+
And ID token with jti is issued for User
|
|
278
|
+
When the following request is received:
|
|
279
|
+
"""
|
|
280
|
+
GET /identity/ HTTP/1.1
|
|
281
|
+
host: nex.toa.io
|
|
282
|
+
authorization: Bearer ${{ User.id_token }}
|
|
283
|
+
accept: application/yaml
|
|
284
|
+
"""
|
|
285
|
+
Then the following reply is sent:
|
|
286
|
+
"""
|
|
287
|
+
200 OK
|
|
288
|
+
authorization: Token ${{ User.token }}
|
|
289
|
+
|
|
290
|
+
id: ${{ User.id }}
|
|
291
|
+
roles: []
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
# second use
|
|
295
|
+
When the following request is received:
|
|
296
|
+
"""
|
|
297
|
+
GET /identity/ HTTP/1.1
|
|
298
|
+
host: nex.toa.io
|
|
299
|
+
authorization: Bearer ${{ User.id_token }}
|
|
300
|
+
accept: application/yaml
|
|
301
|
+
"""
|
|
302
|
+
Then the following reply is sent:
|
|
303
|
+
"""
|
|
304
|
+
401 Unauthorized
|
|
305
|
+
"""
|
package/features/steps/IdP.ts
CHANGED
|
@@ -184,4 +184,33 @@ export class IdP {
|
|
|
184
184
|
|
|
185
185
|
this.captures.set(`${user}.id_token`, idToken)
|
|
186
186
|
}
|
|
187
|
+
|
|
188
|
+
@given('ID token with jti is issued for {word}')
|
|
189
|
+
public async issueTokenWithJti (user: string): Promise<void> {
|
|
190
|
+
assert.ok(IdP.privateKey, 'IdP private key is not available')
|
|
191
|
+
|
|
192
|
+
const jwt = [
|
|
193
|
+
{
|
|
194
|
+
typ: 'JWT',
|
|
195
|
+
alg: 'RS256'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
iss: IdP.issuer,
|
|
199
|
+
sub: user,
|
|
200
|
+
aud: 'test',
|
|
201
|
+
email: user + '@test.local',
|
|
202
|
+
iat: Math.floor(Date.now() / 1000),
|
|
203
|
+
exp: Math.floor((Date.now() + 1000 * 60 * 5) / 1000),
|
|
204
|
+
jti: crypto.randomUUID()
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
.map((v) => Buffer.from(JSON.stringify(v)).toString('base64url'))
|
|
208
|
+
.join('.')
|
|
209
|
+
|
|
210
|
+
const signature = crypto.createSign('RSA-SHA256').end(jwt).sign(IdP.privateKey, 'base64url')
|
|
211
|
+
|
|
212
|
+
const idToken = `${jwt}.${signature}`
|
|
213
|
+
|
|
214
|
+
this.captures.set(`${user}.id_token`, idToken)
|
|
215
|
+
}
|
|
187
216
|
}
|
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.138",
|
|
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
|
"@types/negotiator": "0.6.1",
|
|
64
64
|
"jest-esbuild": "0.3.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f50ba7a0b226c03a7c9a6e217a10dc66d8ccd956"
|
|
67
67
|
}
|