@venizia/ignis 0.4.8-9 → 0.5.0-0
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/dist/esm/base/applications/base.js +5 -2
- package/dist/esm/base/applications/base.js.map +1 -1
- package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js +1 -1
- package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
- package/dist/esm/components/api-reference/common/keys.d.ts +2 -1
- package/dist/esm/components/api-reference/common/keys.js +4 -1
- package/dist/esm/components/api-reference/common/keys.js.map +1 -1
- package/dist/esm/components/api-reference/common/types.d.ts +7 -4
- package/dist/esm/components/api-reference/common/types.js.map +1 -1
- package/dist/esm/components/api-reference/component.js +8 -3
- package/dist/esm/components/api-reference/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/component.js +13 -18
- package/dist/esm/components/auth/authenticate/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/jwks/definitions.d.ts +2 -2
- package/dist/esm/components/auth/authenticate/controllers/service-certs/controller.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/service-certs/definitions.d.ts +2 -2
- package/dist/esm/components/auth/authenticate/services/basic/service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/basic/service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +5 -3
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +19 -2
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +2 -2
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.d.ts +10 -22
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js +16 -112
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/service/signer.service.d.ts +11 -0
- package/dist/esm/components/auth/authenticate/services/service/signer.service.js +18 -0
- package/dist/esm/components/auth/authenticate/services/service/signer.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/service/verifier.service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/service/verifier.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/basic.strategy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/service.strategy.js.map +1 -1
- package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +1 -2
- package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
- package/dist/esm/components/auth/authorize/component.js.map +1 -1
- package/dist/esm/components/controller/grpc/common/types.d.ts +1 -1
- package/dist/esm/components/controller/grpc/common/types.js +4 -1
- package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
- package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
- package/dist/esm/components/health-check/common/keys.d.ts +4 -2
- package/dist/esm/components/health-check/common/keys.js +7 -2
- package/dist/esm/components/health-check/common/keys.js.map +1 -1
- package/dist/esm/components/health-check/common/types.d.ts +1 -1
- package/dist/esm/components/health-check/common/types.js.map +1 -1
- package/dist/esm/components/health-check/component.js +1 -3
- package/dist/esm/components/health-check/component.js.map +1 -1
- package/dist/esm/components/mail/common/constants.d.ts +32 -14
- package/dist/esm/components/mail/common/constants.js +25 -32
- package/dist/esm/components/mail/common/constants.js.map +1 -1
- package/dist/esm/components/mail/common/errors.d.ts +19 -1
- package/dist/esm/components/mail/common/errors.js +13 -1
- package/dist/esm/components/mail/common/errors.js.map +1 -1
- package/dist/esm/components/mail/common/keys.d.ts +14 -11
- package/dist/esm/components/mail/common/keys.js +34 -11
- package/dist/esm/components/mail/common/keys.js.map +1 -1
- package/dist/esm/components/mail/common/types/message.d.ts +7 -4
- package/dist/esm/components/mail/common/types/message.js.map +1 -1
- package/dist/esm/components/mail/common/types/options.d.ts +54 -10
- package/dist/esm/components/mail/common/types/options.js.map +1 -1
- package/dist/esm/components/mail/common/types/queue.d.ts +25 -12
- package/dist/esm/components/mail/common/types/queue.js.map +1 -1
- package/dist/esm/components/mail/common/types/template.d.ts +8 -4
- package/dist/esm/components/mail/common/types/template.js.map +1 -1
- package/dist/esm/components/mail/common/types/verification.d.ts +1 -0
- package/dist/esm/components/mail/common/types/verification.js.map +1 -1
- package/dist/esm/components/mail/component.js +11 -2
- package/dist/esm/components/mail/component.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +3 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +27 -33
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +2 -0
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +17 -10
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +11 -6
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +2 -3
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +15 -6
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +2 -3
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +2 -2
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -2
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +7 -9
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-transporter.provider.js +7 -7
- package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
- package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -6
- package/dist/esm/components/mail/services/generators/numeric-code.js +3 -31
- package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
- package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -1
- package/dist/esm/components/mail/services/generators/random-token.js +9 -6
- package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
- package/dist/esm/components/mail/services/mail.service.d.ts +1 -2
- package/dist/esm/components/mail/services/mail.service.js +22 -19
- package/dist/esm/components/mail/services/mail.service.js.map +1 -1
- package/dist/esm/components/mail/services/template.service.d.ts +8 -6
- package/dist/esm/components/mail/services/template.service.js +34 -33
- package/dist/esm/components/mail/services/template.service.js.map +1 -1
- package/dist/esm/components/mail/utilities/attachment.utility.js +8 -6
- package/dist/esm/components/mail/utilities/attachment.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/header.utility.d.ts +14 -0
- package/dist/esm/components/mail/utilities/header.utility.js +44 -0
- package/dist/esm/components/mail/utilities/header.utility.js.map +1 -0
- package/dist/esm/components/mail/utilities/index.d.ts +2 -0
- package/dist/esm/components/mail/utilities/index.js +2 -0
- package/dist/esm/components/mail/utilities/index.js.map +1 -1
- package/dist/esm/components/mail/utilities/mime.utility.d.ts +5 -1
- package/dist/esm/components/mail/utilities/mime.utility.js +12 -58
- package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/template-renderer.utility.d.ts +31 -0
- package/dist/esm/components/mail/utilities/template-renderer.utility.js +184 -0
- package/dist/esm/components/mail/utilities/template-renderer.utility.js.map +1 -0
- package/dist/esm/components/mail/utilities/type.utility.d.ts +2 -3
- package/dist/esm/components/mail/utilities/type.utility.js +6 -7
- package/dist/esm/components/mail/utilities/type.utility.js.map +1 -1
- package/dist/esm/components/request-tracker/component.d.ts +2 -1
- package/dist/esm/components/request-tracker/component.js +5 -5
- package/dist/esm/components/request-tracker/component.js.map +1 -1
- package/dist/esm/components/server-info/common/keys.d.ts +2 -1
- package/dist/esm/components/server-info/common/keys.js +4 -1
- package/dist/esm/components/server-info/common/keys.js.map +1 -1
- package/dist/esm/components/server-info/common/types.d.ts +1 -1
- package/dist/esm/components/server-info/common/types.js.map +1 -1
- package/dist/esm/components/server-info/component.js +1 -3
- package/dist/esm/components/server-info/component.js.map +1 -1
- package/dist/esm/components/socket-io/common/keys.d.ts +9 -6
- package/dist/esm/components/socket-io/common/keys.js +19 -6
- package/dist/esm/components/socket-io/common/keys.js.map +1 -1
- package/dist/esm/components/socket-io/component.js +1 -1
- package/dist/esm/components/socket-io/component.js.map +1 -1
- package/dist/esm/components/socket-io/handlers/bun.handler.d.ts +13 -3
- package/dist/esm/components/socket-io/handlers/bun.handler.js.map +1 -1
- package/dist/esm/components/static-asset/common/constants.d.ts +51 -24
- package/dist/esm/components/static-asset/common/constants.js +75 -47
- package/dist/esm/components/static-asset/common/constants.js.map +1 -1
- package/dist/esm/components/static-asset/common/errors.d.ts +30 -35
- package/dist/esm/components/static-asset/common/errors.js +31 -33
- package/dist/esm/components/static-asset/common/errors.js.map +1 -1
- package/dist/esm/components/static-asset/common/index.d.ts +1 -1
- package/dist/esm/components/static-asset/common/index.js +1 -1
- package/dist/esm/components/static-asset/common/index.js.map +1 -1
- package/dist/esm/components/static-asset/common/keys.d.ts +14 -2
- package/dist/esm/components/static-asset/common/keys.js +17 -2
- package/dist/esm/components/static-asset/common/keys.js.map +1 -1
- package/dist/esm/components/static-asset/common/types.d.ts +267 -147
- package/dist/esm/components/static-asset/common/types.js.map +1 -1
- package/dist/esm/components/static-asset/common/validation.d.ts +10 -0
- package/dist/esm/components/static-asset/common/validation.js +8 -0
- package/dist/esm/components/static-asset/common/validation.js.map +1 -0
- package/dist/esm/components/static-asset/component.d.ts +4 -2
- package/dist/esm/components/static-asset/component.js +27 -31
- package/dist/esm/components/static-asset/component.js.map +1 -1
- package/dist/esm/components/static-asset/controller/factory.d.ts +37 -79
- package/dist/esm/components/static-asset/controller/factory.js +26 -917
- package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
- package/dist/esm/components/static-asset/controller/index.d.ts +1 -0
- package/dist/esm/components/static-asset/controller/index.js +1 -0
- package/dist/esm/components/static-asset/controller/index.js.map +1 -1
- package/dist/esm/components/static-asset/controller/routes/context.d.ts +62 -0
- package/dist/esm/components/static-asset/controller/routes/context.js +45 -0
- package/dist/esm/components/static-asset/controller/routes/context.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/definition.d.ts +40 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js +83 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.d.ts +3 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js +153 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/labels.d.ts +16 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js +19 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/objects.d.ts +7 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js +193 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/serve.d.ts +29 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js +152 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/table.d.ts +12 -0
- package/dist/esm/components/static-asset/controller/routes/table.js +52 -0
- package/dist/esm/components/static-asset/controller/routes/table.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/upload.d.ts +10 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js +175 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js.map +1 -0
- package/dist/esm/components/static-asset/index.d.ts +2 -1
- package/dist/esm/components/static-asset/index.js +2 -1
- package/dist/esm/components/static-asset/index.js.map +1 -1
- package/dist/esm/components/static-asset/models/base.model.d.ts +4 -4
- package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
- package/dist/esm/components/static-asset/services/commitment.service.d.ts +103 -0
- package/dist/esm/components/static-asset/services/commitment.service.js +252 -0
- package/dist/esm/components/static-asset/services/commitment.service.js.map +1 -0
- package/dist/esm/components/static-asset/services/index.d.ts +3 -0
- package/dist/esm/components/static-asset/services/index.js +3 -0
- package/dist/esm/components/static-asset/services/index.js.map +1 -0
- package/dist/esm/components/static-asset/services/policy.service.d.ts +45 -0
- package/dist/esm/components/static-asset/services/policy.service.js +104 -0
- package/dist/esm/components/static-asset/services/policy.service.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.d.ts +28 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js +112 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.d.ts +69 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js +160 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/index.d.ts +6 -0
- package/dist/esm/components/static-asset/utilities/index.js +6 -0
- package/dist/esm/components/static-asset/utilities/index.js.map +1 -0
- package/dist/esm/components/static-asset/{ingest.d.ts → utilities/ingest.utility.d.ts} +8 -8
- package/dist/esm/components/static-asset/{ingest.js → utilities/ingest.utility.js} +21 -23
- package/dist/esm/components/static-asset/utilities/ingest.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/key-scope.d.ts → utilities/key-scope.utility.d.ts} +21 -2
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js +74 -0
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/meta-link.d.ts → utilities/meta-link.utility.d.ts} +9 -9
- package/dist/esm/components/static-asset/{controller/meta-link.js → utilities/meta-link.utility.js} +10 -10
- package/dist/esm/components/static-asset/utilities/meta-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.d.ts +16 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js +20 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.d.ts +39 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js +53 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.d.ts +43 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js +71 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.d.ts +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js.map +1 -0
- package/dist/esm/components/websocket/common/keys.d.ts +12 -10
- package/dist/esm/components/websocket/common/keys.js +31 -10
- package/dist/esm/components/websocket/common/keys.js.map +1 -1
- package/dist/esm/components/websocket/component.js.map +1 -1
- package/dist/esm/testing/assert-application-boots.d.ts +2 -2
- package/dist/esm/testing/assert-application-boots.js +6 -2
- package/dist/esm/testing/assert-application-boots.js.map +1 -1
- package/dist/presets/app/preset.json +4 -4
- package/dist/presets/lib/preset.json +3 -3
- package/dist/presets/shared/preset.json +1 -1
- package/package.json +8 -8
- package/dist/esm/components/static-asset/common/commit-token.d.ts +0 -28
- package/dist/esm/components/static-asset/common/commit-token.js +0 -48
- package/dist/esm/components/static-asset/common/commit-token.js.map +0 -1
- package/dist/esm/components/static-asset/controller/base.definition.d.ts +0 -30
- package/dist/esm/components/static-asset/controller/base.definition.js +0 -307
- package/dist/esm/components/static-asset/controller/base.definition.js.map +0 -1
- package/dist/esm/components/static-asset/controller/key-scope.js +0 -41
- package/dist/esm/components/static-asset/controller/key-scope.js.map +0 -1
- package/dist/esm/components/static-asset/controller/meta-link.js.map +0 -1
- package/dist/esm/components/static-asset/controller/route-options.d.ts +0 -29
- package/dist/esm/components/static-asset/controller/route-options.js +0 -47
- package/dist/esm/components/static-asset/controller/route-options.js.map +0 -1
- package/dist/esm/components/static-asset/ingest.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.service.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/services/service/verifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD;;;;;;;;GAQG;AACH,IAAa,+BAA+B,uCAA5C,M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M,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;QAEjD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC;aACnC,IAAI,CAAC,oDAAoD,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE9E,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF,CAAA;AAzLY,+BAA+B;IAQvC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,uBAAuB,CAAC,eAAe,EAAE,CAAC,CAAA;;GARhD,+BAA+B,CAyL3C","sourcesContent":["import { inject } from '@/base/metadata';\nimport {\n AuthenticateBindingKeys,\n AuthenticationErrors,\n BaseService,\n ServiceAssertion,\n} from '@venizia/ignis-kernel';\nimport type { IServiceAssertionClaims, IServiceAuthOptions } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { createRemoteJWKSet } from 'jose';\nimport { JoseLoader } from '../jose-loader';\nimport { JWKSUrlPolicy } from '../jwks-url-policy';\n\ntype TRemoteKeySet = ReturnType<typeof createRemoteJWKSet>;\n\n/**\n * Verifies an incoming service assertion against the CALLER's own JWKS.\n *\n * What the assertion covers, and nothing else: the HTTP method and the percent-encoded path. It does\n * NOT cover the query string, any header, or the body. Tenant selectors in particular are usually a\n * header or a query parameter, so an assertion alone does not authenticate which tenant a call acts\n * on - the caller allowlist and the application's own scoping have to do that. Stated because the\n * gap is invisible from the call site.\n */\nexport class ServiceAssertionVerifierService extends BaseService {\n /** One remote key set per caller, kept because `createRemoteJWKSet` owns its own cache. */\n private readonly keySets = new Map<string, TRemoteKeySet>();\n\n /** Per-caller accepted age, resolved once alongside its key set. */\n private readonly acceptMaxAges = new Map<string, number>();\n\n constructor(\n @inject({ key: AuthenticateBindingKeys.SERVICE_OPTIONS })\n private readonly options: IServiceAuthOptions,\n ) {\n super({ scope: ServiceAssertionVerifierService.name });\n }\n\n /**\n * @param path The percent-ENCODED pathname, from `new URL(context.req.url).pathname`. Never\n * `context.req.path` - Hono decodes that one, and the caller signed the encoded form.\n */\n async verify(opts: { token: string; method: string; path: string }): Promise<{ issuer: string }> {\n const { token, method, path } = opts;\n\n const jose = await JoseLoader.load();\n const issuer = this.readIssuer({ token, jose });\n const keySet = this.resolveKeySet({ issuer, jose });\n const payload = await this.runVerify({ token, issuer, keySet, jose });\n\n this.assertRequestBinding({ payload, method, path });\n\n return { issuer };\n }\n\n /**\n * Reads `iss` WITHOUT verifying, only to choose which key set checks the signature. The same value\n * is then enforced as the expected issuer, so a forged `iss` buys nothing beyond selecting the key\n * set that will reject it.\n */\n private readIssuer(opts: { token: string; jose: typeof import('jose') }): string {\n let issuer: unknown;\n\n try {\n ({ iss: issuer } = opts.jose.decodeJwt(opts.token));\n } catch (error) {\n this.logger.for(this.readIssuer.name).warn('Undecodable assertion | error: %s', error);\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID });\n }\n\n // Typed, not merely present: a numeric `iss` would index the caller map by coercion.\n if (typeof issuer !== 'string' || issuer.length === 0) {\n this.logger\n .for(this.readIssuer.name)\n .warn('Undecodable assertion | iss is missing or not a string');\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID });\n }\n\n return issuer;\n }\n\n private resolveKeySet(opts: { issuer: string; jose: typeof import('jose') }): TRemoteKeySet {\n const { issuer, jose } = opts;\n\n const cached = this.keySets.get(issuer);\n\n if (cached) {\n return cached;\n }\n\n const callers = this.options.callers ?? {};\n\n // `Object.hasOwn`, never a truthiness check on the index: the map arrives as a plain object, so\n // `iss: 'constructor'` would otherwise return `Function` - truthy - walk past this guard, and\n // reach `new URL(<function>)` as an uncaught TypeError.\n if (!Object.hasOwn(callers, issuer)) {\n this.logger\n .for(this.resolveKeySet.name)\n .warn('Caller not on the allowlist | iss: %s', issuer);\n throw getError({ error: AuthenticationErrors.CALLER_NOT_ALLOWED });\n }\n\n const entry = callers[issuer];\n const jwksUrl = typeof entry === 'string' ? entry : entry.jwksUrl;\n\n this.acceptMaxAges.set(\n issuer,\n ServiceAssertion.resolveAcceptMaxAge({\n callerOverride: typeof entry === 'string' ? undefined : entry.acceptMaxAgeSeconds,\n serviceDefault: this.options.acceptMaxAgeSeconds,\n }),\n );\n\n const keySet = jose.createRemoteJWKSet(\n JWKSUrlPolicy.assertUrl({\n scope: ServiceAssertionVerifierService.name,\n label: 'the caller jwksUrl',\n url: jwksUrl,\n hosts: this.options.jwks?.hosts?.http,\n }),\n {\n cacheMaxAge:\n this.options.jwks?.cacheMaxAgeMs ?? ServiceAssertion.DEFAULT_JWKS_CACHE_MAX_AGE_MS,\n cooldownDuration:\n this.options.jwks?.cooldownMs ?? ServiceAssertion.DEFAULT_JWKS_COOLDOWN_MS,\n },\n );\n\n this.keySets.set(issuer, keySet);\n\n return keySet;\n }\n\n private async runVerify(opts: {\n token: string;\n issuer: string;\n keySet: TRemoteKeySet;\n jose: typeof import('jose');\n }): Promise<IServiceAssertionClaims> {\n const { token, issuer, keySet, jose } = opts;\n\n // Resolved when the key set was, so a per-caller override is already folded in.\n const maxTokenAge =\n this.acceptMaxAges.get(issuer) ??\n ServiceAssertion.resolveAcceptMaxAge({\n serviceDefault: this.options.acceptMaxAgeSeconds,\n });\n\n const clockTolerance =\n this.options.clockToleranceSeconds ?? ServiceAssertion.DEFAULT_CLOCK_TOLERANCE_SECONDS;\n\n try {\n const { payload } = await jose.jwtVerify<IServiceAssertionClaims>(token, keySet, {\n algorithms: [ServiceAssertion.ALGORITHM],\n typ: ServiceAssertion.TYP,\n issuer,\n audience: this.options.name,\n // NOT redundant with `exp`, though it looks it. An honest caller stamps `exp = iat +\n // lifetime`, so the two are numerically tied and jose reaches `exp` first - measured.\n // `maxTokenAge` is the only bound that still holds when the CALLER is the attacker and picks\n // its own `exp`, which is precisely the case it exists for. Do not delete it as dead config.\n //\n // And it is the CALLEE's number, never one the caller may request: a caller that could ask\n // for a longer window would be choosing its own replay window, which is the whole thing this\n // is here to deny.\n //\n // TWO NUMBERS, and they answer different questions. Measured at the defaults, 60 + 5:\n // - 65s is the ACCEPTANCE window on this machine's clock. Age 64 passes, 65 does not.\n // - 70s is the REPLAY window in wall-clock time, when the caller's clock runs the full\n // tolerance fast: we accept an `iat` up to 5s in our future, then keep accepting for\n // another 64. Measured: still accepted 69s after minting.\n // The second is the one a threat model asks for. Widening `clockToleranceSeconds` widens it\n // second for second, so it is a security knob, not an operational one.\n maxTokenAge,\n clockTolerance,\n requiredClaims: ['htm', 'htu', 'jti'],\n });\n\n return payload;\n } catch (error) {\n // One code out, the reason on `cause`: a wrong audience, clock skew and a rotated key are\n // otherwise the same string to whoever is reading the log at 2am.\n const reason = (error as { cause?: unknown })?.cause ?? error;\n this.logger.for(this.runVerify.name).warn('Rejected | iss: %s | reason: %s', issuer, reason);\n\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID, cause: error });\n }\n }\n\n private assertRequestBinding(opts: {\n payload: IServiceAssertionClaims;\n method: string;\n path: string;\n }): void {\n const { payload, method, path } = opts;\n\n const signed = `${payload.htm} ${payload.htu}`;\n const actual = `${method.toUpperCase()} ${path}`;\n\n if (signed === actual) {\n return;\n }\n\n this.logger\n .for(this.assertRequestBinding.name)\n .warn('Request binding mismatch | signed: %s | actual: %s', signed, actual);\n\n throw getError({ error: AuthenticationErrors.REQUEST_BINDING_MISMATCH });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verifier.service.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/services/service/verifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAA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AE,MAAM,EAAE,MAAM,CAAC,CAAC;YAE7F,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,IAI5B;QACC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEvC,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;QAEjD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC;aACnC,IAAI,CAAC,oDAAoD,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE9E,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF,CAAA;AAzLY,+BAA+B;IAQvC,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,uBAAuB,CAAC,eAAe,EAAE,CAAC,CAAA;;GARhD,+BAA+B,CAyL3C","sourcesContent":["import { inject } from '@/base/metadata';\nimport {\n AuthenticateBindingKeys,\n AuthenticationErrors,\n BaseService,\n ServiceAssertion,\n} from '@venizia/ignis-kernel';\nimport type { IServiceAssertionClaims, IServiceAuthOptions } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { createRemoteJWKSet } from 'jose';\nimport { JoseLoader } from '../jose-loader';\nimport { JWKSUrlPolicy } from '../jwks-url-policy';\n\ntype TRemoteKeySet = ReturnType<typeof createRemoteJWKSet>;\n\n/**\n * Verifies an incoming service assertion against the CALLER's own JWKS.\n *\n * What the assertion covers, and nothing else: the HTTP method and the percent-encoded path. It does\n * NOT cover the query string, any header, or the body. Tenant selectors in particular are usually a\n * header or a query parameter, so an assertion alone does not authenticate which tenant a call acts\n * on - the caller allowlist and the application's own scoping have to do that. Stated because the\n * gap is invisible from the call site.\n */\nexport class ServiceAssertionVerifierService extends BaseService {\n /** One remote key set per caller, kept because `createRemoteJWKSet` owns its own cache. */\n private readonly keySets = new Map<string, TRemoteKeySet>();\n\n /** Per-caller accepted age, resolved once alongside its key set. */\n private readonly acceptMaxAges = new Map<string, number>();\n\n constructor(\n @inject({ key: AuthenticateBindingKeys.SERVICE_OPTIONS })\n private readonly options: IServiceAuthOptions,\n ) {\n super({ scope: ServiceAssertionVerifierService.name });\n }\n\n /**\n * @param path The percent-ENCODED pathname, from `new URL(context.req.url).pathname`. Never\n * `context.req.path` - Hono decodes that one, and the caller signed the encoded form.\n */\n async verify(opts: { token: string; method: string; path: string }): Promise<{ issuer: string }> {\n const { token, method, path } = opts;\n\n const jose = await JoseLoader.load();\n const issuer = this.readIssuer({ token, jose });\n const keySet = this.resolveKeySet({ issuer, jose });\n const payload = await this.runVerify({ token, issuer, keySet, jose });\n\n this.assertRequestBinding({ payload, method, path });\n\n return { issuer };\n }\n\n /**\n * Reads `iss` WITHOUT verifying, only to choose which key set checks the signature. The same value\n * is then enforced as the expected issuer, so a forged `iss` buys nothing beyond selecting the key\n * set that will reject it.\n */\n private readIssuer(opts: { token: string; jose: typeof import('jose') }): string {\n let issuer: unknown;\n\n try {\n ({ iss: issuer } = opts.jose.decodeJwt(opts.token));\n } catch (error) {\n this.logger.for(this.readIssuer.name).warn('Undecodable assertion | error: %s', error);\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID });\n }\n\n // Typed, not merely present: a numeric `iss` would index the caller map by coercion.\n if (typeof issuer !== 'string' || issuer.length === 0) {\n this.logger\n .for(this.readIssuer.name)\n .warn('Undecodable assertion | iss is missing or not a string');\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID });\n }\n\n return issuer;\n }\n\n private resolveKeySet(opts: { issuer: string; jose: typeof import('jose') }): TRemoteKeySet {\n const { issuer, jose } = opts;\n\n const cached = this.keySets.get(issuer);\n\n if (cached) {\n return cached;\n }\n\n const callers = this.options.callers ?? {};\n\n // `Object.hasOwn`, never a truthiness check on the index: the map arrives as a plain object, so\n // `iss: 'constructor'` would otherwise return `Function` - truthy - walk past this guard, and\n // reach `new URL(<function>)` as an uncaught TypeError.\n if (!Object.hasOwn(callers, issuer)) {\n this.logger\n .for(this.resolveKeySet.name)\n .warn('Caller not on the allowlist | iss: %s', issuer);\n throw getError({ error: AuthenticationErrors.CALLER_NOT_ALLOWED });\n }\n\n const entry = callers[issuer];\n const jwksUrl = typeof entry === 'string' ? entry : entry.jwksUrl;\n\n this.acceptMaxAges.set(\n issuer,\n ServiceAssertion.resolveAcceptMaxAge({\n callerOverride: typeof entry === 'string' ? undefined : entry.acceptMaxAgeSeconds,\n serviceDefault: this.options.acceptMaxAgeSeconds,\n }),\n );\n\n const keySet = jose.createRemoteJWKSet(\n JWKSUrlPolicy.assertUrl({\n scope: ServiceAssertionVerifierService.name,\n label: 'the caller jwksUrl',\n url: jwksUrl,\n trusted: this.options.jwks?.trusted,\n }),\n {\n cacheMaxAge:\n this.options.jwks?.cacheMaxAgeMs ?? ServiceAssertion.DEFAULT_JWKS_CACHE_MAX_AGE_MS,\n cooldownDuration:\n this.options.jwks?.cooldownMs ?? ServiceAssertion.DEFAULT_JWKS_COOLDOWN_MS,\n },\n );\n\n this.keySets.set(issuer, keySet);\n\n return keySet;\n }\n\n private async runVerify(opts: {\n token: string;\n issuer: string;\n keySet: TRemoteKeySet;\n jose: typeof import('jose');\n }): Promise<IServiceAssertionClaims> {\n const { token, issuer, keySet, jose } = opts;\n\n // Resolved when the key set was, so a per-caller override is already folded in.\n const maxTokenAge =\n this.acceptMaxAges.get(issuer) ??\n ServiceAssertion.resolveAcceptMaxAge({\n serviceDefault: this.options.acceptMaxAgeSeconds,\n });\n\n const clockTolerance =\n this.options.clockToleranceSeconds ?? ServiceAssertion.DEFAULT_CLOCK_TOLERANCE_SECONDS;\n\n try {\n const { payload } = await jose.jwtVerify<IServiceAssertionClaims>(token, keySet, {\n algorithms: [ServiceAssertion.ALGORITHM],\n typ: ServiceAssertion.TYP,\n issuer,\n audience: this.options.name,\n // NOT redundant with `exp`, though it looks it. An honest caller stamps `exp = iat +\n // lifetime`, so the two are numerically tied and jose reaches `exp` first - measured.\n // `maxTokenAge` is the only bound that still holds when the CALLER is the attacker and picks\n // its own `exp`, which is precisely the case it exists for. Do not delete it as dead config.\n //\n // And it is the CALLEE's number, never one the caller may request: a caller that could ask\n // for a longer window would be choosing its own replay window, which is the whole thing this\n // is here to deny.\n //\n // TWO NUMBERS, and they answer different questions. Measured at the defaults, 60 + 5:\n // - 65s is the ACCEPTANCE window on this machine's clock. Age 64 passes, 65 does not.\n // - 70s is the REPLAY window in wall-clock time, when the caller's clock runs the full\n // tolerance fast: we accept an `iat` up to 5s in our future, then keep accepting for\n // another 64. Measured: still accepted 69s after minting.\n // The second is the one a threat model asks for. Widening `clockToleranceSeconds` widens it\n // second for second, so it is a security knob, not an operational one.\n maxTokenAge,\n clockTolerance,\n requiredClaims: ['htm', 'htu', 'jti'],\n });\n\n return payload;\n } catch (error) {\n // One code out, the reason on `cause`: a wrong audience, clock skew and a rotated key are\n // otherwise the same string to whoever is reading the log at 2am.\n const reason = (error as { cause?: unknown })?.cause ?? error;\n this.logger.for(this.runVerify.name).warn('Rejected | iss: %s | reason: %s', issuer, reason);\n\n throw getError({ error: AuthenticationErrors.ASSERTION_INVALID, cause: error });\n }\n }\n\n private assertRequestBinding(opts: {\n payload: IServiceAssertionClaims;\n method: string;\n path: string;\n }): void {\n const { payload, method, path } = opts;\n\n const signed = `${payload.htm} ${payload.htu}`;\n const actual = `${method.toUpperCase()} ${path}`;\n\n if (signed === actual) {\n return;\n }\n\n this.logger\n .for(this.assertRequestBinding.name)\n .warn('Request binding mismatch | signed: %s | actual: %s', signed, actual);\n\n throw getError({ error: AuthenticationErrors.REQUEST_BINDING_MISMATCH });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.strategy.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authenticate/strategies/basic.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,GAGf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,iFAAiF;AACjF,IAAa,2BAA2B,mCAAxC,MAAa,2BACX,SAAQ,UAAU;IAKlB,YAOE,OAAqC;QAErC,KAAK,CAAC,EAAE,KAAK,EAAE,6BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;QAF3C,YAAO,GAAP,OAAO,CAAsB;QATvC,SAAI,GAAG,cAAc,CAAC,cAAc,CAAC;IAYrC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE7D,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;CACF,CAAA;AAvBY,2BAA2B;IAOnC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"basic.strategy.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authenticate/strategies/basic.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,GAGf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,iFAAiF;AACjF,IAAa,2BAA2B,mCAAxC,MAAa,2BACX,SAAQ,UAAU;IAKlB,YAOE,OAAqC;QAErC,KAAK,CAAC,EAAE,KAAK,EAAE,6BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;QAF3C,YAAO,GAAP,OAAO,CAAsB;QATvC,SAAI,GAAG,cAAc,CAAC,cAAc,CAAC;IAYrC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE7D,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;CACF,CAAA;AAvBY,2BAA2B;IAOnC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,CAAoB;YACxC,SAAS,EAAE,iBAAiB,CAAC,OAAO;YACpC,GAAG,EAAE,iBAAiB,CAAC,IAAI;SAC5B,CAAC;KACH,CAAC,CAAA;qCACe,iBAAiB;GAbzB,2BAA2B,CAuBvC","sourcesContent":["import { type TContext } from '@venizia/ignis-kernel';\nimport { inject } from '@venizia/ignis-kernel';\nimport { BindingNamespaces } from '@venizia/ignis-kernel';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport { BindingKeys } from '@venizia/ignis-inversion';\nimport { type Env } from 'hono';\nimport {\n Authentication,\n type IAuthUser,\n type IAuthenticationStrategy,\n} from '@venizia/ignis-kernel';\nimport { BasicTokenService } from '../services';\n\n/** HTTP Basic Authentication strategy using Authorization header credentials. */\nexport class BasicAuthenticationStrategy<E extends Env = Env>\n extends BaseHelper\n implements IAuthenticationStrategy<E>\n{\n name = Authentication.STRATEGY_BASIC;\n\n constructor(\n @inject({\n key: BindingKeys.build<BasicTokenService>({\n namespace: BindingNamespaces.SERVICE,\n key: BasicTokenService.name,\n }),\n })\n private service: BasicTokenService<E>,\n ) {\n super({ scope: BasicAuthenticationStrategy.name });\n }\n\n async authenticate(context: TContext<E, string>): Promise<IAuthUser> {\n const credentials = this.service.extractCredentials(context);\n\n return this.service.verify({ credentials, context });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuer.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/strategies/jwks/issuer.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,+IAA+I;AAC/I,IAAa,gCAAgC,wCAA7C,MAAa,gCACX,SAAQ,UAAU;IAMlB,YAOE,OAA0C;QAE1C,KAAK,CAAC,EAAE,KAAK,EAAE,kCAAgC,CAAC,IAAI,EAAE,CAAC,CAAC;QAFhD,YAAO,GAAP,OAAO,CAA2B;QAV5C,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,IAAI,CAAC;IAY9B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,gCAAgC;IAQxC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"issuer.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/strategies/jwks/issuer.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,+IAA+I;AAC/I,IAAa,gCAAgC,wCAA7C,MAAa,gCACX,SAAQ,UAAU;IAMlB,YAOE,OAA0C;QAE1C,KAAK,CAAC,EAAE,KAAK,EAAE,kCAAgC,CAAC,IAAI,EAAE,CAAC,CAAC;QAFhD,YAAO,GAAP,OAAO,CAA2B;QAV5C,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,IAAI,CAAC;IAY9B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,gCAAgC;IAQxC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,CAAyB;YAC7C,SAAS,EAAE,iBAAiB,CAAC,OAAO;YACpC,GAAG,EAAE,sBAAsB,CAAC,IAAI;SACjC,CAAC;KACH,CAAC,CAAA;qCACe,sBAAsB;GAd9B,gCAAgC,CAwB5C","sourcesContent":["import { type TContext } from '@venizia/ignis-kernel';\nimport { inject } from '@venizia/ignis-kernel';\nimport { BindingNamespaces } from '@venizia/ignis-kernel';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport { BindingKeys } from '@venizia/ignis-inversion';\nimport { type Env } from 'hono';\nimport {\n Authentication,\n type IAuthUser,\n type IAuthenticationStrategy,\n JOSEStandards,\n} from '@venizia/ignis-kernel';\nimport { JWKSIssuerTokenService } from '../../services';\n\n/** JWT authentication strategy that verifies the bearer token with `JWKSIssuerTokenService`, for an application that issues its own tokens. */\nexport class JWKSIssuerAuthenticationStrategy<E extends Env = Env>\n extends BaseHelper\n implements IAuthenticationStrategy<E>\n{\n name = Authentication.STRATEGY_JWT;\n standard = JOSEStandards.JWKS;\n\n constructor(\n @inject({\n key: BindingKeys.build<JWKSIssuerTokenService>({\n namespace: BindingNamespaces.SERVICE,\n key: JWKSIssuerTokenService.name,\n }),\n })\n private service: JWKSIssuerTokenService<E>,\n ) {\n super({ scope: JWKSIssuerAuthenticationStrategy.name });\n }\n\n authenticate(context: TContext<E, string>): Promise<IAuthUser> {\n const token = this.service.extractCredentials(context);\n\n return this.service.verify(token);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/strategies/jwks/verifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,gJAAgJ;AAChJ,IAAa,kCAAkC,0CAA/C,MAAa,kCACX,SAAQ,UAAU;IAMlB,YAOE,OAA4C;QAE5C,KAAK,CAAC,EAAE,KAAK,EAAE,oCAAkC,CAAC,IAAI,EAAE,CAAC,CAAC;QAFlD,YAAO,GAAP,OAAO,CAA6B;QAV9C,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,IAAI,CAAC;IAY9B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,kCAAkC;IAQ1C,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authenticate/strategies/jwks/verifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,gJAAgJ;AAChJ,IAAa,kCAAkC,0CAA/C,MAAa,kCACX,SAAQ,UAAU;IAMlB,YAOE,OAA4C;QAE5C,KAAK,CAAC,EAAE,KAAK,EAAE,oCAAkC,CAAC,IAAI,EAAE,CAAC,CAAC;QAFlD,YAAO,GAAP,OAAO,CAA6B;QAV9C,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,IAAI,CAAC;IAY9B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,kCAAkC;IAQ1C,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,CAA2B;YAC/C,SAAS,EAAE,iBAAiB,CAAC,OAAO;YACpC,GAAG,EAAE,wBAAwB,CAAC,IAAI;SACnC,CAAC;KACH,CAAC,CAAA;qCACe,wBAAwB;GAdhC,kCAAkC,CAwB9C","sourcesContent":["import { type TContext } from '@venizia/ignis-kernel';\nimport { inject } from '@venizia/ignis-kernel';\nimport { BindingNamespaces } from '@venizia/ignis-kernel';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport { BindingKeys } from '@venizia/ignis-inversion';\nimport { type Env } from 'hono';\nimport {\n Authentication,\n type IAuthUser,\n type IAuthenticationStrategy,\n JOSEStandards,\n} from '@venizia/ignis-kernel';\nimport { JWKSVerifierTokenService } from '../../services';\n\n/** JWT authentication strategy that verifies the bearer token with `JWKSVerifierTokenService`, for an application that trusts a remote JWKS. */\nexport class JWKSVerifierAuthenticationStrategy<E extends Env = Env>\n extends BaseHelper\n implements IAuthenticationStrategy<E>\n{\n name = Authentication.STRATEGY_JWT;\n standard = JOSEStandards.JWKS;\n\n constructor(\n @inject({\n key: BindingKeys.build<JWKSVerifierTokenService>({\n namespace: BindingNamespaces.SERVICE,\n key: JWKSVerifierTokenService.name,\n }),\n })\n private service: JWKSVerifierTokenService<E>,\n ) {\n super({ scope: JWKSVerifierAuthenticationStrategy.name });\n }\n\n authenticate(context: TContext<E, string>): Promise<IAuthUser> {\n const token = this.service.extractCredentials(context);\n\n return this.service.verify(token);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jws.strategy.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authenticate/strategies/jws.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,iHAAiH;AACjH,IAAa,yBAAyB,iCAAtC,MAAa,yBACX,SAAQ,UAAU;IAMlB,YAOE,OAAmC;QAEnC,KAAK,CAAC,EAAE,KAAK,EAAE,2BAAyB,CAAC,IAAI,EAAE,CAAC,CAAC;QAFzC,YAAO,GAAP,OAAO,CAAoB;QAVrC,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,GAAG,CAAC;IAY7B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,yBAAyB;IAQjC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"jws.strategy.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authenticate/strategies/jws.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,cAAc,EAGd,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,iHAAiH;AACjH,IAAa,yBAAyB,iCAAtC,MAAa,yBACX,SAAQ,UAAU;IAMlB,YAOE,OAAmC;QAEnC,KAAK,CAAC,EAAE,KAAK,EAAE,2BAAyB,CAAC,IAAI,EAAE,CAAC,CAAC;QAFzC,YAAO,GAAP,OAAO,CAAoB;QAVrC,SAAI,GAAG,cAAc,CAAC,YAAY,CAAC;QACnC,aAAQ,GAAG,aAAa,CAAC,GAAG,CAAC;IAY7B,CAAC;IAED,YAAY,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxBY,yBAAyB;IAQjC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,CAAkB;YACtC,SAAS,EAAE,iBAAiB,CAAC,OAAO;YACpC,GAAG,EAAE,eAAe,CAAC,IAAI;SAC1B,CAAC;KACH,CAAC,CAAA;qCACe,eAAe;GAdvB,yBAAyB,CAwBrC","sourcesContent":["import { type TContext } from '@venizia/ignis-kernel';\nimport { inject } from '@venizia/ignis-kernel';\nimport { BindingNamespaces } from '@venizia/ignis-kernel';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport { BindingKeys } from '@venizia/ignis-inversion';\nimport { type Env } from 'hono';\nimport {\n Authentication,\n type IAuthUser,\n type IAuthenticationStrategy,\n JOSEStandards,\n} from '@venizia/ignis-kernel';\nimport { JWSTokenService } from '../services';\n\n/** JWT authentication strategy that verifies the bearer token with `JWSTokenService` (JWS, HS256 by default). */\nexport class JWSAuthenticationStrategy<E extends Env = Env>\n extends BaseHelper\n implements IAuthenticationStrategy<E>\n{\n name = Authentication.STRATEGY_JWT;\n standard = JOSEStandards.JWS;\n\n constructor(\n @inject({\n key: BindingKeys.build<JWSTokenService>({\n namespace: BindingNamespaces.SERVICE,\n key: JWSTokenService.name,\n }),\n })\n private service: JWSTokenService<E>,\n ) {\n super({ scope: JWSAuthenticationStrategy.name });\n }\n\n authenticate(context: TContext<E, string>): Promise<IAuthUser> {\n const token = this.service.extractCredentials(context);\n\n return this.service.verify(token);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.strategy.js","sourceRoot":"","sources":["../../../../../../src/components/auth/authenticate/strategies/service.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,GACP,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF;;;;;;GAMG;AACH,IAAa,6BAA6B,qCAA1C,MAAa,6BACX,SAAQ,UAAU;IAKlB,YAOE,QAA0D,EAE1D,OAAgD;QAEhD,KAAK,CAAC,EAAE,KAAK,EAAE,+BAA6B,CAAC,IAAI,EAAE,CAAC,CAAC;QAJpC,aAAQ,GAAR,QAAQ,CAAiC;QAEzC,YAAO,GAAP,O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AS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAE3E,4GAA4G;QAC5G,uGAAuG;QACvG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM;iBACR,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;iBAC3B,IAAI,CAAC,yDAAyD,EAAE,MAAM,CAAC,CAAC;YAC3E,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,2FAA2F;QAC3F,OAAO,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IACjD,CAAC;CACF,CAAA;AAjDY,6BAA6B;IAOrC,WAAA,MAAM,CAAC;QACN,GAAG,EAAE,WAAW,CAAC,KAAK,CAAkC;YACtD,SAAS,EAAE,iBAAiB,CAAC,OAAO;YACpC,GAAG,EAAE,+BAA+B,CAAC,IAAI;SAC1C,CAAC;KACH,CAAC,CAAA;IAED,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,uBAAuB,CAAC,eAAe,EAAE,CAAC,CAAA;qCAD9B,+BAA+B;GAbjD,6BAA6B,CAiDzC","sourcesContent":["import { BaseHelper, getError } from '@venizia/ignis-helpers/core';\nimport { BindingKeys } from '@venizia/ignis-inversion';\nimport type { Env } from 'hono';\nimport {\n AuthenticateBindingKeys,\n Authentication,\n AuthenticationErrors,\n BindingNamespaces,\n ServiceAssertion,\n inject,\n} from '@venizia/ignis-kernel';\nimport type {\n IAuthUser,\n IAuthenticationStrategy,\n IServiceAuthOptions,\n TContext,\n} from '@venizia/ignis-kernel';\nimport { ServiceAssertionVerifierService } from '../services/service/verifier.service';\n\n/**\n * Proves the CALLING SERVICE, from a per-request Ed25519 assertion verified against that caller's\n * own JWKS. No identity round trip and no shared password.\n *\n * It proves which service called, never which user. `resolvePrincipal` is where the application\n * turns a caller name into one of its own principals.\n */\nexport class ServiceAuthenticationStrategy<E extends Env = Env>\n extends BaseHelper\n implements IAuthenticationStrategy<E>\n{\n name = Authentication.STRATEGY_SERVICE;\n\n constructor(\n @inject({\n key: BindingKeys.build<ServiceAssertionVerifierService>({\n namespace: BindingNamespaces.SERVICE,\n key: ServiceAssertionVerifierService.name,\n }),\n })\n private readonly verifier: ServiceAssertionVerifierService,\n @inject({ key: AuthenticateBindingKeys.SERVICE_OPTIONS })\n private readonly options: IServiceAuthOptions<E>,\n ) {\n super({ scope: ServiceAuthenticationStrategy.name });\n }\n\n async authenticate(context: TContext<E, string>): Promise<IAuthUser> {\n const token = context.req.header(ServiceAssertion.HEADER);\n\n if (!token) {\n throw getError({ error: AuthenticationErrors.ASSERTION_MISSING });\n }\n\n // The raw url, NOT `context.req.path`: Hono hands that back percent-DECODED, so a route carrying\n // a space or a non-ASCII slug would never match the encoded path the caller signed.\n const { issuer } = await this.verifier.verify({\n token,\n method: context.req.method,\n path: new URL(context.req.url).pathname,\n });\n\n const principal = await this.options.resolvePrincipal({ issuer, context });\n\n // Validated rather than trusted. The provider also refuses an answer without a `userId`, but a principal an\n // application resolves wrongly is reported here, at the cause, with the issuer and the strategy named.\n if (!principal?.userId) {\n this.logger\n .for(this.authenticate.name)\n .warn('resolvePrincipal returned no usable principal | iss: %s', issuer);\n throw getError({ error: AuthenticationErrors.PRINCIPAL_UNRESOLVED });\n }\n\n // Which service called is audit-relevant even when the principal is shared across callers.\n return { ...principal, callerService: issuer };\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { IdType } from '../../../../../base/index.js';
|
|
2
|
-
import type { AnyType } from '@venizia/ignis-helpers/common';
|
|
3
2
|
import type { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
4
3
|
/** Filter passed to loadFilteredPolicy: which principal's policies to load. */
|
|
5
4
|
export interface ICasbinPolicyFilter {
|
|
@@ -9,7 +8,7 @@ export interface ICasbinPolicyFilter {
|
|
|
9
8
|
};
|
|
10
9
|
}
|
|
11
10
|
/** Drizzle connector for policy queries, typed on the shared `PgDatabase` base so postgres-js fits too. Declared here rather than imported from `@/connectors/postgres`: components depend on a minimal local contract, never a connector class. */
|
|
12
|
-
export type TCasbinPolicyConnector = PgDatabase<PgQueryResultHKT, Record<string,
|
|
11
|
+
export type TCasbinPolicyConnector = PgDatabase<PgQueryResultHKT, Record<string, unknown>>;
|
|
13
12
|
/** Minimal source the adapters depend on - any drizzle-backed datasource satisfies it. */
|
|
14
13
|
export interface ICasbinPolicySource {
|
|
15
14
|
/** A datasource that opens on first use opens here; one that opens at start resolves at once. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/auth/authorize/adapters/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IdType } from '@/base';\nimport type { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';\n\n/** Filter passed to loadFilteredPolicy: which principal's policies to load. */\nexport interface ICasbinPolicyFilter {\n principal: { type: string; id: IdType };\n}\n\n/** Drizzle connector for policy queries, typed on the shared `PgDatabase` base so postgres-js fits too. Declared here rather than imported from `@/connectors/postgres`: components depend on a minimal local contract, never a connector class. */\nexport type TCasbinPolicyConnector = PgDatabase<PgQueryResultHKT, Record<string, unknown>>;\n\n/** Minimal source the adapters depend on - any drizzle-backed datasource satisfies it. */\nexport interface ICasbinPolicySource {\n /** A datasource that opens on first use opens here; one that opens at start resolves at once. */\n ensureOpen?(): Promise<void>;\n\n /** Preferred: lazily wires the driver on first read and survives pool rotation, mirroring repositories. */\n getConnector?(): TCasbinPolicyConnector;\n\n /** Back-compat: a pre-wired connector. Prefer getConnector on a real datasource. */\n connector?: TCasbinPolicyConnector;\n}\n\n/** Maps a logical table onto its physical name + schema. */\nexport interface IScopedCasbinTable {\n tableName: string;\n schemaName?: string;\n}\n\n/** All physical mapping the ScopedCasbinAdapter needs. App provides this; framework stays decoupled. */\nexport interface IScopedCasbinEntities {\n policyDefinition: IScopedCasbinTable & {\n metadata?: { columnName: string };\n };\n\n /** Permission catalog (id, code, ...). */\n permission: IScopedCasbinTable;\n\n /** Principal type labels used as casbin name prefixes. */\n principals: { user: string; role: string };\n\n /** Domain type labels (e.g. ['Merchant', 'Organizer']). */\n domainTypes: string[];\n\n /** Soft-delete handling for both tables. */\n softDelete?: { use: false } | { use: true; columnName: string };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAE/B,6IAA6I;AAC7I,IAAa,kBAAkB,0BAA/B,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAC8D,WAA4B;QAExF,KAAK,CAAC;YACJ,KAAK,EAAE,oBAAkB,CAAC,IAAI;YAC9B,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;SACtD,CAAC,CAAC;QALyD,gBAAW,GAAX,WAAW,CAAiB;IAM1F,CAAC;IAEQ,OAAO;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../src/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AC,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;YAC3C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,WAAW;aACb,IAAI,CAAC,EAAE,GAAG,EAAE,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;aACtD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CACF,CAAA;AAzCY,kBAAkB;IAE1B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,kBAAkB,CAyC9B","sourcesContent":["import type { BaseApplication } from '@/base/applications/base';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@venizia/ignis-kernel';\nimport { CoreBindings } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n AuthorizationEnforcerRegistry,\n AuthorizeBindingKeys,\n type IAuthorizeOptions,\n} from '@venizia/ignis-kernel';\n\n/** Registers authorization from the options bound under `AuthorizeBindingKeys.OPTIONS`. Throws at binding time when no options are bound. */\nexport class AuthorizeComponent extends BaseComponent {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: AuthorizeComponent.name,\n initDefault: { enable: true, container: application },\n });\n }\n\n override binding(): ValueOrPromise<void> {\n const options = this.application.get({\n key: AuthorizeBindingKeys.OPTIONS,\n isOptional: true,\n });\n\n if (!options) {\n throw getError({\n message:\n '[AuthorizeComponent] No authorize options found. Bind options to AuthorizeBindingKeys.OPTIONS before registering the component.',\n });\n }\n\n this.bindAlwaysAllowRoles({ options });\n\n // The registry otherwise finds options only through a registered enforcer's container, so\n // `defaultDecision` would be unreadable in the one case it decides: no enforcer registered.\n AuthorizationEnforcerRegistry.getInstance().setOptions({ options });\n\n this.logger.for(this.binding.name).info('Authorization configured');\n }\n\n private bindAlwaysAllowRoles(opts: { options: IAuthorizeOptions }): void {\n if (!opts.options.alwaysAllowRoles?.length) {\n return;\n }\n\n this.application\n .bind({ key: AuthorizeBindingKeys.ALWAYS_ALLOW_ROLES })\n .toValue(opts.options.alwaysAllowRoles);\n }\n}\n"]}
|
|
@@ -8,6 +8,6 @@ export interface IGrpcComponentConfig {
|
|
|
8
8
|
}
|
|
9
9
|
/** Container keys of the gRPC component. */
|
|
10
10
|
export declare class GrpcBindingKeys {
|
|
11
|
-
static readonly GRPC_COMPONENT_OPTIONS
|
|
11
|
+
static readonly GRPC_COMPONENT_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<IGrpcComponentConfig>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { BindingKeys } from '@venizia/ignis-inversion';
|
|
1
2
|
/** Container keys of the gRPC component. */
|
|
2
3
|
export class GrpcBindingKeys {
|
|
3
|
-
static { this.GRPC_COMPONENT_OPTIONS =
|
|
4
|
+
static { this.GRPC_COMPONENT_OPTIONS = BindingKeys.build({
|
|
5
|
+
key: '@app/grpc/options',
|
|
6
|
+
}); }
|
|
4
7
|
}
|
|
5
8
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/components/controller/grpc/common/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/components/controller/grpc/common/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAYvD,4CAA4C;AAC5C,MAAM,OAAO,eAAe;aACV,2BAAsB,GAAG,WAAW,CAAC,KAAK,CAAuB;QAC/E,GAAG,EAAE,mBAAmB;KACzB,CAAC,CAAC","sourcesContent":["import type { IConnectRpcModule } from '@/base/controllers/grpc/common/types';\nimport { BindingKeys } from '@venizia/ignis-inversion';\n\n// Re-exported so an application can name the type without reaching into the base barrel.\nexport type { IConnectRpcModule };\n\n/** Options of `GrpcComponent`, bound at `GrpcBindingKeys.GRPC_COMPONENT_OPTIONS`. */\nexport interface IGrpcComponentConfig {\n interceptors?: unknown[];\n /** The ConnectRPC peer, for a compiled binary that has no `node_modules` to resolve it from. */\n module?: IConnectRpcModule;\n}\n\n/** Container keys of the gRPC component. */\nexport class GrpcBindingKeys {\n static readonly GRPC_COMPONENT_OPTIONS = BindingKeys.build<IGrpcComponentConfig>({\n key: '@app/grpc/options',\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.component.js","sourceRoot":"","sources":["../../../../../src/components/controller/grpc/grpc.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,eAAe,GAAyB,EAAE,CAAC;AAEjD,oQAAoQ;AACpQ,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,YAAoB,WAA4B;QAC9C,KAAK,CAAC;YACJ,KAAK,EAAE,aAAa,CAAC,IAAI;YACzB,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;YACrD,QAAQ,EAAE;gBACR,CAAC,eAAe,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"grpc.component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BAAiB,CAAC,UAAU;gBACjC,OAAO,EAAE,UAAU;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { ControllerTransports } from '@venizia/ignis-kernel';\nimport type { AbstractGrpcController } from '@/base/controllers/grpc';\nimport { BindingNamespaces } from '@venizia/ignis-kernel';\nimport { Binding, BindingValueTypes, MetadataRegistry } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { HTTP, ObjectUtility } from '@venizia/ignis-helpers/common';\nimport type { IGrpcComponentConfig } from './common/types';\nimport { GrpcBindingKeys } from './common/types';\n\nconst DEFAULT_OPTIONS: IGrpcComponentConfig = {};\n\n/** Mounts every controller declared with the gRPC transport onto the root router at its metadata `path`, and hands each the `IGrpcComponentConfig` interceptors and ConnectRPC module. A gRPC controller without a service definition is skipped with a warning. */\nexport class GrpcComponent extends BaseComponent {\n constructor(private application: BaseApplication) {\n super({\n scope: GrpcComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [GrpcBindingKeys.GRPC_COMPONENT_OPTIONS]: Binding.bind({\n key: GrpcBindingKeys.GRPC_COMPONENT_OPTIONS,\n }).toValue(DEFAULT_OPTIONS),\n },\n });\n }\n\n override async binding(): Promise<void> {\n const logger = this.logger.for(this.binding.name);\n const router = this.application.getRootRouter();\n\n const options = this.application.get({\n key: GrpcBindingKeys.GRPC_COMPONENT_OPTIONS,\n isOptional: true,\n });\n\n // Batch drained before re-scanning - see `RestApplication.registerDynamicBindings` for why.\n const configured = new Set<string>();\n\n let bindings = this.application.findByTag({\n tag: BindingNamespaces.CONTROLLER,\n exclude: configured,\n });\n\n while (bindings.length > 0) {\n for (const binding of bindings) {\n if (configured.has(binding.key)) {\n continue;\n }\n\n const target = binding.getBindingMeta({ type: BindingValueTypes.CLASS });\n\n if (!target) {\n configured.add(binding.key);\n continue;\n }\n\n const metadata = MetadataRegistry.getInstance().getControllerMetadata({ target });\n\n // Skip non-gRPC controllers — they are configured by RestComponent\n if (metadata?.transport !== ControllerTransports.GRPC) {\n configured.add(binding.key);\n continue;\n }\n\n if (!metadata?.path || ObjectUtility.isEmpty({ value: metadata.path })) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[registerControllers] key: '${binding.key}' | Invalid controller metadata, 'path' is required for gRPC controller metadata`,\n });\n }\n\n const instance = this.application.get<AbstractGrpcController>({\n key: binding.key,\n isOptional: false,\n });\n\n if (!instance) {\n logger.debug('No binding instance | key: %s', binding.key);\n configured.add(binding.key);\n continue;\n }\n\n if (!instance.service) {\n logger.warn('gRPC controller has no service definition, skipping | key: %s', binding.key);\n configured.add(binding.key);\n continue;\n }\n\n instance.basePath = this.application.getProjectConfigs().path.base;\n instance.connectRpcModule = options?.module;\n instance.interceptors = options?.interceptors;\n await instance.configure();\n\n router.route(metadata.path, instance.getRouter());\n configured.add(binding.key);\n\n logger.info('Configured gRPC controller | key: %s | path: %s', binding.key, metadata.path);\n }\n\n // Re-fetch excluding already configured — picks up dynamically added controllers\n bindings = this.application.findByTag({\n tag: BindingNamespaces.CONTROLLER,\n exclude: configured,\n });\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { IApplicationInfo } from '@venizia/ignis-kernel';
|
|
2
|
+
import type { IHealthCheckOptions } from './types.js';
|
|
1
3
|
/** Container keys of the health check component. */
|
|
2
4
|
export declare class HealthCheckBindingKeys {
|
|
3
|
-
static readonly HEALTH_CHECK_OPTIONS
|
|
5
|
+
static readonly HEALTH_CHECK_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<IHealthCheckOptions>;
|
|
4
6
|
/** The component resolves `getAppInfo()` once (it is async) and binds the result for the controller. */
|
|
5
|
-
static readonly APPLICATION_INFO
|
|
7
|
+
static readonly APPLICATION_INFO: import("@venizia/ignis-inversion").TBindingKey<IApplicationInfo>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { BindingKeys } from '@venizia/ignis-inversion';
|
|
1
2
|
/** Container keys of the health check component. */
|
|
2
3
|
export class HealthCheckBindingKeys {
|
|
3
|
-
static { this.HEALTH_CHECK_OPTIONS =
|
|
4
|
+
static { this.HEALTH_CHECK_OPTIONS = BindingKeys.build({
|
|
5
|
+
key: '@app/health-check/options',
|
|
6
|
+
}); }
|
|
4
7
|
/** The component resolves `getAppInfo()` once (it is async) and binds the result for the controller. */
|
|
5
|
-
static { this.APPLICATION_INFO =
|
|
8
|
+
static { this.APPLICATION_INFO = BindingKeys.build({
|
|
9
|
+
key: '@app/health-check/application-info',
|
|
10
|
+
}); }
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/health-check/common/keys.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,OAAO,sBAAsB;aACjB,yBAAoB,GAAG,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/health-check/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,oDAAoD;AACpD,MAAM,OAAO,sBAAsB;aACjB,yBAAoB,GAAG,WAAW,CAAC,KAAK,CAAsB;QAC5E,GAAG,EAAE,2BAA2B;KACjC,CAAC,CAAC;IAEH,wGAAwG;aACxF,qBAAgB,GAAG,WAAW,CAAC,KAAK,CAAmB;QACrE,GAAG,EAAE,oCAAoC;KAC1C,CAAC,CAAC","sourcesContent":["import { BindingKeys } from '@venizia/ignis-inversion';\nimport type { IApplicationInfo } from '@venizia/ignis-kernel';\nimport type { IHealthCheckOptions } from './types';\n\n/** Container keys of the health check component. */\nexport class HealthCheckBindingKeys {\n static readonly HEALTH_CHECK_OPTIONS = BindingKeys.build<IHealthCheckOptions>({\n key: '@app/health-check/options',\n });\n\n /** The component resolves `getAppInfo()` once (it is async) and binds the result for the controller. */\n static readonly APPLICATION_INFO = BindingKeys.build<IApplicationInfo>({\n key: '@app/health-check/application-info',\n });\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import type { IBuildInfo } from '@venizia/ignis-helpers/core';
|
|
|
8
8
|
*
|
|
9
9
|
* export const bindHealth = (application: BaseApplication) => {
|
|
10
10
|
* application
|
|
11
|
-
* .bind
|
|
11
|
+
* .bind({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS })
|
|
12
12
|
* .toValue({ restOptions: { path: '/status' }, stats: { secretKey: 'change-me' } });
|
|
13
13
|
* };
|
|
14
14
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/health-check/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IBuildInfo } from '@venizia/ignis-helpers/core';\n\n/**\n * Options of `HealthCheckComponent`, bound at `HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS`.\n *\n * @example\n * ```typescript\n * import { HealthCheckBindingKeys, type BaseApplication, type IHealthCheckOptions } from '@venizia/ignis';\n *\n * export const bindHealth = (application: BaseApplication) => {\n * application\n * .bind
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/health-check/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IBuildInfo } from '@venizia/ignis-helpers/core';\n\n/**\n * Options of `HealthCheckComponent`, bound at `HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS`.\n *\n * @example\n * ```typescript\n * import { HealthCheckBindingKeys, type BaseApplication, type IHealthCheckOptions } from '@venizia/ignis';\n *\n * export const bindHealth = (application: BaseApplication) => {\n * application\n * .bind({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS })\n * .toValue({ restOptions: { path: '/status' }, stats: { secretKey: 'change-me' } });\n * };\n * ```\n */\nexport interface IHealthCheckOptions {\n /** Partially-filled bindings are accepted; every missing field falls back to its default. */\n restOptions?: {\n /**\n * Base path the health routes mount under.\n *\n * @default '/health'\n */\n path?: string;\n };\n /**\n * `GET <path>/stats`: build stamp, process and memory. The runtime and version it reports are\n * exactly what an attacker needs to pick an exploit, so the default is CLOSED on every host that\n * is not provably a development one.\n */\n stats?: {\n /**\n * Whether the route is mounted. Left out, it is open only when `NODE_ENV` names a development\n * environment (`Environment.DEVELOPMENT_ENVS`); `staging`, `uat`, `production`, an unrecognised\n * name and an unset `NODE_ENV` all keep it closed.\n *\n * @default true in a development environment, false otherwise\n */\n enable?: boolean;\n /**\n * When set, the route answers only for a request carrying this value in `X-Health-Key`, and a\n * refusal is indistinguishable from an unmounted route. A blank value fails closed.\n * Without the field the route is open to anything that can reach the port.\n */\n secretKey?: string;\n /** Wins over {@link BuildInfoRegistry}; a host that stamps its own build passes it here. */\n buildInfo?: IBuildInfo;\n };\n}\n"]}
|
|
@@ -63,9 +63,7 @@ let HealthCheckComponent = HealthCheckComponent_1 = class HealthCheckComponent e
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (opts !== undefined) {
|
|
66
|
-
this.application
|
|
67
|
-
.bind({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS })
|
|
68
|
-
.toValue(opts);
|
|
66
|
+
this.application.bind({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS }).toValue(opts);
|
|
69
67
|
}
|
|
70
68
|
await super.configure(opts);
|
|
71
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/health-check/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,M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CAAC;YACpC,GAAG,EAAE,sBAAsB,CAAC,gBAAgB;SAC7C,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEzB,+FAA+F;QAC/F,8FAA8F;QAC9F,2FAA2F;QAC3F,6FAA6F;QAC7F,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;QAChE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IACrD,CAAC;CACF,CAAA;AAvEY,oBAAoB;IAE5B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,oBAAoB,CAuEhC","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { controller, inject } from '@/base/metadata';\nimport { CoreBindings } from '@venizia/ignis-kernel';\nimport { HealthCheckBindingKeys, type IHealthCheckOptions } from './common';\nimport { HealthCheckController } from './controller';\nimport { HealthCheckReporter } from './reporter';\nimport { Environment } from '@venizia/ignis-helpers';\nimport { Binding } from '@venizia/ignis-kernel';\n\nconst DEFAULT_REST_PATH = '/health';\nconst DEFAULT_OPTIONS: IHealthCheckOptions = {\n restOptions: { path: DEFAULT_REST_PATH },\n};\n\n/**\n * Mounts the health check controller (liveness root, `/ping`, and the gated `/stats`).\n *\n * @example\n * ```typescript\n * import { BaseApplication, HealthCheckComponent, type IHealthCheckOptions } from '@venizia/ignis';\n *\n * abstract class App extends BaseApplication {\n * preConfigure(): void {\n * const options: IHealthCheckOptions = { restOptions: { path: '/status' } };\n * this.component(HealthCheckComponent, { options });\n * }\n * }\n * ```\n */\nexport class HealthCheckComponent extends BaseComponent<IHealthCheckOptions> {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: HealthCheckComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS]: Binding.bind({\n key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,\n }).toValue(DEFAULT_OPTIONS),\n },\n });\n }\n\n /**\n * `application.component(HealthCheckComponent, { options })` lands here. Options given at the\n * call site are the most explicit statement of intent, so they take the binding over anything\n * bound earlier; `initDefaultBindings` then finds the key taken and leaves the default aside.\n */\n override async configure(opts?: IHealthCheckOptions): Promise<void> {\n // The base short-circuits a second call; binding before that check would swap the options\n // under routes that were already mounted from the first ones.\n if (this.isConfigured) {\n return;\n }\n\n if (opts !== undefined) {\n this.application.bind({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS }).toValue(opts);\n }\n\n await super.configure(opts);\n }\n\n override async binding(): Promise<void> {\n const healthOptions = this.application.get({\n key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,\n isOptional: true,\n });\n\n // A partially filled options binding (env/config driven) must not take the app down at boot.\n const path = healthOptions?.restOptions?.path ?? DEFAULT_REST_PATH;\n\n // Legal, occasionally correct, and silent until now: `stats.enable: true` bypasses the\n // environment gate, so the same code that opened the route for a local run opens it in\n // production. Warn rather than refuse - only the operator knows whether the port is reachable.\n if (healthOptions && HealthCheckReporter.isStatsUnguarded({ options: healthOptions })) {\n this.logger\n .for(this.binding.name)\n .warn(\n 'GET %s/stats is ENABLED with no secretKey on env \"%s\" - build stamp, runtime version and memory are readable by anything that reaches this port. Set stats.secretKey, or drop stats.enable and let the environment decide.',\n path,\n Environment.ambient ?? 'unset',\n );\n }\n\n // `getAppInfo()` is async while the container builds the controller synchronously, so the\n // resolved value is bound here rather than resolved inside the controller.\n const binding = this.application.bind({\n key: HealthCheckBindingKeys.APPLICATION_INFO,\n });\n const appInfo = await this.application.getAppInfo();\n binding.toValue(appInfo);\n\n // The gate and the app identity are per container, but `@controller` writes the PATH onto this\n // one shared class in the process-wide MetadataRegistry, and `RestComponent` reads it back at\n // step 8. Two applications booted one after another are safe; two booted CONCURRENTLY with\n // different `restOptions.path` would race here, and nothing in this component prevents that.\n Reflect.decorate([controller({ path })], HealthCheckController);\n this.application.controller(HealthCheckController);\n }\n}\n"]}
|
|
@@ -5,38 +5,58 @@ export declare class MailDefaults {
|
|
|
5
5
|
static readonly FALLBACK_FROM = "noreply@example.com";
|
|
6
6
|
/** Bytes of attachment content one message may carry, all attachments together. */
|
|
7
7
|
static readonly MAX_ATTACHMENT_BYTES: number;
|
|
8
|
+
/** The subject of a template mail that has none of its own. */
|
|
9
|
+
static readonly SUBJECT = "No Subject";
|
|
10
|
+
/** Tries per queued mail, the first included, unless the job options say otherwise. */
|
|
11
|
+
static readonly ATTEMPTS = 3;
|
|
12
|
+
static readonly BACKOFF_DELAY_MS = 1000;
|
|
13
|
+
/** How long a failed BullMQ mail job stays in Redis (it holds a recipient address), and the most that stay. */
|
|
14
|
+
static readonly FAILED_JOB_RETENTION: {
|
|
15
|
+
age: number;
|
|
16
|
+
count: number;
|
|
17
|
+
};
|
|
8
18
|
}
|
|
9
|
-
/**
|
|
19
|
+
/** Where a rendered template is going: `HTML` escapes every double-brace placeholder, `TEXT` (a subject, a plain-text part) inserts it as it is. A triple-brace placeholder is raw in both. */
|
|
20
|
+
export declare class MailTemplateFormats {
|
|
21
|
+
static readonly HTML = "html";
|
|
22
|
+
static readonly TEXT = "text";
|
|
23
|
+
}
|
|
24
|
+
/** Union of the `MailTemplateFormats` values. */
|
|
25
|
+
export type TMailTemplateFormat = TConstValue<typeof MailTemplateFormats>;
|
|
26
|
+
/** What a template does with a placeholder the data does not have: `EMPTY` renders nothing, `KEEP` leaves the tag as written, `THROW` refuses the render. */
|
|
27
|
+
export declare class MailTemplateMissingModes {
|
|
28
|
+
static readonly EMPTY = "empty";
|
|
29
|
+
static readonly KEEP = "keep";
|
|
30
|
+
static readonly THROW = "throw";
|
|
31
|
+
}
|
|
32
|
+
/** Union of the `MailTemplateMissingModes` values. */
|
|
33
|
+
export type TMailTemplateMissing = TConstValue<typeof MailTemplateMissingModes>;
|
|
34
|
+
/** Names of the jobs the BullMQ mail executor adds. */
|
|
35
|
+
export declare class MailQueueJobNames {
|
|
36
|
+
static readonly SEND_VERIFICATION_EMAIL = "send-verification-email";
|
|
37
|
+
}
|
|
38
|
+
/** The codes of the server-side failures, which are not in the 4xx `MailErrors` catalog. Built via {@link MessageCode.build}: `ApplicationError` lower-cases codes, so a SCREAMING_CASE literal would reach the client in a spelling no const here matches. */
|
|
10
39
|
export declare class MailErrorCodes {
|
|
11
|
-
static readonly INVALID_CONFIGURATION: string;
|
|
12
40
|
static readonly SEND_FAILED: string;
|
|
13
41
|
static readonly VERIFICATION_FAILED: string;
|
|
14
|
-
static readonly INVALID_RECIPIENT: string;
|
|
15
42
|
static readonly BATCH_SEND_FAILED: string;
|
|
16
|
-
static readonly TEMPLATE_NOT_FOUND: string;
|
|
17
|
-
static readonly ATTACHMENT_PATH_REFUSED: string;
|
|
18
|
-
static readonly ATTACHMENT_TOO_LARGE: string;
|
|
19
|
-
static readonly BODY_SOURCE_REFUSED: string;
|
|
20
43
|
}
|
|
21
44
|
/** Messages thrown by the mail queue executors. */
|
|
22
45
|
export declare class MailExecutorErrors {
|
|
23
46
|
static readonly PROCESSOR_NOT_SET = "Processor not set. Call setProcessor() first.";
|
|
47
|
+
static readonly CLOSED = "The executor is closed and takes no more jobs.";
|
|
24
48
|
}
|
|
25
|
-
/** Values of `
|
|
49
|
+
/** Values of `TMailQueueExecutorConfig.type`, selecting how verification mails are queued: sent inline, held in process, or handed to BullMQ. */
|
|
26
50
|
export declare class MailQueueExecutorTypes {
|
|
27
51
|
static readonly DIRECT = "direct";
|
|
28
52
|
static readonly INTERNAL_QUEUE = "internal-queue";
|
|
29
53
|
static readonly BULLMQ = "bullmq";
|
|
30
|
-
static readonly SCHEME_SET: Set<string>;
|
|
31
|
-
static isValid(value: string): boolean;
|
|
32
54
|
}
|
|
33
55
|
/** Values of `IBullMQMailExecutorOpts.mode`: `queue-only` enqueues jobs without starting workers, `worker-only` starts workers without a queue, `both` does each. */
|
|
34
56
|
export declare class BullMQExecutorModes {
|
|
35
57
|
static readonly QUEUE_ONLY = "queue-only";
|
|
36
58
|
static readonly WORKER_ONLY = "worker-only";
|
|
37
59
|
static readonly BOTH = "both";
|
|
38
|
-
static readonly MODE_SET: Set<string>;
|
|
39
|
-
static isValid(value: string): boolean;
|
|
40
60
|
}
|
|
41
61
|
/** Values of `TMailOptions.provider`, naming the transport the mail component builds. */
|
|
42
62
|
export declare class MailProviders {
|
|
@@ -51,8 +71,6 @@ export type TMailProvider = TConstValue<typeof MailProviders>;
|
|
|
51
71
|
export declare class MailBackoffTypes {
|
|
52
72
|
static readonly FIXED = "fixed";
|
|
53
73
|
static readonly EXPONENTIAL = "exponential";
|
|
54
|
-
static readonly SCHEME_SET: Set<string>;
|
|
55
|
-
static isValid(value: string): boolean;
|
|
56
74
|
}
|
|
57
75
|
/** Valid mail backoff type values. */
|
|
58
76
|
export type TMailBackoffType = TConstValue<typeof MailBackoffTypes>;
|
|
@@ -5,58 +5,55 @@ export class MailDefaults {
|
|
|
5
5
|
static { this.FALLBACK_FROM = 'noreply@example.com'; }
|
|
6
6
|
/** Bytes of attachment content one message may carry, all attachments together. */
|
|
7
7
|
static { this.MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024; }
|
|
8
|
+
/** The subject of a template mail that has none of its own. */
|
|
9
|
+
static { this.SUBJECT = 'No Subject'; }
|
|
10
|
+
/** Tries per queued mail, the first included, unless the job options say otherwise. */
|
|
11
|
+
static { this.ATTEMPTS = 3; }
|
|
12
|
+
static { this.BACKOFF_DELAY_MS = 1000; }
|
|
13
|
+
/** How long a failed BullMQ mail job stays in Redis (it holds a recipient address), and the most that stay. */
|
|
14
|
+
static { this.FAILED_JOB_RETENTION = { age: 7 * 24 * 60 * 60, count: 1000 }; }
|
|
8
15
|
}
|
|
9
|
-
/**
|
|
16
|
+
/** Where a rendered template is going: `HTML` escapes every double-brace placeholder, `TEXT` (a subject, a plain-text part) inserts it as it is. A triple-brace placeholder is raw in both. */
|
|
17
|
+
export class MailTemplateFormats {
|
|
18
|
+
static { this.HTML = 'html'; }
|
|
19
|
+
static { this.TEXT = 'text'; }
|
|
20
|
+
}
|
|
21
|
+
/** What a template does with a placeholder the data does not have: `EMPTY` renders nothing, `KEEP` leaves the tag as written, `THROW` refuses the render. */
|
|
22
|
+
export class MailTemplateMissingModes {
|
|
23
|
+
static { this.EMPTY = 'empty'; }
|
|
24
|
+
static { this.KEEP = 'keep'; }
|
|
25
|
+
static { this.THROW = 'throw'; }
|
|
26
|
+
}
|
|
27
|
+
/** Names of the jobs the BullMQ mail executor adds. */
|
|
28
|
+
export class MailQueueJobNames {
|
|
29
|
+
static { this.SEND_VERIFICATION_EMAIL = 'send-verification-email'; }
|
|
30
|
+
}
|
|
31
|
+
/** The codes of the server-side failures, which are not in the 4xx `MailErrors` catalog. Built via {@link MessageCode.build}: `ApplicationError` lower-cases codes, so a SCREAMING_CASE literal would reach the client in a spelling no const here matches. */
|
|
10
32
|
export class MailErrorCodes {
|
|
11
|
-
static { this.INVALID_CONFIGURATION = MessageCode.build({
|
|
12
|
-
parts: ['core', 'mail', 'invalid_configuration'],
|
|
13
|
-
}); }
|
|
14
33
|
static { this.SEND_FAILED = MessageCode.build({ parts: ['core', 'mail', 'send_failed'] }); }
|
|
15
34
|
static { this.VERIFICATION_FAILED = MessageCode.build({
|
|
16
35
|
parts: ['core', 'mail', 'verification_failed'],
|
|
17
36
|
}); }
|
|
18
|
-
static { this.INVALID_RECIPIENT = MessageCode.build({
|
|
19
|
-
parts: ['core', 'mail', 'invalid_recipient'],
|
|
20
|
-
}); }
|
|
21
37
|
static { this.BATCH_SEND_FAILED = MessageCode.build({
|
|
22
38
|
parts: ['core', 'mail', 'batch_send_failed'],
|
|
23
39
|
}); }
|
|
24
|
-
static { this.TEMPLATE_NOT_FOUND = MessageCode.build({
|
|
25
|
-
parts: ['core', 'mail', 'template_not_found'],
|
|
26
|
-
}); }
|
|
27
|
-
static { this.ATTACHMENT_PATH_REFUSED = MessageCode.build({
|
|
28
|
-
parts: ['core', 'mail', 'attachment_path_refused'],
|
|
29
|
-
}); }
|
|
30
|
-
static { this.ATTACHMENT_TOO_LARGE = MessageCode.build({
|
|
31
|
-
parts: ['core', 'mail', 'attachment_too_large'],
|
|
32
|
-
}); }
|
|
33
|
-
static { this.BODY_SOURCE_REFUSED = MessageCode.build({
|
|
34
|
-
parts: ['core', 'mail', 'body_source_refused'],
|
|
35
|
-
}); }
|
|
36
40
|
}
|
|
37
41
|
/** Messages thrown by the mail queue executors. */
|
|
38
42
|
export class MailExecutorErrors {
|
|
39
43
|
static { this.PROCESSOR_NOT_SET = 'Processor not set. Call setProcessor() first.'; }
|
|
44
|
+
static { this.CLOSED = 'The executor is closed and takes no more jobs.'; }
|
|
40
45
|
}
|
|
41
|
-
/** Values of `
|
|
46
|
+
/** Values of `TMailQueueExecutorConfig.type`, selecting how verification mails are queued: sent inline, held in process, or handed to BullMQ. */
|
|
42
47
|
export class MailQueueExecutorTypes {
|
|
43
48
|
static { this.DIRECT = 'direct'; }
|
|
44
49
|
static { this.INTERNAL_QUEUE = 'internal-queue'; }
|
|
45
50
|
static { this.BULLMQ = 'bullmq'; }
|
|
46
|
-
static { this.SCHEME_SET = new Set([this.DIRECT, this.INTERNAL_QUEUE, this.BULLMQ]); }
|
|
47
|
-
static isValid(value) {
|
|
48
|
-
return this.SCHEME_SET.has(value);
|
|
49
|
-
}
|
|
50
51
|
}
|
|
51
52
|
/** Values of `IBullMQMailExecutorOpts.mode`: `queue-only` enqueues jobs without starting workers, `worker-only` starts workers without a queue, `both` does each. */
|
|
52
53
|
export class BullMQExecutorModes {
|
|
53
54
|
static { this.QUEUE_ONLY = 'queue-only'; }
|
|
54
55
|
static { this.WORKER_ONLY = 'worker-only'; }
|
|
55
56
|
static { this.BOTH = 'both'; }
|
|
56
|
-
static { this.MODE_SET = new Set([this.QUEUE_ONLY, this.WORKER_ONLY, this.BOTH]); }
|
|
57
|
-
static isValid(value) {
|
|
58
|
-
return this.MODE_SET.has(value);
|
|
59
|
-
}
|
|
60
57
|
}
|
|
61
58
|
/** Values of `TMailOptions.provider`, naming the transport the mail component builds. */
|
|
62
59
|
export class MailProviders {
|
|
@@ -70,9 +67,5 @@ export class MailProviders {
|
|
|
70
67
|
export class MailBackoffTypes {
|
|
71
68
|
static { this.FIXED = 'fixed'; }
|
|
72
69
|
static { this.EXPONENTIAL = 'exponential'; }
|
|
73
|
-
static { this.SCHEME_SET = new Set([this.FIXED, this.EXPONENTIAL]); }
|
|
74
|
-
static isValid(value) {
|
|
75
|
-
return this.SCHEME_SET.has(value);
|
|
76
|
-
}
|
|
77
70
|
}
|
|
78
71
|
//# sourceMappingURL=constants.js.map
|