@toa.io/extensions.exposition 1.0.0-alpha.282 → 1.0.0-alpha.284
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/CHANGELOG.md +56 -0
- package/components/exposition.octets/manifest.toa.yaml +11 -0
- package/components/exposition.octets/types/index.d.ts +3 -0
- package/components/exposition.octets/types/toa.d.ts +41 -0
- package/components/identity.bans/operations/transit.js +1 -1
- package/components/identity.bans/tsconfig.json +1 -1
- package/components/identity.bans/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/types/index.d.ts +3 -0
- package/components/identity.bans/types/toa.d.ts +34 -0
- package/components/identity.basic/manifest.toa.yaml +13 -2
- package/components/identity.basic/operations/add.js +1 -1
- package/components/identity.basic/operations/authenticate.js +1 -1
- package/components/identity.basic/operations/check.js +1 -1
- package/components/identity.basic/operations/delete.js +1 -1
- package/components/identity.basic/operations/incept.js +18 -2
- package/components/identity.basic/operations/info.js +1 -1
- package/components/identity.basic/operations/lib/credentials.js +1 -1
- package/components/identity.basic/operations/transit.js +3 -2
- package/components/identity.basic/source/add.ts +3 -3
- package/components/identity.basic/source/authenticate.ts +2 -2
- package/components/identity.basic/source/check.ts +1 -1
- package/components/identity.basic/source/delete.ts +2 -2
- package/components/identity.basic/source/incept.ts +31 -3
- package/components/identity.basic/source/info.ts +1 -1
- package/components/identity.basic/source/transit.ts +6 -4
- package/components/identity.basic/tsconfig.json +1 -1
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/types/index.d.ts +22 -0
- package/components/identity.basic/types/toa.d.ts +121 -0
- package/components/identity.clients/manifest.toa.yaml +243 -0
- package/components/identity.clients/operations/describe.js +44 -0
- package/components/identity.clients/operations/lib/Context.js +2 -0
- package/components/identity.clients/operations/lib/Entity.js +2 -0
- package/components/identity.clients/operations/lib/canonical.js +24 -0
- package/components/identity.clients/operations/lib/cimd.js +86 -0
- package/components/identity.clients/operations/lib/errors.js +5 -0
- package/components/identity.clients/operations/lib/index.js +7 -0
- package/components/identity.clients/operations/lib/redirect.js +32 -0
- package/components/identity.clients/operations/register.js +84 -0
- package/components/identity.clients/source/describe.ts +65 -0
- package/components/identity.clients/source/lib/Context.ts +38 -0
- package/components/identity.clients/source/lib/Entity.ts +31 -0
- package/components/identity.clients/source/lib/canonical.test.ts +43 -0
- package/components/identity.clients/source/lib/canonical.ts +27 -0
- package/components/identity.clients/source/lib/cimd.test.ts +120 -0
- package/components/identity.clients/source/lib/cimd.ts +107 -0
- package/components/identity.clients/source/lib/errors.ts +4 -0
- package/components/identity.clients/source/lib/index.ts +6 -0
- package/components/identity.clients/source/lib/redirect.test.ts +41 -0
- package/components/identity.clients/source/lib/redirect.ts +35 -0
- package/components/identity.clients/source/register.ts +125 -0
- package/components/identity.clients/tsconfig.json +10 -0
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -0
- package/components/identity.clients/types/index.d.ts +3 -0
- package/components/identity.clients/types/toa.d.ts +109 -0
- package/components/identity.credentials/operations/list.js +1 -1
- package/components/identity.credentials/source/list.ts +2 -1
- package/components/identity.credentials/tsconfig.json +4 -2
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/types/index.d.ts +3 -0
- package/components/identity.credentials/types/toa.d.ts +30 -0
- package/components/identity.federation/manifest.toa.yaml +37 -1
- package/components/identity.federation/operations/authenticate.js +7 -3
- package/components/identity.federation/operations/create.js +1 -1
- package/components/identity.federation/operations/decode.js +1 -1
- package/components/identity.federation/operations/delete.js +1 -1
- package/components/identity.federation/operations/incept.js +6 -2
- package/components/identity.federation/operations/lib/Configuration.js +1 -1
- package/components/identity.federation/operations/lib/Ctx.js +1 -1
- package/components/identity.federation/operations/lib/Payload.js +1 -1
- package/components/identity.federation/operations/lib/decode.js +23 -9
- package/components/identity.federation/operations/lib/discovery.js +1 -1
- package/components/identity.federation/operations/lib/errors.js +5 -1
- package/components/identity.federation/operations/lib/exchange.js +12 -7
- package/components/identity.federation/operations/lib/index.js +2 -1
- package/components/identity.federation/operations/lib/jose.js +1 -1
- package/components/identity.federation/operations/lib/principal.js +14 -0
- package/components/identity.federation/operations/lib/resolve.js +1 -1
- package/components/identity.federation/operations/list.js +1 -1
- package/components/identity.federation/operations/types/Scheme.js +1 -1
- package/components/identity.federation/operations/types/configuration.js +1 -1
- package/components/identity.federation/operations/types/context.js +1 -1
- package/components/identity.federation/operations/types/entity.js +1 -1
- package/components/identity.federation/operations/types/index.js +1 -1
- package/components/identity.federation/source/authenticate.ts +9 -3
- package/components/identity.federation/source/incept.ts +7 -1
- package/components/identity.federation/source/lib/Ctx.ts +2 -2
- package/components/identity.federation/source/lib/decode.ts +25 -9
- package/components/identity.federation/source/lib/errors.ts +5 -0
- package/components/identity.federation/source/lib/exchange.ts +11 -7
- package/components/identity.federation/source/lib/index.ts +1 -0
- package/components/identity.federation/source/lib/principal.ts +17 -0
- package/components/identity.federation/source/types/configuration.ts +1 -1
- package/components/identity.federation/source/types/context.ts +6 -2
- package/components/identity.federation/tsconfig.json +4 -2
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/types/index.d.ts +3 -0
- package/components/identity.federation/types/toa.d.ts +127 -0
- package/components/identity.grants/manifest.toa.yaml +245 -0
- package/components/identity.grants/operations/authorize.js +54 -0
- package/components/identity.grants/operations/exchange.js +89 -0
- package/components/identity.grants/operations/lib/code.js +30 -0
- package/components/identity.grants/operations/lib/identify.js +15 -0
- package/components/identity.grants/operations/lib/index.js +3 -0
- package/components/identity.grants/operations/list.js +18 -0
- package/components/identity.grants/operations/revoke.js +25 -0
- package/components/identity.grants/source/authorize.ts +90 -0
- package/components/identity.grants/source/exchange.ts +130 -0
- package/components/identity.grants/source/lib/code.ts +39 -0
- package/components/identity.grants/source/lib/identify.ts +16 -0
- package/components/identity.grants/source/lib/index.ts +3 -0
- package/components/identity.grants/source/list.ts +28 -0
- package/components/identity.grants/source/revoke.ts +38 -0
- package/components/identity.grants/tsconfig.json +10 -0
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -0
- package/components/identity.grants/types/index.d.ts +60 -0
- package/components/identity.grants/types/toa.d.ts +108 -0
- package/components/identity.keys/manifest.toa.yaml +1 -0
- package/components/identity.keys/operations/create.js +1 -1
- package/components/identity.keys/operations/disable.js +1 -1
- package/components/identity.keys/operations/revoke.js +1 -1
- package/components/identity.keys/source/create.ts +1 -1
- package/components/identity.keys/source/revoke.ts +1 -1
- package/components/identity.keys/tsconfig.json +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/types/index.d.ts +3 -0
- package/components/identity.keys/types/toa.d.ts +47 -0
- package/components/identity.otp/operations/authenticate.js +1 -1
- package/components/identity.otp/operations/issue.js +1 -1
- package/components/identity.otp/operations/lib/Context.js +1 -1
- package/components/identity.otp/operations/lib/Entity.js +1 -1
- package/components/identity.otp/operations/lib/index.js +1 -1
- package/components/identity.otp/source/lib/Context.ts +4 -2
- package/components/identity.otp/tsconfig.json +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/types/index.d.ts +3 -0
- package/components/identity.otp/types/toa.d.ts +56 -0
- package/components/identity.passkeys/manifest.toa.yaml +3 -0
- package/components/identity.passkeys/operations/authenticate.js +1 -1
- package/components/identity.passkeys/operations/challenge.js +1 -1
- package/components/identity.passkeys/operations/create.js +1 -1
- package/components/identity.passkeys/operations/delete.js +1 -1
- package/components/identity.passkeys/operations/lib/const.js +1 -1
- package/components/identity.passkeys/operations/list.js +1 -1
- package/components/identity.passkeys/operations/types/Configuration.js +1 -1
- package/components/identity.passkeys/operations/types/Context.js +1 -1
- package/components/identity.passkeys/operations/types/Passkey.js +1 -1
- package/components/identity.passkeys/operations/types/index.js +1 -1
- package/components/identity.passkeys/operations/use.js +1 -1
- package/components/identity.passkeys/source/authenticate.ts +1 -1
- package/components/identity.passkeys/source/challenge.ts +1 -1
- package/components/identity.passkeys/source/create.ts +1 -1
- package/components/identity.passkeys/source/types/Context.ts +2 -1
- package/components/identity.passkeys/source/use.ts +1 -1
- package/components/identity.passkeys/tsconfig.json +1 -1
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/index.d.ts +3 -0
- package/components/identity.passkeys/types/toa.d.ts +120 -0
- package/components/identity.roles/operations/grant.js +1 -1
- package/components/identity.roles/operations/lib/Entity.js +1 -1
- package/components/identity.roles/operations/list.js +1 -1
- package/components/identity.roles/operations/principal.js +29 -5
- package/components/identity.roles/source/principal.ts +33 -5
- package/components/identity.roles/tsconfig.json +1 -1
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/types/index.d.ts +3 -0
- package/components/identity.roles/types/toa.d.ts +43 -0
- package/components/identity.tokens/manifest.toa.yaml +34 -3
- package/components/identity.tokens/operations/authenticate.js +9 -1
- package/components/identity.tokens/operations/decrypt.js +3 -3
- package/components/identity.tokens/operations/encrypt.js +1 -1
- package/components/identity.tokens/operations/issue.js +3 -2
- package/components/identity.tokens/operations/lib/form.js +24 -0
- package/components/identity.tokens/operations/lib/index.js +2 -2
- package/components/identity.tokens/operations/lib/jose.js +1 -1
- package/components/identity.tokens/operations/lib/key.js +1 -1
- package/components/identity.tokens/operations/lib/pad.js +1 -1
- package/components/identity.tokens/operations/revoke.js +1 -1
- package/components/identity.tokens/source/authenticate.test.ts +8 -5
- package/components/identity.tokens/source/authenticate.ts +12 -1
- package/components/identity.tokens/source/decrypt.test.ts +1 -1
- package/components/identity.tokens/source/decrypt.ts +4 -3
- package/components/identity.tokens/source/encrypt.test.ts +1 -1
- package/components/identity.tokens/source/encrypt.ts +2 -1
- package/components/identity.tokens/source/issue.test.ts +71 -0
- package/components/identity.tokens/source/issue.ts +4 -2
- package/components/identity.tokens/source/lib/form.test.ts +25 -0
- package/components/identity.tokens/source/lib/form.ts +31 -0
- package/components/identity.tokens/source/lib/index.ts +2 -1
- package/components/identity.tokens/tsconfig.json +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/types/index.d.ts +61 -0
- package/components/identity.tokens/types/toa.d.ts +113 -0
- package/documentation/access.md +13 -0
- package/documentation/cache.md +10 -1
- package/documentation/components.md +3 -0
- package/documentation/consent.md +101 -0
- package/documentation/identity.md +3 -1
- package/documentation/introspection.md +13 -5
- package/documentation/io.md +42 -2
- package/documentation/map.md +8 -0
- package/documentation/mcp.md +180 -0
- package/documentation/oauth.md +180 -0
- package/documentation/protocol.md +4 -0
- package/documentation/rpc.md +140 -0
- package/documentation/tree.md +3 -0
- package/features/auth.bearer.feature +120 -0
- package/features/cache.feature +46 -0
- package/features/identity.basic.feature +44 -0
- package/features/identity.federation.feature +2 -5
- package/features/introspection.feature +333 -0
- package/features/mcp.feature +687 -0
- package/features/oauth.clients.feature +195 -0
- package/features/oauth.discovery.feature +164 -0
- package/features/oauth.grants.feature +299 -0
- package/features/octets.cloudinary.feature +1 -0
- package/features/rpc.feature +429 -0
- package/features/steps/Cloudinary.ts +13 -0
- package/features/steps/Components.ts +0 -4
- package/features/steps/Gateway.ts +23 -2
- package/features/steps/Parameters.ts +22 -7
- package/features/steps/Realtime.ts +3 -0
- package/features/steps/components/echo/manifest.toa.yaml +3 -0
- package/features/steps/components/octets.tester/manifest.toa.yaml +2 -0
- package/features/steps/components/octets.tester/operations/redirect.js +6 -1
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/features/steps/components/users/manifest.toa.yaml +1 -0
- package/package.json +8 -6
- package/readme.md +6 -0
- package/schemas/annotation.cos.yaml +63 -0
- package/schemas/call.cos.yaml +18 -0
- package/source/Annotation.ts +54 -0
- package/source/Directive.test.ts +15 -15
- package/source/Directive.ts +77 -9
- package/source/Endpoint.test.ts +67 -0
- package/source/Endpoint.ts +31 -11
- package/source/Factory.ts +6 -2
- package/source/Gateway.ts +73 -11
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Server.ts +15 -5
- package/source/HTTP/exceptions.ts +2 -2
- package/source/HTTP/formats/form.ts +21 -0
- package/source/HTTP/formats/index.ts +17 -2
- package/source/HTTP/messages.test.ts +25 -1
- package/source/HTTP/messages.ts +20 -4
- package/source/Interception.ts +8 -2
- package/source/Introspection.ts +102 -0
- package/source/MCP/Server.ts +275 -0
- package/source/MCP/discover.ts +52 -0
- package/source/MCP/errors.ts +81 -0
- package/source/MCP/index.ts +1 -0
- package/source/MCP/schema.test.ts +85 -0
- package/source/MCP/schema.ts +87 -0
- package/source/MCP/tools.ts +156 -0
- package/source/MCP/types.ts +81 -0
- package/source/Query.ts +48 -8
- package/source/RPC/Context.ts +78 -0
- package/source/RPC/Dispatcher.ts +130 -0
- package/source/RPC/errors.test.ts +52 -0
- package/source/RPC/errors.ts +83 -0
- package/source/RPC/index.ts +1 -0
- package/source/RPC/names.test.ts +122 -0
- package/source/RPC/names.ts +182 -0
- package/source/RPC/types.ts +34 -0
- package/source/RTD/Directives.ts +52 -2
- package/source/RTD/Endpoint.ts +2 -1
- package/source/RTD/Method.ts +14 -11
- package/source/RTD/Node.ts +38 -7
- package/source/RTD/Route.ts +30 -3
- package/source/RTD/Tree.ts +37 -1
- package/source/RTD/expiration.test.ts +1 -1
- package/source/RTD/walk.test.ts +110 -0
- package/source/const.ts +15 -0
- package/source/deployment.ts +11 -1
- package/source/directives/auth/Anonymous.test.ts +38 -0
- package/source/directives/auth/Anonymous.ts +12 -0
- package/source/directives/auth/Anyone.ts +4 -0
- package/source/directives/auth/Authorization.ts +108 -22
- package/source/directives/auth/Delegate.test.ts +36 -0
- package/source/directives/auth/Delegate.ts +14 -0
- package/source/directives/auth/Echo.ts +5 -0
- package/source/directives/auth/Incept.ts +16 -10
- package/source/directives/auth/Role.ts +13 -0
- package/source/directives/auth/Rule.ts +29 -0
- package/source/directives/auth/Scheme.ts +5 -0
- package/source/directives/auth/schemes.test.ts +8 -4
- package/source/directives/auth/schemes.ts +22 -9
- package/source/directives/auth/types.ts +26 -2
- package/source/directives/cache/Cache.ts +14 -5
- package/source/directives/cache/Control.ts +0 -3
- package/source/directives/dev/Development.ts +1 -1
- package/source/directives/flow/Fetch.ts +1 -1
- package/source/directives/flow/Flow.ts +1 -1
- package/source/directives/index.ts +5 -2
- package/source/directives/io/Directive.ts +1 -1
- package/source/directives/io/IO.ts +34 -3
- package/source/directives/io/Input.ts +3 -2
- package/source/directives/io/Output.ts +10 -4
- package/source/directives/io/Status.test.ts +84 -0
- package/source/directives/io/Status.ts +46 -0
- package/source/directives/io/Throttle.ts +1 -1
- package/source/directives/io/lib/throttle/Quotas.ts +2 -2
- package/source/directives/map/Headers.ts +11 -0
- package/source/directives/map/Map.ts +10 -1
- package/source/directives/map/Mapping.ts +23 -0
- package/source/directives/map/Segments.ts +12 -0
- package/source/directives/mcp/MCP.ts +33 -0
- package/source/directives/mcp/Tool.test.ts +66 -0
- package/source/directives/mcp/Tool.ts +28 -0
- package/source/directives/mcp/index.ts +6 -0
- package/source/directives/oauth/Discovery.ts +70 -0
- package/source/directives/oauth/documents.ts +113 -0
- package/source/directives/oauth/index.ts +3 -0
- package/source/directives/octets/Delete.ts +1 -1
- package/source/directives/octets/Get.ts +1 -1
- package/source/directives/octets/Octets.ts +1 -1
- package/source/directives/octets/Workflow.ts +1 -1
- package/source/directives/octets/workflows/Execution.ts +1 -1
- package/source/directives/require/Directive.ts +1 -1
- package/source/directives/require/Headers.ts +1 -1
- package/source/directives/require/Require.ts +2 -2
- package/source/index.ts +6 -0
- package/source/octets.d.ts +17 -0
- package/source/schemas.ts +2 -0
- package/source/userland.ts +47 -0
- package/transpiled/Annotation.d.ts +41 -0
- package/transpiled/Directive.d.ts +18 -1
- package/transpiled/Directive.js +50 -6
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Endpoint.d.ts +9 -0
- package/transpiled/Endpoint.js +27 -11
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +6 -2
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +19 -2
- package/transpiled/Gateway.js +51 -9
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +6 -0
- package/transpiled/HTTP/Context.js +6 -0
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +8 -1
- package/transpiled/HTTP/Server.js +4 -3
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/exceptions.d.ts +1 -1
- package/transpiled/HTTP/exceptions.js +2 -2
- package/transpiled/HTTP/exceptions.js.map +1 -1
- package/transpiled/HTTP/formats/form.d.ts +9 -0
- package/transpiled/HTTP/formats/form.js +18 -0
- package/transpiled/HTTP/formats/form.js.map +1 -0
- package/transpiled/HTTP/formats/index.d.ts +10 -2
- package/transpiled/HTTP/formats/index.js +10 -0
- package/transpiled/HTTP/formats/index.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +12 -0
- package/transpiled/HTTP/messages.js +12 -4
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Interception.d.ts +4 -1
- package/transpiled/Interception.js +4 -2
- package/transpiled/Interception.js.map +1 -1
- package/transpiled/Introspection.d.ts +40 -0
- package/transpiled/Introspection.js +50 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/Server.d.ts +41 -0
- package/transpiled/MCP/Server.js +180 -0
- package/transpiled/MCP/Server.js.map +1 -0
- package/transpiled/MCP/discover.d.ts +13 -0
- package/transpiled/MCP/discover.js +29 -0
- package/transpiled/MCP/discover.js.map +1 -0
- package/transpiled/MCP/errors.d.ts +24 -0
- package/transpiled/MCP/errors.js +67 -0
- package/transpiled/MCP/errors.js.map +1 -0
- package/transpiled/MCP/index.d.ts +1 -0
- package/transpiled/MCP/index.js +2 -0
- package/transpiled/MCP/index.js.map +1 -0
- package/transpiled/MCP/schema.d.ts +18 -0
- package/transpiled/MCP/schema.js +64 -0
- package/transpiled/MCP/schema.js.map +1 -0
- package/transpiled/MCP/tools.d.ts +31 -0
- package/transpiled/MCP/tools.js +121 -0
- package/transpiled/MCP/tools.js.map +1 -0
- package/transpiled/MCP/types.d.ts +64 -0
- package/transpiled/MCP/types.js +13 -0
- package/transpiled/MCP/types.js.map +1 -0
- package/transpiled/Query.d.ts +7 -0
- package/transpiled/Query.js +38 -7
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RPC/Context.d.ts +11 -0
- package/transpiled/RPC/Context.js +63 -0
- package/transpiled/RPC/Context.js.map +1 -0
- package/transpiled/RPC/Dispatcher.d.ts +19 -0
- package/transpiled/RPC/Dispatcher.js +100 -0
- package/transpiled/RPC/Dispatcher.js.map +1 -0
- package/transpiled/RPC/errors.d.ts +18 -0
- package/transpiled/RPC/errors.js +67 -0
- package/transpiled/RPC/errors.js.map +1 -0
- package/transpiled/RPC/index.d.ts +1 -0
- package/transpiled/RPC/index.js +2 -0
- package/transpiled/RPC/index.js.map +1 -0
- package/transpiled/RPC/names.d.ts +30 -0
- package/transpiled/RPC/names.js +121 -0
- package/transpiled/RPC/names.js.map +1 -0
- package/transpiled/RPC/types.d.ts +27 -0
- package/transpiled/RPC/types.js +8 -0
- package/transpiled/RPC/types.js.map +1 -0
- package/transpiled/RTD/Directives.d.ts +41 -2
- package/transpiled/RTD/Endpoint.d.ts +2 -1
- package/transpiled/RTD/Method.d.ts +8 -3
- package/transpiled/RTD/Method.js +12 -10
- package/transpiled/RTD/Method.js.map +1 -1
- package/transpiled/RTD/Node.d.ts +20 -2
- package/transpiled/RTD/Node.js +22 -4
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Route.d.ts +2 -1
- package/transpiled/RTD/Route.js +27 -2
- package/transpiled/RTD/Route.js.map +1 -1
- package/transpiled/RTD/Tree.d.ts +3 -1
- package/transpiled/RTD/Tree.js +26 -0
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/const.d.ts +12 -0
- package/transpiled/const.js +12 -0
- package/transpiled/const.js.map +1 -1
- package/transpiled/deployment.js +6 -0
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.d.ts +6 -0
- package/transpiled/directives/auth/Anonymous.js +10 -0
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.d.ts +1 -0
- package/transpiled/directives/auth/Anyone.js +3 -0
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Authorization.d.ts +28 -2
- package/transpiled/directives/auth/Authorization.js +87 -19
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +5 -0
- package/transpiled/directives/auth/Delegate.js +10 -0
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Echo.d.ts +2 -0
- package/transpiled/directives/auth/Echo.js +4 -0
- package/transpiled/directives/auth/Echo.js.map +1 -1
- package/transpiled/directives/auth/Incept.d.ts +1 -1
- package/transpiled/directives/auth/Incept.js +13 -8
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +2 -0
- package/transpiled/directives/auth/Role.js +9 -0
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/auth/Rule.d.ts +5 -0
- package/transpiled/directives/auth/Rule.js +20 -0
- package/transpiled/directives/auth/Rule.js.map +1 -1
- package/transpiled/directives/auth/Scheme.d.ts +2 -0
- package/transpiled/directives/auth/Scheme.js +4 -0
- package/transpiled/directives/auth/Scheme.js.map +1 -1
- package/transpiled/directives/auth/schemes.d.ts +16 -4
- package/transpiled/directives/auth/schemes.js +20 -8
- package/transpiled/directives/auth/schemes.js.map +1 -1
- package/transpiled/directives/auth/types.d.ts +20 -2
- package/transpiled/directives/cache/Cache.d.ts +1 -1
- package/transpiled/directives/cache/Cache.js +10 -3
- package/transpiled/directives/cache/Cache.js.map +1 -1
- package/transpiled/directives/cache/Control.js +0 -2
- package/transpiled/directives/cache/Control.js.map +1 -1
- package/transpiled/directives/dev/Development.d.ts +1 -1
- package/transpiled/directives/dev/Development.js +1 -1
- package/transpiled/directives/dev/Development.js.map +1 -1
- package/transpiled/directives/flow/Flow.d.ts +1 -1
- package/transpiled/directives/flow/Flow.js +1 -1
- package/transpiled/directives/flow/Flow.js.map +1 -1
- package/transpiled/directives/index.js +4 -2
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +1 -1
- package/transpiled/directives/io/IO.d.ts +7 -1
- package/transpiled/directives/io/IO.js +25 -3
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/Input.d.ts +3 -2
- package/transpiled/directives/io/Input.js +2 -1
- package/transpiled/directives/io/Input.js.map +1 -1
- package/transpiled/directives/io/Output.d.ts +5 -3
- package/transpiled/directives/io/Output.js +8 -3
- package/transpiled/directives/io/Output.js.map +1 -1
- package/transpiled/directives/io/Status.d.ts +19 -0
- package/transpiled/directives/io/Status.js +34 -0
- package/transpiled/directives/io/Status.js.map +1 -0
- package/transpiled/directives/io/Throttle.d.ts +1 -1
- package/transpiled/directives/io/Throttle.js +1 -1
- package/transpiled/directives/io/Throttle.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.d.ts +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.js +2 -2
- package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
- package/transpiled/directives/map/Headers.d.ts +2 -0
- package/transpiled/directives/map/Headers.js +8 -0
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/map/Map.d.ts +3 -1
- package/transpiled/directives/map/Map.js +7 -1
- package/transpiled/directives/map/Map.js.map +1 -1
- package/transpiled/directives/map/Mapping.d.ts +13 -0
- package/transpiled/directives/map/Mapping.js +20 -0
- package/transpiled/directives/map/Mapping.js.map +1 -1
- package/transpiled/directives/map/Segments.d.ts +3 -0
- package/transpiled/directives/map/Segments.js +9 -0
- package/transpiled/directives/map/Segments.js.map +1 -1
- package/transpiled/directives/mcp/MCP.d.ts +15 -0
- package/transpiled/directives/mcp/MCP.js +23 -0
- package/transpiled/directives/mcp/MCP.js.map +1 -0
- package/transpiled/directives/mcp/Tool.d.ts +13 -0
- package/transpiled/directives/mcp/Tool.js +23 -0
- package/transpiled/directives/mcp/Tool.js.map +1 -0
- package/transpiled/directives/mcp/index.d.ts +4 -0
- package/transpiled/directives/mcp/index.js +4 -0
- package/transpiled/directives/mcp/index.js.map +1 -0
- package/transpiled/directives/oauth/Discovery.d.ts +23 -0
- package/transpiled/directives/oauth/Discovery.js +55 -0
- package/transpiled/directives/oauth/Discovery.js.map +1 -0
- package/transpiled/directives/oauth/documents.d.ts +9 -0
- package/transpiled/directives/oauth/documents.js +82 -0
- package/transpiled/directives/oauth/documents.js.map +1 -0
- package/transpiled/directives/oauth/index.d.ts +2 -0
- package/transpiled/directives/oauth/index.js +3 -0
- package/transpiled/directives/oauth/index.js.map +1 -0
- package/transpiled/directives/octets/Octets.d.ts +1 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/require/Directive.d.ts +1 -1
- package/transpiled/directives/require/Headers.d.ts +1 -1
- package/transpiled/directives/require/Headers.js +1 -1
- package/transpiled/directives/require/Headers.js.map +1 -1
- package/transpiled/directives/require/Require.d.ts +1 -1
- package/transpiled/directives/require/Require.js +2 -2
- package/transpiled/directives/require/Require.js.map +1 -1
- package/transpiled/index.d.ts +2 -0
- package/transpiled/schemas.d.ts +2 -0
- package/transpiled/schemas.js +1 -0
- package/transpiled/schemas.js.map +1 -1
- package/transpiled/userland.d.ts +39 -0
- package/transpiled/userland.js +7 -0
- package/transpiled/userland.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/operations/transit.d.ts +0 -14
- package/components/identity.bans/operations/transit.js.map +0 -1
- package/components/identity.basic/operations/add.d.ts +0 -3
- package/components/identity.basic/operations/add.js.map +0 -1
- package/components/identity.basic/operations/authenticate.d.ts +0 -13
- package/components/identity.basic/operations/authenticate.js.map +0 -1
- package/components/identity.basic/operations/check.d.ts +0 -7
- package/components/identity.basic/operations/check.js.map +0 -1
- package/components/identity.basic/operations/delete.d.ts +0 -7
- package/components/identity.basic/operations/delete.js.map +0 -1
- package/components/identity.basic/operations/incept.d.ts +0 -12
- package/components/identity.basic/operations/incept.js.map +0 -1
- package/components/identity.basic/operations/info.d.ts +0 -10
- package/components/identity.basic/operations/info.js.map +0 -1
- package/components/identity.basic/operations/lib/credentials.d.ts +0 -5
- package/components/identity.basic/operations/lib/credentials.js.map +0 -1
- package/components/identity.basic/operations/transit.d.ts +0 -14
- package/components/identity.basic/operations/transit.js.map +0 -1
- package/components/identity.basic/operations/types.d.ts +0 -61
- package/components/identity.basic/operations/types.js +0 -2
- package/components/identity.basic/operations/types.js.map +0 -1
- package/components/identity.basic/source/types.ts +0 -69
- package/components/identity.credentials/operations/list.d.ts +0 -51
- package/components/identity.credentials/operations/list.js.map +0 -1
- package/components/identity.federation/operations/authenticate.d.ts +0 -16
- package/components/identity.federation/operations/authenticate.js.map +0 -1
- package/components/identity.federation/operations/create.d.ts +0 -8
- package/components/identity.federation/operations/create.js.map +0 -1
- package/components/identity.federation/operations/decode.d.ts +0 -3
- package/components/identity.federation/operations/decode.js.map +0 -1
- package/components/identity.federation/operations/delete.d.ts +0 -8
- package/components/identity.federation/operations/delete.js.map +0 -1
- package/components/identity.federation/operations/incept.d.ts +0 -11
- package/components/identity.federation/operations/incept.js.map +0 -1
- package/components/identity.federation/operations/lib/Configuration.d.ts +0 -39
- package/components/identity.federation/operations/lib/Configuration.js.map +0 -1
- package/components/identity.federation/operations/lib/Ctx.d.ts +0 -8
- package/components/identity.federation/operations/lib/Ctx.js.map +0 -1
- package/components/identity.federation/operations/lib/Payload.d.ts +0 -5
- package/components/identity.federation/operations/lib/Payload.js.map +0 -1
- package/components/identity.federation/operations/lib/decode.d.ts +0 -3
- package/components/identity.federation/operations/lib/decode.js.map +0 -1
- package/components/identity.federation/operations/lib/discovery.d.ts +0 -5
- package/components/identity.federation/operations/lib/discovery.js.map +0 -1
- package/components/identity.federation/operations/lib/errors.d.ts +0 -70
- package/components/identity.federation/operations/lib/errors.js.map +0 -1
- package/components/identity.federation/operations/lib/exchange.d.ts +0 -3
- package/components/identity.federation/operations/lib/exchange.js.map +0 -1
- package/components/identity.federation/operations/lib/index.d.ts +0 -4
- package/components/identity.federation/operations/lib/index.js.map +0 -1
- package/components/identity.federation/operations/lib/jose.d.ts +0 -1
- package/components/identity.federation/operations/lib/jose.js.map +0 -1
- package/components/identity.federation/operations/lib/resolve.d.ts +0 -3
- package/components/identity.federation/operations/lib/resolve.js.map +0 -1
- package/components/identity.federation/operations/list.d.ts +0 -7
- package/components/identity.federation/operations/list.js.map +0 -1
- package/components/identity.federation/operations/types/Scheme.d.ts +0 -1
- package/components/identity.federation/operations/types/Scheme.js.map +0 -1
- package/components/identity.federation/operations/types/configuration.d.ts +0 -22
- package/components/identity.federation/operations/types/configuration.js.map +0 -1
- package/components/identity.federation/operations/types/context.d.ts +0 -35
- package/components/identity.federation/operations/types/context.js.map +0 -1
- package/components/identity.federation/operations/types/entity.d.ts +0 -9
- package/components/identity.federation/operations/types/entity.js.map +0 -1
- package/components/identity.federation/operations/types/index.d.ts +0 -4
- package/components/identity.federation/operations/types/index.js.map +0 -1
- package/components/identity.keys/operations/create.d.ts +0 -22
- package/components/identity.keys/operations/create.js.map +0 -1
- package/components/identity.keys/operations/disable.d.ts +0 -5
- package/components/identity.keys/operations/disable.js.map +0 -1
- package/components/identity.keys/operations/revoke.d.ts +0 -15
- package/components/identity.keys/operations/revoke.js.map +0 -1
- package/components/identity.otp/operations/authenticate.d.ts +0 -12
- package/components/identity.otp/operations/authenticate.js.map +0 -1
- package/components/identity.otp/operations/issue.d.ts +0 -12
- package/components/identity.otp/operations/issue.js.map +0 -1
- package/components/identity.otp/operations/lib/Context.d.ts +0 -14
- package/components/identity.otp/operations/lib/Context.js.map +0 -1
- package/components/identity.otp/operations/lib/Entity.d.ts +0 -6
- package/components/identity.otp/operations/lib/Entity.js.map +0 -1
- package/components/identity.otp/operations/lib/index.d.ts +0 -1
- package/components/identity.otp/operations/lib/index.js.map +0 -1
- package/components/identity.passkeys/operations/authenticate.d.ts +0 -16
- package/components/identity.passkeys/operations/authenticate.js.map +0 -1
- package/components/identity.passkeys/operations/challenge.d.ts +0 -35
- package/components/identity.passkeys/operations/challenge.js.map +0 -1
- package/components/identity.passkeys/operations/create.d.ts +0 -19
- package/components/identity.passkeys/operations/create.js.map +0 -1
- package/components/identity.passkeys/operations/delete.d.ts +0 -8
- package/components/identity.passkeys/operations/delete.js.map +0 -1
- package/components/identity.passkeys/operations/lib/const.d.ts +0 -1
- package/components/identity.passkeys/operations/lib/const.js.map +0 -1
- package/components/identity.passkeys/operations/list.d.ts +0 -7
- package/components/identity.passkeys/operations/list.js.map +0 -1
- package/components/identity.passkeys/operations/types/Configuration.d.ts +0 -6
- package/components/identity.passkeys/operations/types/Configuration.js.map +0 -1
- package/components/identity.passkeys/operations/types/Context.d.ts +0 -15
- package/components/identity.passkeys/operations/types/Context.js.map +0 -1
- package/components/identity.passkeys/operations/types/Passkey.d.ts +0 -12
- package/components/identity.passkeys/operations/types/Passkey.js.map +0 -1
- package/components/identity.passkeys/operations/types/index.d.ts +0 -2
- package/components/identity.passkeys/operations/types/index.js.map +0 -1
- package/components/identity.passkeys/operations/use.d.ts +0 -16
- package/components/identity.passkeys/operations/use.js.map +0 -1
- package/components/identity.roles/operations/grant.d.ts +0 -10
- package/components/identity.roles/operations/grant.js.map +0 -1
- package/components/identity.roles/operations/lib/Entity.d.ts +0 -5
- package/components/identity.roles/operations/lib/Entity.js.map +0 -1
- package/components/identity.roles/operations/list.d.ts +0 -2
- package/components/identity.roles/operations/list.js.map +0 -1
- package/components/identity.roles/operations/principal.d.ts +0 -13
- package/components/identity.roles/operations/principal.js.map +0 -1
- package/components/identity.tokens/operations/authenticate.d.ts +0 -9
- package/components/identity.tokens/operations/authenticate.js.map +0 -1
- package/components/identity.tokens/operations/decrypt.d.ts +0 -15
- package/components/identity.tokens/operations/decrypt.js.map +0 -1
- package/components/identity.tokens/operations/encrypt.d.ts +0 -8
- package/components/identity.tokens/operations/encrypt.js.map +0 -1
- package/components/identity.tokens/operations/issue.d.ts +0 -24
- package/components/identity.tokens/operations/issue.js.map +0 -1
- package/components/identity.tokens/operations/lib/index.d.ts +0 -3
- package/components/identity.tokens/operations/lib/index.js.map +0 -1
- package/components/identity.tokens/operations/lib/jose.d.ts +0 -1
- package/components/identity.tokens/operations/lib/jose.js.map +0 -1
- package/components/identity.tokens/operations/lib/key.d.ts +0 -1
- package/components/identity.tokens/operations/lib/key.js.map +0 -1
- package/components/identity.tokens/operations/lib/pad.d.ts +0 -1
- package/components/identity.tokens/operations/lib/pad.js.map +0 -1
- package/components/identity.tokens/operations/lib/types.d.ts +0 -88
- package/components/identity.tokens/operations/lib/types.js +0 -2
- package/components/identity.tokens/operations/lib/types.js.map +0 -1
- package/components/identity.tokens/operations/revoke.d.ts +0 -2
- package/components/identity.tokens/operations/revoke.js.map +0 -1
- package/components/identity.tokens/source/lib/types.ts +0 -102
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
namespace: identity
|
|
2
|
+
name: grants
|
|
3
|
+
|
|
4
|
+
# What a user allowed a client to do on their behalf. The authorization code is not here:
|
|
5
|
+
# it is single-use and lives seconds, so it is held in the stash and redeemed atomically.
|
|
6
|
+
entity:
|
|
7
|
+
associated: true
|
|
8
|
+
schema:
|
|
9
|
+
type: object
|
|
10
|
+
properties:
|
|
11
|
+
authority:
|
|
12
|
+
type: string
|
|
13
|
+
identity:
|
|
14
|
+
type: string
|
|
15
|
+
client:
|
|
16
|
+
type: string
|
|
17
|
+
scope:
|
|
18
|
+
type: array
|
|
19
|
+
items:
|
|
20
|
+
type: string
|
|
21
|
+
resource:
|
|
22
|
+
type: array
|
|
23
|
+
items:
|
|
24
|
+
type: string
|
|
25
|
+
kid:
|
|
26
|
+
description: The identity.keys record backing the access token, revoked with the grant
|
|
27
|
+
type: string
|
|
28
|
+
revokedAt:
|
|
29
|
+
type: integer
|
|
30
|
+
required:
|
|
31
|
+
- authority
|
|
32
|
+
- identity
|
|
33
|
+
- client
|
|
34
|
+
index:
|
|
35
|
+
identity:
|
|
36
|
+
authority: asc
|
|
37
|
+
identity: asc
|
|
38
|
+
|
|
39
|
+
operations:
|
|
40
|
+
transit:
|
|
41
|
+
concurrency: retry
|
|
42
|
+
input:
|
|
43
|
+
type: object
|
|
44
|
+
properties:
|
|
45
|
+
authority:
|
|
46
|
+
type: string
|
|
47
|
+
identity:
|
|
48
|
+
type: string
|
|
49
|
+
client:
|
|
50
|
+
type: string
|
|
51
|
+
scope:
|
|
52
|
+
type: array
|
|
53
|
+
items:
|
|
54
|
+
type: string
|
|
55
|
+
resource:
|
|
56
|
+
type: array
|
|
57
|
+
items:
|
|
58
|
+
type: string
|
|
59
|
+
kid:
|
|
60
|
+
type: string
|
|
61
|
+
required:
|
|
62
|
+
- authority
|
|
63
|
+
- identity
|
|
64
|
+
- client
|
|
65
|
+
|
|
66
|
+
authorize:
|
|
67
|
+
query: false
|
|
68
|
+
input:
|
|
69
|
+
type: object
|
|
70
|
+
properties:
|
|
71
|
+
authority:
|
|
72
|
+
type: string
|
|
73
|
+
identity:
|
|
74
|
+
type: string
|
|
75
|
+
client:
|
|
76
|
+
type: string
|
|
77
|
+
maxLength: 2048
|
|
78
|
+
redirect:
|
|
79
|
+
type: string
|
|
80
|
+
maxLength: 2048
|
|
81
|
+
challenge:
|
|
82
|
+
description: PKCE code challenge, S256 of the verifier
|
|
83
|
+
type: string
|
|
84
|
+
minLength: 43
|
|
85
|
+
maxLength: 128
|
|
86
|
+
method:
|
|
87
|
+
type: string
|
|
88
|
+
scope:
|
|
89
|
+
type: array
|
|
90
|
+
items:
|
|
91
|
+
type: string
|
|
92
|
+
resource:
|
|
93
|
+
type: array
|
|
94
|
+
items:
|
|
95
|
+
type: string
|
|
96
|
+
maxLength: 2048
|
|
97
|
+
required:
|
|
98
|
+
- authority
|
|
99
|
+
- identity
|
|
100
|
+
- client
|
|
101
|
+
- redirect
|
|
102
|
+
- challenge
|
|
103
|
+
- method
|
|
104
|
+
output:
|
|
105
|
+
type: object
|
|
106
|
+
properties:
|
|
107
|
+
status:
|
|
108
|
+
description: Read and removed by `io:status`
|
|
109
|
+
type: number
|
|
110
|
+
code:
|
|
111
|
+
type: string
|
|
112
|
+
expires_in:
|
|
113
|
+
type: number
|
|
114
|
+
error:
|
|
115
|
+
type: string
|
|
116
|
+
error_description:
|
|
117
|
+
type: string
|
|
118
|
+
|
|
119
|
+
exchange:
|
|
120
|
+
query: false
|
|
121
|
+
input:
|
|
122
|
+
type: object
|
|
123
|
+
properties:
|
|
124
|
+
authority:
|
|
125
|
+
type: string
|
|
126
|
+
grant_type:
|
|
127
|
+
type: string
|
|
128
|
+
code:
|
|
129
|
+
type: string
|
|
130
|
+
maxLength: 512
|
|
131
|
+
code_verifier:
|
|
132
|
+
type: string
|
|
133
|
+
minLength: 43
|
|
134
|
+
maxLength: 128
|
|
135
|
+
redirect_uri:
|
|
136
|
+
type: string
|
|
137
|
+
maxLength: 2048
|
|
138
|
+
client_id:
|
|
139
|
+
type: string
|
|
140
|
+
maxLength: 2048
|
|
141
|
+
resource:
|
|
142
|
+
description: A form repeats a name to say a list, so either shape arrives
|
|
143
|
+
type: [string, array]
|
|
144
|
+
required:
|
|
145
|
+
- authority
|
|
146
|
+
- grant_type
|
|
147
|
+
output:
|
|
148
|
+
type: object
|
|
149
|
+
properties:
|
|
150
|
+
status:
|
|
151
|
+
type: number
|
|
152
|
+
access_token:
|
|
153
|
+
type: string
|
|
154
|
+
token_type:
|
|
155
|
+
type: string
|
|
156
|
+
expires_in:
|
|
157
|
+
type: number
|
|
158
|
+
scope:
|
|
159
|
+
type: string
|
|
160
|
+
error:
|
|
161
|
+
type: string
|
|
162
|
+
error_description:
|
|
163
|
+
type: string
|
|
164
|
+
|
|
165
|
+
list:
|
|
166
|
+
input:
|
|
167
|
+
type: object
|
|
168
|
+
properties:
|
|
169
|
+
authority:
|
|
170
|
+
type: string
|
|
171
|
+
identity:
|
|
172
|
+
type: string
|
|
173
|
+
required:
|
|
174
|
+
- authority
|
|
175
|
+
- identity
|
|
176
|
+
|
|
177
|
+
revoke:
|
|
178
|
+
output: { type: 'null' }
|
|
179
|
+
concurrency: retry
|
|
180
|
+
input:
|
|
181
|
+
type: object
|
|
182
|
+
properties:
|
|
183
|
+
authority:
|
|
184
|
+
type: string
|
|
185
|
+
identity:
|
|
186
|
+
type: string
|
|
187
|
+
required:
|
|
188
|
+
- authority
|
|
189
|
+
- identity
|
|
190
|
+
errors:
|
|
191
|
+
- NOT_FOUND
|
|
192
|
+
|
|
193
|
+
configuration:
|
|
194
|
+
schema:
|
|
195
|
+
type: object
|
|
196
|
+
properties:
|
|
197
|
+
lifetime:
|
|
198
|
+
description: Seconds an authorization code may be redeemed within
|
|
199
|
+
type: integer
|
|
200
|
+
minimum: 1
|
|
201
|
+
maximum: 600
|
|
202
|
+
default: 60
|
|
203
|
+
token:
|
|
204
|
+
description: Seconds an access token is valid for; 0 is until it is revoked
|
|
205
|
+
type: integer
|
|
206
|
+
minimum: 0
|
|
207
|
+
default: 2592000
|
|
208
|
+
# both have defaults, so the component reads them without checking
|
|
209
|
+
required: [lifetime, token]
|
|
210
|
+
|
|
211
|
+
stash: ~
|
|
212
|
+
|
|
213
|
+
exposition:
|
|
214
|
+
isolated: true
|
|
215
|
+
/:
|
|
216
|
+
POST:
|
|
217
|
+
anonymous: true
|
|
218
|
+
map:authority: authority
|
|
219
|
+
io:input: [grant_type, code, code_verifier, redirect_uri, client_id, resource]
|
|
220
|
+
io:output: true
|
|
221
|
+
io:status: status
|
|
222
|
+
io:throttle:
|
|
223
|
+
key: ip
|
|
224
|
+
requests: 60
|
|
225
|
+
interval: 60
|
|
226
|
+
cache:exact: no-store
|
|
227
|
+
endpoint: exchange
|
|
228
|
+
/:identity:
|
|
229
|
+
auth:id: identity
|
|
230
|
+
map:authority: authority
|
|
231
|
+
map:segments:
|
|
232
|
+
identity: identity
|
|
233
|
+
GET:
|
|
234
|
+
io:output: [id, client, scope, resource, _created]
|
|
235
|
+
endpoint: list
|
|
236
|
+
POST:
|
|
237
|
+
io:input: [client, redirect, challenge, method, scope, resource]
|
|
238
|
+
io:output: [code, expires_in, error, error_description]
|
|
239
|
+
io:status: status
|
|
240
|
+
cache:exact: no-store
|
|
241
|
+
endpoint: authorize
|
|
242
|
+
/:id:
|
|
243
|
+
DELETE:
|
|
244
|
+
io:output: false
|
|
245
|
+
endpoint: revoke
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { hold, identify } from './lib/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the consent page calls when a user allows a client. The page holds the user's own
|
|
4
|
+
* credentials, so this is the user's own route; the code it answers with is what the client
|
|
5
|
+
* redeems at the token endpoint.
|
|
6
|
+
*
|
|
7
|
+
* The grant is recorded so a user can see what they allowed and take it back. It is not
|
|
8
|
+
* consulted to skip the prompt — consent is asked every time, which is what keeps a client
|
|
9
|
+
* that changed where it wants a code sent from being waved through on an older one.
|
|
10
|
+
*/
|
|
11
|
+
export class Effect {
|
|
12
|
+
context;
|
|
13
|
+
mount(context) {
|
|
14
|
+
this.context = context;
|
|
15
|
+
}
|
|
16
|
+
async execute(input) {
|
|
17
|
+
const { authority, identity } = input;
|
|
18
|
+
if (input.method !== S256)
|
|
19
|
+
return invalid('invalid_request', 'Only the S256 code challenge method is supported');
|
|
20
|
+
const client = await this.context.remote.identity.clients.describe({
|
|
21
|
+
input: { authority, id: input.client, redirect: input.redirect }
|
|
22
|
+
});
|
|
23
|
+
if (client instanceof Error)
|
|
24
|
+
return invalid('invalid_client', 'No such client');
|
|
25
|
+
if (client.permitted !== true)
|
|
26
|
+
return invalid('invalid_request', 'The redirect is not one this client may receive a code at');
|
|
27
|
+
const scope = input.scope ?? [];
|
|
28
|
+
// recorded on the grant and carried to the token endpoint, and restricting nothing yet:
|
|
29
|
+
// a token carries the rights of the identity that consented, over every path it may
|
|
30
|
+
// reach. What binds it is a `permissions` argument in `exchange`, see documentation/oauth.md
|
|
31
|
+
const resource = input.resource ?? [];
|
|
32
|
+
const grant = await this.context.local.transit({
|
|
33
|
+
query: { id: identify(authority, identity, input.client) },
|
|
34
|
+
input: { authority, identity, client: input.client, scope, resource }
|
|
35
|
+
});
|
|
36
|
+
if (grant instanceof Error)
|
|
37
|
+
return grant;
|
|
38
|
+
const code = await hold(authority, {
|
|
39
|
+
identity,
|
|
40
|
+
client: input.client,
|
|
41
|
+
redirect: input.redirect,
|
|
42
|
+
challenge: input.challenge,
|
|
43
|
+
scope,
|
|
44
|
+
resource
|
|
45
|
+
}, this.context);
|
|
46
|
+
return { code, expires_in: this.context.configuration.lifetime };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function invalid(error, description) {
|
|
50
|
+
return { status: BAD_REQUEST, error, error_description: description };
|
|
51
|
+
}
|
|
52
|
+
const S256 = 'S256';
|
|
53
|
+
const BAD_REQUEST = 400;
|
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXplLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc291cmNlL2F1dGhvcml6ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFFLFFBQVEsRUFBRSxNQUFNLGdCQUFnQixDQUFBO0FBSy9DOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxPQUFPLE1BQU07SUFDVCxPQUFPLENBQVU7SUFFbEIsS0FBSyxDQUFFLE9BQWdCO1FBQzVCLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFBO0lBQ3hCLENBQUM7SUFFTSxLQUFLLENBQUMsT0FBTyxDQUFFLEtBQVk7UUFDaEMsTUFBTSxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsR0FBRyxLQUFLLENBQUE7UUFFckMsSUFBSSxLQUFLLENBQUMsTU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S0FBSyxFQUFFLFFBQVEsRUFBRTtTQUN0RSxDQUFDLENBQUE7UUFFRixJQUFJLEtBQUssWUFBWSxLQUFLO1lBQ3hCLE9BQU8sS0FBSyxDQUFBO1FBRWQsTUFBTSxJQUFJLEdBQUcsTUFBTSxJQUFJLENBQUMsU0FBUyxFQUFFO1lBQ2pDLFFBQVE7WUFDUixNQUFNLEVBQUUsS0FBSyxDQUFDLE1BQU07WUFDcEIsUUFBUSxFQUFFLEtBQUssQ0FBQyxRQUFRO1lBQ3hCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztZQUMxQixLQUFLO1lBQ0wsUUFBUTtTQUNULEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBRWhCLE9BQU8sRUFBRSxJQUFJLEVBQUUsVUFBVSxFQUFFLElBQUksQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLFFBQVEsRUFBRSxDQUFBO0lBQ2xFLENBQUM7Q0FDRjtBQUVELFNBQVMsT0FBTyxDQUFFLEtBQWEsRUFBRSxXQUFtQjtJQUNsRCxPQUFPLEVBQUUsTUFBTSxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsV0FBVyxFQUFFLENBQUE7QUFDdkUsQ0FBQztBQUVELE1BQU0sSUFBSSxHQUFHLE1BQU0sQ0FBQTtBQUNuQixNQUFNLFdBQVcsR0FBRyxHQUFHLENBQUEifQ==
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { identify, spend, verifies } from './lib/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The token endpoint, RFC 6749 §4.1.3. Anonymous, because the clients this server knows are
|
|
4
|
+
* public ones with no secret to authenticate with: what stands in for that is PKCE, since
|
|
5
|
+
* only the client that began the flow holds the verifier the challenge was made from.
|
|
6
|
+
*
|
|
7
|
+
* Every failure here is `invalid_grant` without saying which check failed. A code that was
|
|
8
|
+
* replayed, a verifier that does not match and a redirect that was swapped are all the same
|
|
9
|
+
* answer, and telling them apart would say whether a stolen code was still live.
|
|
10
|
+
*/
|
|
11
|
+
export class Effect {
|
|
12
|
+
context;
|
|
13
|
+
mount(context) {
|
|
14
|
+
this.context = context;
|
|
15
|
+
}
|
|
16
|
+
async execute(input) {
|
|
17
|
+
const { authority } = input;
|
|
18
|
+
if (input.grant_type !== AUTHORIZATION_CODE)
|
|
19
|
+
return invalid('unsupported_grant_type', 'Only the authorization code grant is supported');
|
|
20
|
+
if (input.code === undefined || input.code_verifier === undefined)
|
|
21
|
+
return invalid('invalid_request', 'A code and a code verifier are required');
|
|
22
|
+
// spent first: a wrong verifier burns the code, which is what stops it being guessed at
|
|
23
|
+
const code = await spend(authority, input.code, this.context);
|
|
24
|
+
if (code === null || !this.redeemable(code, input))
|
|
25
|
+
return invalid('invalid_grant', 'The authorization code is not redeemable');
|
|
26
|
+
// `permissions` would bind the token to `code.resource` — `{'/mcp/**': ['*']}` for a
|
|
27
|
+
// resource at `/mcp/`, which `permits()` reads on every request. Left unset: the token
|
|
28
|
+
// carries the rights of the identity that consented, see documentation/oauth.md#audience
|
|
29
|
+
const issued = await this.context.remote.identity.tokens.issue({
|
|
30
|
+
input: {
|
|
31
|
+
authority,
|
|
32
|
+
identity: code.identity,
|
|
33
|
+
label: label(code.client),
|
|
34
|
+
lifetime: this.context.configuration.token,
|
|
35
|
+
...(code.scope.length === 0 ? {} : { scopes: code.scope })
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// the only refusal `issue` makes is a scope the consenting identity does not hold, and
|
|
39
|
+
// what it says about that is its own; the client is told what it may act on
|
|
40
|
+
if (issued instanceof Error)
|
|
41
|
+
return invalid('invalid_scope', 'The requested scope is not one the identity holds');
|
|
42
|
+
// the key the token was issued under, so revoking the grant revokes the token. The token
|
|
43
|
+
// is already out, so a grant that fails to record it is logged rather than unwound — it
|
|
44
|
+
// costs the user the ability to revoke, and refusing here would cost them the token too
|
|
45
|
+
const grant = await this.context.local.transit({
|
|
46
|
+
query: { id: identify(authority, code.identity, code.client) },
|
|
47
|
+
input: {
|
|
48
|
+
authority,
|
|
49
|
+
identity: code.identity,
|
|
50
|
+
client: code.client,
|
|
51
|
+
scope: code.scope,
|
|
52
|
+
resource: code.resource,
|
|
53
|
+
kid: issued.kid
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (grant instanceof Error)
|
|
57
|
+
this.context.logs.error('Grant not recorded for an issued token', { client: code.client, kid: issued.kid });
|
|
58
|
+
return {
|
|
59
|
+
// RFC 6749 §5.1 asks for 200, where a POST would otherwise answer 201
|
|
60
|
+
status: OK,
|
|
61
|
+
access_token: issued.token,
|
|
62
|
+
token_type: 'Bearer',
|
|
63
|
+
...(issued.exp === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: { expires_in: Math.floor((issued.exp - Date.now()) / 1000) }),
|
|
66
|
+
...(code.scope.length === 0 ? {} : { scope: code.scope.join(' ') })
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
redeemable(code, input) {
|
|
70
|
+
if (!verifies(code.challenge, input.code_verifier))
|
|
71
|
+
return false;
|
|
72
|
+
// RFC 6749 §4.1.3: what was sent to `authorize` must be sent again
|
|
73
|
+
if (input.redirect_uri !== undefined && input.redirect_uri !== code.redirect)
|
|
74
|
+
return false;
|
|
75
|
+
return input.client_id === undefined || input.client_id === code.client;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** `identity.tokens` requires one, and it is what a user sees when listing what they issued. */
|
|
79
|
+
function label(client) {
|
|
80
|
+
return client.slice(0, LABEL);
|
|
81
|
+
}
|
|
82
|
+
function invalid(error, description) {
|
|
83
|
+
return { status: BAD_REQUEST, error, error_description: description };
|
|
84
|
+
}
|
|
85
|
+
const AUTHORIZATION_CODE = 'authorization_code';
|
|
86
|
+
const OK = 200;
|
|
87
|
+
const BAD_REQUEST = 400;
|
|
88
|
+
const LABEL = 64;
|
|
89
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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lBQ0gsQ0FBQztJQUVPLFVBQVUsQ0FBRSxJQUFVLEVBQUUsS0FBWTtRQUMxQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLGFBQWMsQ0FBQztZQUNqRCxPQUFPLEtBQUssQ0FBQTtRQUVkLG1FQUFtRTtRQUNuRSxJQUFJLEtBQUssQ0FBQyxZQUFZLEtBQUssU0FBUyxJQUFJLEtBQUssQ0FBQyxZQUFZLEtBQUssSUFBSSxDQUFDLFFBQVE7WUFDMUUsT0FBTyxLQUFLLENBQUE7UUFFZCxPQUFPLEtBQUssQ0FBQyxTQUFTLEtBQUssU0FBUyxJQUFJLEtBQUssQ0FBQyxTQUFTLEtBQUssSUFBSSxDQUFDLE1BQU0sQ0FBQTtJQUN6RSxDQUFDO0NBQ0Y7QUFFRCxnR0FBZ0c7QUFDaEcsU0FBUyxLQUFLLENBQUUsTUFBYztJQUM1QixPQUFPLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFLEtBQUssQ0FBQyxDQUFBO0FBQy9CLENBQUM7QUFFRCxTQUFTLE9BQU8sQ0FBRSxLQUFhLEVBQUUsV0FBbUI7SUFDbEQsT0FBTyxFQUFFLE1BQU0sRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLGlCQUFpQixFQUFFLFdBQVcsRUFBRSxDQUFBO0FBQ3ZFLENBQUM7QUFFRCxNQUFNLGtCQUFrQixHQUFHLG9CQUFvQixDQUFBO0FBQy9DLE1BQU0sRUFBRSxHQUFHLEdBQUcsQ0FBQTtBQUNkLE1BQU0sV0FBVyxHQUFHLEdBQUcsQ0FBQTtBQUN2QixNQUFNLEtBQUssR0FBRyxFQUFFLENBQUEifQ==
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* An authorization code is a bearer credential that lives for seconds. It is held under a
|
|
4
|
+
* hash of itself, so a dump of the store hands out none of them, and redeemed with `GETDEL`,
|
|
5
|
+
* so it is spent once however many requests arrive at once — the property the whole flow
|
|
6
|
+
* rests on, since a replayed code is a stolen grant.
|
|
7
|
+
*/
|
|
8
|
+
export async function hold(authority, code, context) {
|
|
9
|
+
const value = randomBytes(32).toString('base64url');
|
|
10
|
+
await context.stash.set(key(authority, value), JSON.stringify(code), 'EX', context.configuration.lifetime);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
export async function spend(authority, value, context) {
|
|
14
|
+
const held = await context.stash.getdel(key(authority, value));
|
|
15
|
+
return held === null ? null : JSON.parse(held);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* PKCE, RFC 7636: the client kept a verifier and sent its hash, and only the client that
|
|
19
|
+
* began the flow can present the verifier now. `S256` alone — `plain` proves nothing.
|
|
20
|
+
*/
|
|
21
|
+
export function verifies(challenge, verifier) {
|
|
22
|
+
return digest(verifier) === challenge;
|
|
23
|
+
}
|
|
24
|
+
export function digest(verifier) {
|
|
25
|
+
return createHash('sha256').update(verifier).digest('base64url');
|
|
26
|
+
}
|
|
27
|
+
function key(authority, value) {
|
|
28
|
+
return `oauth:code:${authority}:${createHash('sha256').update(value).digest('hex')}`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NvdXJjZS9saWIvY29kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLFdBQVcsRUFBRSxNQUFNLGFBQWEsQ0FBQTtBQUdyRDs7Ozs7R0FLRztBQUNILE1BQU0sQ0FBQyxLQUFLLFVBQVUsSUFBSSxDQUFFLFNBQWlCLEVBQUUsSUFBVSxFQUFFLE9BQWdCO0lBQ3pFLE1BQU0sS0FBSyxHQUFH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BYTtJQUM1QyxPQUFPLGNBQWMsU0FBUyxJQUFJLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUE7QUFDdEYsQ0FBQyJ9
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* A user holds one grant per client, so the record is addressed by the three things that
|
|
4
|
+
* say which: authorizing again replaces what is there rather than leaving another row, and
|
|
5
|
+
* revoking has one thing to revoke.
|
|
6
|
+
*/
|
|
7
|
+
export function identify(authority, identity, client) {
|
|
8
|
+
return createHash('sha256')
|
|
9
|
+
.update(JSON.stringify([authority, identity, client]))
|
|
10
|
+
.digest('hex')
|
|
11
|
+
.slice(0, LENGTH);
|
|
12
|
+
}
|
|
13
|
+
/** What the entity prototype accepts as an id. */
|
|
14
|
+
const LENGTH = 32;
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWRlbnRpZnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvbGliL2lkZW50aWZ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxhQUFhLENBQUE7QUFFeEM7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxRQUFRLENBQUUsU0FBaUIsRUFBRSxRQUFnQixFQUFFLE1BQWM7SUFDM0UsT0FBTyxVQUFVLENBQUMsUUFBUSxDQUFDO1NBQ3hCLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsU0FBUyxFQUFFLFFBQVEsRUFBRSxNQUFNLENBQUMsQ0FBQyxDQUFDO1NBQ3JELE1BQU0sQ0FBQyxLQUFLLENBQUM7U0FDYixLQUFLLENBQUMsQ0FBQyxFQUFFLE1BQU0sQ0FBQyxDQUFBO0FBQ3JCLENBQUM7QUFFRCxrREFBa0Q7QUFDbEQsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFBIn0=
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './code.js';
|
|
2
|
+
export * from './identify.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvbGliL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsV0FBVyxDQUFBO0FBQ3pCLGNBQWMsZUFBZSxDQUFBIn0=
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { quote } from '@toa.io/generic';
|
|
2
|
+
/** What a user has allowed, for a screen that lets them take it back. */
|
|
3
|
+
export class Computation {
|
|
4
|
+
enumerate;
|
|
5
|
+
mount(context) {
|
|
6
|
+
this.enumerate = context.local.enumerate;
|
|
7
|
+
}
|
|
8
|
+
async execute(input) {
|
|
9
|
+
return await this.enumerate({
|
|
10
|
+
query: {
|
|
11
|
+
criteria: `authority==${quote(input.authority)};identity==${quote(input.identity)}`,
|
|
12
|
+
limit: LIMIT
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const LIMIT = 256;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NvdXJjZS9saXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUl2Qyx5RUFBeUU7QUFDekUsTUFBTSxPQUFPLFdBQVc7SUFDZCxTQUFTLENBQWdDO0lBRTFDLEtBQUssQ0FBRSxPQUFnQjtRQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFBO0lBQzFDLENBQUM7SUFFTSxLQUFLLENBQUMsT0FBTyxDQUFFLEtBQVk7UUFDaEMsT0FBTyxNQUFNLElBQUksQ0FBQyxTQUFTLENBQUM7WUFDMUIsS0FBSyxFQUFFO2dCQUNMLFFBQVEsRUFBRSxjQUFjLEtBQUssQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLGNBQWMsS0FBSyxDQUFDLEtBQUssQ0FBQyxRQUFRLENBQUMsRUFBRTtnQkFDbkYsS0FBSyxFQUFFLEtBQUs7YUFDYjtTQUNGLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDRjtBQUVELE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQSJ9
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taking back what was allowed. The token itself is not deleted — it is out in the world —
|
|
3
|
+
* so what is revoked is the key it was issued under, which is what `identity.tokens` reads
|
|
4
|
+
* it with. It stops being a token within `identity.tokens.cache.ttl`.
|
|
5
|
+
*/
|
|
6
|
+
export class Transition {
|
|
7
|
+
keys;
|
|
8
|
+
mount(context) {
|
|
9
|
+
this.keys = context.remote.identity.keys;
|
|
10
|
+
}
|
|
11
|
+
async execute(input, object) {
|
|
12
|
+
// the id is a route parameter, so a grant of another identity is asked for by anyone
|
|
13
|
+
// who guesses one; the authority and the identity are what say it is theirs
|
|
14
|
+
if (object._version === 0 || object.authority !== input.authority ||
|
|
15
|
+
object.identity !== input.identity)
|
|
16
|
+
return ERR_NOT_FOUND;
|
|
17
|
+
if (object.kid !== undefined)
|
|
18
|
+
await this.keys.disable({ query: { id: object.kid } });
|
|
19
|
+
object.revokedAt = Date.now();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const ERR_NOT_FOUND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JLEdBQUcsV0FBVyxDQUFBO0NBQ25DLENBQUMsRUFBRSxDQUFBIn0=
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { hold, identify } from './lib/index.js'
|
|
2
|
+
import type { Maybe } from '@toa.io/core'
|
|
3
|
+
import type { Operation } from '@toa.io/bridges.node'
|
|
4
|
+
import type { Context } from './lib/index.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What the consent page calls when a user allows a client. The page holds the user's own
|
|
8
|
+
* credentials, so this is the user's own route; the code it answers with is what the client
|
|
9
|
+
* redeems at the token endpoint.
|
|
10
|
+
*
|
|
11
|
+
* The grant is recorded so a user can see what they allowed and take it back. It is not
|
|
12
|
+
* consulted to skip the prompt — consent is asked every time, which is what keeps a client
|
|
13
|
+
* that changed where it wants a code sent from being waved through on an older one.
|
|
14
|
+
*/
|
|
15
|
+
export class Effect implements Operation {
|
|
16
|
+
private context!: Context
|
|
17
|
+
|
|
18
|
+
public mount (context: Context): void {
|
|
19
|
+
this.context = context
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public async execute (input: Input): Promise<Maybe<Output>> {
|
|
23
|
+
const { authority, identity } = input
|
|
24
|
+
|
|
25
|
+
if (input.method !== S256)
|
|
26
|
+
return invalid('invalid_request', 'Only the S256 code challenge method is supported')
|
|
27
|
+
|
|
28
|
+
const client = await this.context.remote.identity.clients.describe({
|
|
29
|
+
input: { authority, id: input.client, redirect: input.redirect }
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
if (client instanceof Error)
|
|
33
|
+
return invalid('invalid_client', 'No such client')
|
|
34
|
+
|
|
35
|
+
if (client.permitted !== true)
|
|
36
|
+
return invalid('invalid_request', 'The redirect is not one this client may receive a code at')
|
|
37
|
+
|
|
38
|
+
const scope = input.scope ?? []
|
|
39
|
+
|
|
40
|
+
// recorded on the grant and carried to the token endpoint, and restricting nothing yet:
|
|
41
|
+
// a token carries the rights of the identity that consented, over every path it may
|
|
42
|
+
// reach. What binds it is a `permissions` argument in `exchange`, see documentation/oauth.md
|
|
43
|
+
const resource = input.resource ?? []
|
|
44
|
+
|
|
45
|
+
const grant = await this.context.local.transit({
|
|
46
|
+
query: { id: identify(authority, identity, input.client) },
|
|
47
|
+
input: { authority, identity, client: input.client, scope, resource }
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
if (grant instanceof Error)
|
|
51
|
+
return grant
|
|
52
|
+
|
|
53
|
+
const code = await hold(authority, {
|
|
54
|
+
identity,
|
|
55
|
+
client: input.client,
|
|
56
|
+
redirect: input.redirect,
|
|
57
|
+
challenge: input.challenge,
|
|
58
|
+
scope,
|
|
59
|
+
resource
|
|
60
|
+
}, this.context)
|
|
61
|
+
|
|
62
|
+
return { code, expires_in: this.context.configuration.lifetime }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function invalid (error: string, description: string): Output {
|
|
67
|
+
return { status: BAD_REQUEST, error, error_description: description }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const S256 = 'S256'
|
|
71
|
+
const BAD_REQUEST = 400
|
|
72
|
+
|
|
73
|
+
interface Input {
|
|
74
|
+
authority: string
|
|
75
|
+
identity: string
|
|
76
|
+
client: string
|
|
77
|
+
redirect: string
|
|
78
|
+
challenge: string
|
|
79
|
+
method: string
|
|
80
|
+
scope?: string[]
|
|
81
|
+
resource?: string[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface Output {
|
|
85
|
+
status?: number
|
|
86
|
+
code?: string
|
|
87
|
+
expires_in?: number
|
|
88
|
+
error?: string
|
|
89
|
+
error_description?: string
|
|
90
|
+
}
|