@authup/server-core 1.0.0-beta.46 → 1.0.0-beta.47
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/LICENSE +661 -201
- package/README.md +3 -1
- package/dist/adapters/database/data-source/index.d.ts +0 -1
- package/dist/adapters/database/data-source/index.d.ts.map +1 -1
- package/dist/adapters/database/data-source/index.mjs +1 -2
- package/dist/adapters/database/domains/client/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/client/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/client-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/client-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-scope/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-scope/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-scope/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/client-scope/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/identity-provider/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-account/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-account/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-account/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/identity-provider-account/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.mjs +21 -45
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/permission/subscriber.mjs +28 -47
- package/dist/adapters/database/domains/permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/policy/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/policy/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/policy/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/policy-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/policy-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy-attribute/subscriber.mjs +24 -45
- package/dist/adapters/database/domains/policy-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/realm/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/realm/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/realm/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/realm/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/robot/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/robot-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/robot-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role/subscriber.mjs +21 -41
- package/dist/adapters/database/domains/role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role-attribute/subscriber.mjs +24 -45
- package/dist/adapters/database/domains/role-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/role-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/scope/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/scope/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/scope/subscriber.mjs +17 -43
- package/dist/adapters/database/domains/scope/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/user/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-attribute/subscriber.mjs +24 -43
- package/dist/adapters/database/domains/user-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/user-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/user-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/index.d.ts +1 -0
- package/dist/adapters/database/index.d.ts.map +1 -1
- package/dist/adapters/database/index.mjs +3 -2
- package/dist/adapters/database/subscriber/index.d.ts +3 -0
- package/dist/adapters/database/subscriber/index.d.ts.map +1 -0
- package/dist/adapters/database/subscriber/index.mjs +5 -0
- package/dist/adapters/database/subscriber/module.d.ts +19 -0
- package/dist/adapters/database/subscriber/module.d.ts.map +1 -0
- package/dist/adapters/database/subscriber/module.mjs +70 -0
- package/dist/adapters/database/subscriber/module.mjs.map +1 -0
- package/dist/adapters/database/subscriber/types.d.ts +15 -0
- package/dist/adapters/database/subscriber/types.d.ts.map +1 -0
- package/dist/adapters/database/subscriber/types.mjs +4 -0
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/activate/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/activate/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/activate/module.mjs +20 -1
- package/dist/adapters/http/controllers/workflows/activate/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +16 -37
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs +23 -2
- package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.mjs +21 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/register/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/register/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/register/module.mjs +23 -2
- package/dist/adapters/http/controllers/workflows/register/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/status/module.d.ts +11 -4
- package/dist/adapters/http/controllers/workflows/status/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/status/module.mjs +17 -5
- package/dist/adapters/http/controllers/workflows/status/module.mjs.map +1 -1
- package/dist/adapters/http/index.mjs +4 -1
- package/dist/adapters/http/middleware/built-in/cors.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/cors.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/error.d.ts +6 -1
- package/dist/adapters/http/middleware/built-in/error.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/error.mjs +2 -3
- package/dist/adapters/http/middleware/built-in/error.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.d.ts +1 -0
- package/dist/adapters/http/middleware/built-in/index.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.mjs +2 -1
- package/dist/adapters/http/middleware/built-in/logger.d.ts +2 -0
- package/dist/adapters/http/middleware/built-in/logger.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/logger.mjs +1 -2
- package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +15 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts.map +1 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +25 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -0
- package/dist/adapters/http/middleware/index.mjs +2 -1
- package/dist/adapters/http/request/helpers/index.d.ts +2 -0
- package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
- package/dist/adapters/http/request/helpers/index.mjs +3 -1
- package/dist/adapters/http/request/helpers/locale.d.ts +14 -0
- package/dist/adapters/http/request/helpers/locale.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/locale.mjs +32 -0
- package/dist/adapters/http/request/helpers/locale.mjs.map +1 -0
- package/dist/adapters/http/request/helpers/locations.mjs +1 -1
- package/dist/adapters/http/request/helpers/redirect.d.ts +14 -0
- package/dist/adapters/http/request/helpers/redirect.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/redirect.mjs +36 -0
- package/dist/adapters/http/request/helpers/redirect.mjs.map +1 -0
- package/dist/adapters/http/request/index.mjs +3 -1
- package/dist/adapters/http/ui/base-path.d.ts +9 -0
- package/dist/adapters/http/ui/base-path.d.ts.map +1 -0
- package/dist/adapters/http/ui/base-path.mjs +18 -0
- package/dist/adapters/http/ui/base-path.mjs.map +1 -0
- package/dist/adapters/http/ui/index.d.ts +5 -0
- package/dist/adapters/http/ui/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/index.mjs +7 -0
- package/dist/adapters/http/ui/render.d.ts +4 -0
- package/dist/adapters/http/ui/render.d.ts.map +1 -0
- package/dist/adapters/http/ui/render.mjs +60 -0
- package/dist/adapters/http/ui/render.mjs.map +1 -0
- package/dist/adapters/http/ui/serve.d.ts +16 -0
- package/dist/adapters/http/ui/serve.d.ts.map +1 -0
- package/dist/adapters/http/ui/serve.mjs +32 -0
- package/dist/adapters/http/ui/serve.mjs.map +1 -0
- package/dist/adapters/http/ui/types.d.ts +8 -0
- package/dist/adapters/http/ui/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/types.mjs +4 -0
- package/dist/app/index.mjs +3 -2
- package/dist/app/modules/config/constants.d.ts +1 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +1 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/index.d.ts +1 -0
- package/dist/app/modules/config/index.d.ts.map +1 -1
- package/dist/app/modules/config/index.mjs +2 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +9 -2
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/origins.d.ts +10 -0
- package/dist/app/modules/config/origins.d.ts.map +1 -0
- package/dist/app/modules/config/origins.mjs +21 -0
- package/dist/app/modules/config/origins.mjs.map +1 -0
- package/dist/app/modules/config/parse.d.ts.map +1 -1
- package/dist/app/modules/config/parse.mjs +1 -0
- package/dist/app/modules/config/parse.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +2 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +14 -0
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/database/constants.d.ts +2 -0
- package/dist/app/modules/database/constants.d.ts.map +1 -1
- package/dist/app/modules/database/constants.mjs +4 -1
- package/dist/app/modules/database/constants.mjs.map +1 -1
- package/dist/app/modules/database/module.d.ts +5 -1
- package/dist/app/modules/database/module.d.ts.map +1 -1
- package/dist/app/modules/database/module.mjs +26 -15
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/http/constants.d.ts +11 -0
- package/dist/app/modules/http/constants.d.ts.map +1 -1
- package/dist/app/modules/http/constants.mjs +12 -1
- package/dist/app/modules/http/constants.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +5 -1
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +75 -10
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.d.ts +2 -1
- package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +19 -4
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +4 -4
- package/dist/app/modules/identity/module.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/account/module.d.ts +3 -1
- package/dist/app/modules/identity/repositories/provider/account/module.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/account/module.mjs +6 -3
- package/dist/app/modules/identity/repositories/provider/account/module.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/permission.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/permission.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/permission.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/permission.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/role.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/role.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/role.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/role.mjs.map +1 -1
- package/dist/app/modules/index.mjs +3 -2
- package/dist/app/modules/logger/module.d.ts.map +1 -1
- package/dist/app/modules/logger/module.mjs +1 -5
- package/dist/app/modules/logger/module.mjs.map +1 -1
- package/dist/app/modules/mail/constants.d.ts +2 -1
- package/dist/app/modules/mail/constants.d.ts.map +1 -1
- package/dist/app/modules/mail/constants.mjs +2 -1
- package/dist/app/modules/mail/constants.mjs.map +1 -1
- package/dist/app/modules/mail/index.mjs +2 -2
- package/dist/app/modules/mail/module.d.ts.map +1 -1
- package/dist/app/modules/mail/module.mjs +4 -1
- package/dist/app/modules/mail/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/module.d.ts.map +1 -1
- package/dist/app/modules/oauth2/module.mjs +3 -1
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts +3 -0
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/key/repository.mjs +5 -2
- package/dist/app/modules/oauth2/repositories/key/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +12 -0
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/core/entities/client/index.d.ts +1 -0
- package/dist/core/entities/client/index.d.ts.map +1 -1
- package/dist/core/entities/client/index.mjs +2 -1
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +3 -2
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/types.d.ts +11 -1
- package/dist/core/entities/client/types.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.d.ts +34 -0
- package/dist/core/entities/client/web-client.d.ts.map +1 -0
- package/dist/core/entities/client/web-client.mjs +62 -0
- package/dist/core/entities/client/web-client.mjs.map +1 -0
- package/dist/core/entities/index.mjs +2 -1
- package/dist/core/entities/realm/service.d.ts +6 -1
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +9 -0
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/identity/index.d.ts +1 -0
- package/dist/core/identity/index.d.ts.map +1 -1
- package/dist/core/identity/index.mjs +2 -1
- package/dist/core/identity/password-recovery/constants.d.ts +6 -0
- package/dist/core/identity/password-recovery/constants.d.ts.map +1 -0
- package/dist/core/identity/password-recovery/constants.mjs +12 -0
- package/dist/core/identity/password-recovery/constants.mjs.map +1 -0
- package/dist/core/identity/password-recovery/index.d.ts +1 -0
- package/dist/core/identity/password-recovery/index.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/index.mjs +2 -1
- package/dist/core/identity/password-recovery/service.d.ts +4 -2
- package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +17 -6
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/types.d.ts +5 -2
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/registration/service.d.ts +4 -2
- package/dist/core/identity/registration/service.d.ts.map +1 -1
- package/dist/core/identity/registration/service.mjs +15 -6
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +5 -2
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/identity/role/module.d.ts.map +1 -1
- package/dist/core/identity/role/module.mjs +1 -1
- package/dist/core/identity/role/module.mjs.map +1 -1
- package/dist/core/identity/types.d.ts +10 -0
- package/dist/core/identity/types.d.ts.map +1 -0
- package/dist/core/identity/types.mjs +4 -0
- package/dist/core/index.mjs +8 -1
- package/dist/core/mail/format/blocks.d.ts +12 -0
- package/dist/core/mail/format/blocks.d.ts.map +1 -0
- package/dist/core/mail/format/blocks.mjs +47 -0
- package/dist/core/mail/format/blocks.mjs.map +1 -0
- package/dist/core/mail/format/html.d.ts +9 -0
- package/dist/core/mail/format/html.d.ts.map +1 -0
- package/dist/core/mail/format/html.mjs +41 -0
- package/dist/core/mail/format/html.mjs.map +1 -0
- package/dist/core/mail/format/index.d.ts +5 -0
- package/dist/core/mail/format/index.d.ts.map +1 -0
- package/dist/core/mail/format/index.mjs +7 -0
- package/dist/core/mail/format/text.d.ts +3 -0
- package/dist/core/mail/format/text.d.ts.map +1 -0
- package/dist/core/mail/format/text.mjs +20 -0
- package/dist/core/mail/format/text.mjs.map +1 -0
- package/dist/core/mail/format/types.d.ts +30 -0
- package/dist/core/mail/format/types.d.ts.map +1 -0
- package/dist/core/mail/format/types.mjs +4 -0
- package/dist/core/mail/index.d.ts +3 -0
- package/dist/core/mail/index.d.ts.map +1 -1
- package/dist/core/mail/index.mjs +6 -1
- package/dist/core/mail/renderer.d.ts +10 -0
- package/dist/core/mail/renderer.d.ts.map +1 -0
- package/dist/core/mail/renderer.mjs +49 -0
- package/dist/core/mail/renderer.mjs.map +1 -0
- package/dist/core/mail/template/define.d.ts +7 -0
- package/dist/core/mail/template/define.d.ts.map +1 -0
- package/dist/core/mail/template/define.mjs +14 -0
- package/dist/core/mail/template/define.mjs.map +1 -0
- package/dist/core/mail/template/index.d.ts +4 -0
- package/dist/core/mail/template/index.d.ts.map +1 -0
- package/dist/core/mail/template/index.mjs +7 -0
- package/dist/core/mail/template/registry.d.ts +6 -0
- package/dist/core/mail/template/registry.d.ts.map +1 -0
- package/dist/core/mail/template/registry.mjs +15 -0
- package/dist/core/mail/template/registry.mjs.map +1 -0
- package/dist/core/mail/template/templates/password-reset.d.ts +3 -0
- package/dist/core/mail/template/templates/password-reset.d.ts.map +1 -0
- package/dist/core/mail/template/templates/password-reset.mjs +36 -0
- package/dist/core/mail/template/templates/password-reset.mjs.map +1 -0
- package/dist/core/mail/template/templates/registration-activation.d.ts +3 -0
- package/dist/core/mail/template/templates/registration-activation.d.ts.map +1 -0
- package/dist/core/mail/template/templates/registration-activation.mjs +34 -0
- package/dist/core/mail/template/templates/registration-activation.mjs.map +1 -0
- package/dist/core/mail/template/types.d.ts +39 -0
- package/dist/core/mail/template/types.d.ts.map +1 -0
- package/dist/core/mail/template/types.mjs +13 -0
- package/dist/core/mail/template/types.mjs.map +1 -0
- package/dist/core/mail/types.d.ts +21 -0
- package/dist/core/mail/types.d.ts.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/swagger.json +98 -3
- package/dist/ui/client/.vite/ssr-manifest.json +49086 -874
- package/dist/ui/client/assets/asap-latin-400-normal-Dc37g3Il.woff +0 -0
- package/dist/ui/client/assets/asap-latin-400-normal-DnZ1MOsG.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-700-normal-Dqcopq14.woff +0 -0
- package/dist/ui/client/assets/asap-latin-700-normal-l2Y8pi-F.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-ext-400-normal-C-fcRdtE.woff +0 -0
- package/dist/ui/client/assets/asap-latin-ext-400-normal-DwYtpHbV.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-ext-700-normal-D00OESsZ.woff +0 -0
- package/dist/ui/client/assets/asap-latin-ext-700-normal-y8bo5aW5.woff2 +0 -0
- package/dist/ui/client/assets/asap-vietnamese-400-normal-DGyJlJLT.woff2 +0 -0
- package/dist/ui/client/assets/asap-vietnamese-400-normal-lfLaoF2x.woff +0 -0
- package/dist/ui/client/assets/asap-vietnamese-700-normal-B-e19ug5.woff +0 -0
- package/dist/ui/client/assets/asap-vietnamese-700-normal-D-SxY94i.woff2 +0 -0
- package/dist/ui/client/assets/index-BeXJgvKE.css +2 -0
- package/dist/ui/client/assets/index-CgLTRwpP.js +95 -0
- package/dist/ui/client/assets/nunito-cyrillic-300-normal-BPQV259B.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-300-normal-g5qSsvc0.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-400-normal-D1j0u8EH.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-400-normal-xAOo5cBP.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-600-normal-BUjmtIuu.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-600-normal-DJGQ2h05.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-700-normal-DP36NgGt.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-700-normal-DfHRUDv-.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-300-normal-BDHtqmCR.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-300-normal-ChMQLIrm.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-400-normal-CuPM9foi.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-400-normal-xaE7D4Sw.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-600-normal-CWPPjBOD.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-600-normal-vnfu4DTE.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-700-normal-BuR0mlCG.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-700-normal-DfoqN4Gs.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-300-normal-C3ZIKvzv.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-300-normal-COoPE5VN.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-400-normal-DKg4f3fz.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-400-normal-r8SDr6Up.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-600-normal-Br8yIETf.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-600-normal-Cd0eNu1l.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-700-normal-Dort48En.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-700-normal-OcDqTBcA.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-300-normal-D1SyVuPt.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-300-normal-DfqbmdMl.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-400-normal-CjMJVfGn.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-400-normal-i-8OOpdj.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-600-normal-BKUpuB78.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-600-normal-Dd9Zuxh1.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-700-normal-BWeMsAzO.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-700-normal-D4woHhbd.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-300-normal-DATld5Vw.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-300-normal-mLneKULB.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-400-normal-BHkVbP3T.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-400-normal-DtOtW02z.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-600-normal-BY8O6Cug.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-600-normal-DO1RqFw5.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-700-normal-C9SQsXvj.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-700-normal-Ch8EUCfz.woff2 +0 -0
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/server.js +2765 -540
- package/package.json +20 -17
- package/dist/adapters/database/data-source/singleton.d.ts +0 -5
- package/dist/adapters/database/data-source/singleton.d.ts.map +0 -1
- package/dist/adapters/database/data-source/singleton.mjs +0 -19
- package/dist/adapters/database/data-source/singleton.mjs.map +0 -1
- package/dist/adapters/database/event-publisher/index.d.ts +0 -2
- package/dist/adapters/database/event-publisher/index.d.ts.map +0 -1
- package/dist/adapters/database/event-publisher/index.mjs +0 -5
- package/dist/adapters/database/event-publisher/module.d.ts +0 -6
- package/dist/adapters/database/event-publisher/module.d.ts.map +0 -1
- package/dist/adapters/database/event-publisher/module.mjs +0 -25
- package/dist/adapters/database/event-publisher/module.mjs.map +0 -1
- package/dist/ui/client/assets/index-Cvz0JzBe.js +0 -95
- package/dist/ui/client/assets/index-DNeLkYQO.css +0 -1
|
@@ -15,5 +15,6 @@ import { createLoggerMiddleware } from "./built-in/logger.mjs";
|
|
|
15
15
|
import { registerPrometheusMiddleware } from "./built-in/prometheus.mjs";
|
|
16
16
|
import { registerRateLimitMiddleware } from "./built-in/rate-limit.mjs";
|
|
17
17
|
import { createSwaggerMiddleware } from "./built-in/swagger.mjs";
|
|
18
|
+
import { UI_HTTP_CLIENT_FACTORY_STORE_KEY, registerUIHttpClientMiddleware } from "./built-in/ui-http-client.mjs";
|
|
18
19
|
import "./built-in/index.mjs";
|
|
19
|
-
export { AuthorizationMiddleware, ForceLoggedInMiddleware, ForceUserLoggedInMiddleware, RealmResolverMiddleware, VITE_SERVER_STORE_KEY, createAuthorizationMiddleware, createLoggerMiddleware, createRealmResolverMiddleware, createSwaggerMiddleware, registerAssetsMiddleware, registerBasicMiddleware, registerCorsMiddleware, registerErrorMiddleware, registerPrometheusMiddleware, registerRateLimitMiddleware };
|
|
20
|
+
export { AuthorizationMiddleware, ForceLoggedInMiddleware, ForceUserLoggedInMiddleware, RealmResolverMiddleware, UI_HTTP_CLIENT_FACTORY_STORE_KEY, VITE_SERVER_STORE_KEY, createAuthorizationMiddleware, createLoggerMiddleware, createRealmResolverMiddleware, createSwaggerMiddleware, registerAssetsMiddleware, registerBasicMiddleware, registerCorsMiddleware, registerErrorMiddleware, registerPrometheusMiddleware, registerRateLimitMiddleware, registerUIHttpClientMiddleware };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './actor.ts';
|
|
2
2
|
export * from './body-realm-id.ts';
|
|
3
3
|
export * from './identity.ts';
|
|
4
|
+
export * from './locale.ts';
|
|
4
5
|
export * from './locations.ts';
|
|
5
6
|
export * from './param-id.ts';
|
|
6
7
|
export * from './realm-id.ts';
|
|
8
|
+
export * from './redirect.ts';
|
|
7
9
|
export * from './scopes.ts';
|
|
8
10
|
export * from './token.ts';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/http/request/helpers/index.ts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/http/request/helpers/index.ts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -4,9 +4,11 @@ import.meta.url;
|
|
|
4
4
|
import { RequestIdentity, isRequestIdentityMasterRealmMember, setRequestIdentity, useRequestIdentity, useRequestIdentityOrFail } from "./identity.mjs";
|
|
5
5
|
import { buildActorContext } from "./actor.mjs";
|
|
6
6
|
import { getBodyRealmID } from "./body-realm-id.mjs";
|
|
7
|
+
import { LOCALE_COOKIE, useRequestLocale } from "./locale.mjs";
|
|
7
8
|
import { readFromLocations } from "./locations.mjs";
|
|
8
9
|
import { getRequestParamID, getRequestStringParam, getRequestStringParamOrFail, useRequestParamID } from "./param-id.mjs";
|
|
9
10
|
import { applyRouteRealmIDToBody, getRequestRealmID, setRequestRealmID } from "./realm-id.mjs";
|
|
11
|
+
import { sanitizeRelativeRedirect } from "./redirect.mjs";
|
|
10
12
|
import { setRequestScopes, useRequestScopes } from "./scopes.mjs";
|
|
11
13
|
import { setRequestToken, useRequestToken } from "./token.mjs";
|
|
12
|
-
export { RequestIdentity, applyRouteRealmIDToBody, buildActorContext, getBodyRealmID, getRequestParamID, getRequestRealmID, getRequestStringParam, getRequestStringParamOrFail, isRequestIdentityMasterRealmMember, readFromLocations, setRequestIdentity, setRequestRealmID, setRequestScopes, setRequestToken, useRequestIdentity, useRequestIdentityOrFail, useRequestParamID, useRequestScopes, useRequestToken };
|
|
14
|
+
export { LOCALE_COOKIE, RequestIdentity, applyRouteRealmIDToBody, buildActorContext, getBodyRealmID, getRequestParamID, getRequestRealmID, getRequestStringParam, getRequestStringParamOrFail, isRequestIdentityMasterRealmMember, readFromLocations, sanitizeRelativeRedirect, setRequestIdentity, setRequestRealmID, setRequestScopes, setRequestToken, useRequestIdentity, useRequestIdentityOrFail, useRequestLocale, useRequestParamID, useRequestScopes, useRequestToken };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LocaleCode } from '@authup/i18n';
|
|
2
|
+
import type { IAppEvent } from 'routup';
|
|
3
|
+
export declare const LOCALE_COOKIE = "vc-locale";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the requester's preferred **authored** locale. The explicit UI
|
|
6
|
+
* locale cookie (`vc-locale`, written by @vuecs/locale) wins when it maps
|
|
7
|
+
* onto a supported catalog locale; `auto` and unsupported values fall
|
|
8
|
+
* through to the Accept-Language chain (routup-negotiated, q-ordered),
|
|
9
|
+
* which is walked for the first language authup ships — so
|
|
10
|
+
* `pt-BR, de;q=0.8` resolves to `de`, not the default. Returns undefined
|
|
11
|
+
* when nothing matches (callers fall back to the default locale).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useRequestLocale(event: IAppEvent): LocaleCode | undefined;
|
|
14
|
+
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/http/request/helpers/locale.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGxC,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAkBzE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { matchLocale } from "@authup/i18n";
|
|
5
|
+
import { getRequestAcceptableLanguages } from "routup";
|
|
6
|
+
import { useRequestCookie } from "@routup/basic/cookie";
|
|
7
|
+
//#region src/adapters/http/request/helpers/locale.ts
|
|
8
|
+
const LOCALE_COOKIE = "vc-locale";
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the requester's preferred **authored** locale. The explicit UI
|
|
11
|
+
* locale cookie (`vc-locale`, written by @vuecs/locale) wins when it maps
|
|
12
|
+
* onto a supported catalog locale; `auto` and unsupported values fall
|
|
13
|
+
* through to the Accept-Language chain (routup-negotiated, q-ordered),
|
|
14
|
+
* which is walked for the first language authup ships — so
|
|
15
|
+
* `pt-BR, de;q=0.8` resolves to `de`, not the default. Returns undefined
|
|
16
|
+
* when nothing matches (callers fall back to the default locale).
|
|
17
|
+
*/ function useRequestLocale(event) {
|
|
18
|
+
const cookie = useRequestCookie(event, LOCALE_COOKIE);
|
|
19
|
+
if (typeof cookie === "string") {
|
|
20
|
+
const matched = matchLocale(cookie);
|
|
21
|
+
if (matched) return matched;
|
|
22
|
+
}
|
|
23
|
+
const languages = getRequestAcceptableLanguages(event);
|
|
24
|
+
for (const language of languages) {
|
|
25
|
+
const matched = matchLocale(language);
|
|
26
|
+
if (matched) return matched;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { LOCALE_COOKIE, useRequestLocale };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=locale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.mjs","names":["matchLocale","useRequestCookie","getRequestAcceptableLanguages","LOCALE_COOKIE","useRequestLocale","event","cookie","matched","languages","language","undefined"],"sources":["../../../../../src/adapters/http/request/helpers/locale.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { LocaleCode } from '@authup/i18n';\nimport { matchLocale } from '@authup/i18n';\nimport { useRequestCookie } from '@routup/basic/cookie';\nimport type { IAppEvent } from 'routup';\nimport { getRequestAcceptableLanguages } from 'routup';\n\nexport const LOCALE_COOKIE = 'vc-locale';\n\n/**\n * Resolve the requester's preferred **authored** locale. The explicit UI\n * locale cookie (`vc-locale`, written by @vuecs/locale) wins when it maps\n * onto a supported catalog locale; `auto` and unsupported values fall\n * through to the Accept-Language chain (routup-negotiated, q-ordered),\n * which is walked for the first language authup ships — so\n * `pt-BR, de;q=0.8` resolves to `de`, not the default. Returns undefined\n * when nothing matches (callers fall back to the default locale).\n */\nexport function useRequestLocale(event: IAppEvent): LocaleCode | undefined {\n const cookie = useRequestCookie(event, LOCALE_COOKIE);\n if (typeof cookie === 'string') {\n const matched = matchLocale(cookie);\n if (matched) {\n return matched;\n }\n }\n\n const languages = getRequestAcceptableLanguages(event);\n for (const language of languages) {\n const matched = matchLocale(language);\n if (matched) {\n return matched;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;AAaA,MAAaG,gBAAgB;;;;;;;;;GAW7B,SAAgBC,iBAAiBC,OAAgB;CAC7C,MAAMC,SAASL,iBAAiBI,OAAOF,aAAAA;CACvC,IAAI,OAAOG,WAAW,UAAU;EAC5B,MAAMC,UAAUP,YAAYM,MAAAA;EAC5B,IAAIC,SACA,OAAOA;CAEf;CAEA,MAAMC,YAAYN,8BAA8BG,KAAAA;CAChD,KAAK,MAAMI,YAAYD,WAAW;EAC9B,MAAMD,UAAUP,YAAYS,QAAAA;EAC5B,IAAIF,SACA,OAAOA;CAEf;AAGJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { readRequestBody } from "@routup/basic/body";
|
|
5
4
|
import { useRequestCookies } from "@routup/basic/cookie";
|
|
5
|
+
import { readRequestBody } from "@routup/basic/body";
|
|
6
6
|
import { useRequestQuery } from "@routup/basic/query";
|
|
7
7
|
//#region src/adapters/http/request/helpers/locations.ts
|
|
8
8
|
async function readFromLocations(event, locations) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open-redirect guard for the `redirect` query parameter carried by the
|
|
3
|
+
* auth workflow pages: only same-origin relative paths pass through, so the
|
|
4
|
+
* value can be safely reflected into an anchor href / forwarded as a
|
|
5
|
+
* post-login destination.
|
|
6
|
+
*
|
|
7
|
+
* Rejects: non-strings, control/whitespace chars (browsers strip some,
|
|
8
|
+
* shifting where the URL authority begins), protocol-relative (`//host`),
|
|
9
|
+
* backslash variants (browsers normalise `\` → `/`), and any scheme
|
|
10
|
+
* (`javascript:`, `http:`) — both on the raw and once-decoded form so a
|
|
11
|
+
* percent-encoded separator (`%2f`, `%5c`) can't slip past.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeRelativeRedirect(input: unknown): string | undefined;
|
|
14
|
+
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../../../src/adapters/http/request/helpers/redirect.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAwC3E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/adapters/http/request/helpers/redirect.ts
|
|
5
|
+
/**
|
|
6
|
+
* Open-redirect guard for the `redirect` query parameter carried by the
|
|
7
|
+
* auth workflow pages: only same-origin relative paths pass through, so the
|
|
8
|
+
* value can be safely reflected into an anchor href / forwarded as a
|
|
9
|
+
* post-login destination.
|
|
10
|
+
*
|
|
11
|
+
* Rejects: non-strings, control/whitespace chars (browsers strip some,
|
|
12
|
+
* shifting where the URL authority begins), protocol-relative (`//host`),
|
|
13
|
+
* backslash variants (browsers normalise `\` → `/`), and any scheme
|
|
14
|
+
* (`javascript:`, `http:`) — both on the raw and once-decoded form so a
|
|
15
|
+
* percent-encoded separator (`%2f`, `%5c`) can't slip past.
|
|
16
|
+
*/ function sanitizeRelativeRedirect(input) {
|
|
17
|
+
if (typeof input !== "string" || input.length === 0) return;
|
|
18
|
+
if (/[\u0000-\u0020\u007f]/.test(input)) return;
|
|
19
|
+
let decoded;
|
|
20
|
+
try {
|
|
21
|
+
decoded = decodeURIComponent(input);
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (/[\u0000-\u001f\u007f]/.test(decoded)) return;
|
|
26
|
+
for (const candidate of [input, decoded]) {
|
|
27
|
+
if (!candidate.startsWith("/")) return;
|
|
28
|
+
if (candidate.length > 1 && (candidate[1] === "/" || candidate[1] === "\\")) return;
|
|
29
|
+
if (candidate.includes("\\")) return;
|
|
30
|
+
}
|
|
31
|
+
return input;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { sanitizeRelativeRedirect };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=redirect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.mjs","names":["sanitizeRelativeRedirect","input","length","undefined","test","decoded","decodeURIComponent","candidate","startsWith","includes"],"sources":["../../../../../src/adapters/http/request/helpers/redirect.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Open-redirect guard for the `redirect` query parameter carried by the\n * auth workflow pages: only same-origin relative paths pass through, so the\n * value can be safely reflected into an anchor href / forwarded as a\n * post-login destination.\n *\n * Rejects: non-strings, control/whitespace chars (browsers strip some,\n * shifting where the URL authority begins), protocol-relative (`//host`),\n * backslash variants (browsers normalise `\\` → `/`), and any scheme\n * (`javascript:`, `http:`) — both on the raw and once-decoded form so a\n * percent-encoded separator (`%2f`, `%5c`) can't slip past.\n */\nexport function sanitizeRelativeRedirect(input: unknown): string | undefined {\n if (typeof input !== 'string' || input.length === 0) {\n return undefined;\n }\n\n // Raw input: reject control chars AND whitespace (space/tab/newline) — a\n // raw space can shift where the URL authority begins.\n // eslint-disable-next-line no-control-regex\n if (/[\\u0000-\\u0020\\u007f]/.test(input)) {\n return undefined;\n }\n\n let decoded: string;\n try {\n decoded = decodeURIComponent(input);\n } catch {\n return undefined;\n }\n\n // Decoded form: reject C0 controls + DEL (CR/LF/NUL — the header-injection\n // vectors a `%0a`/`%0d` would smuggle past the raw check) but NOT space\n // (0x20), so a legitimate `%20` in the path still passes.\n // eslint-disable-next-line no-control-regex\n if (/[\\u0000-\\u001f\\u007f]/.test(decoded)) {\n return undefined;\n }\n\n for (const candidate of [input, decoded]) {\n if (!candidate.startsWith('/')) {\n return undefined;\n }\n if (candidate.length > 1 && (candidate[1] === '/' || candidate[1] === '\\\\')) {\n return undefined;\n }\n if (candidate.includes('\\\\')) {\n return undefined;\n }\n }\n\n return input;\n}\n"],"mappings":";;;;;;;;;;;;;;;GAmBA,SAAgBA,yBAAyBC,OAAc;CACnD,IAAI,OAAOA,UAAU,YAAYA,MAAMC,WAAW,GAC9C;CAMJ,IAAI,wBAAwBE,KAAKH,KAAAA,GAC7B;CAGJ,IAAII;CACJ,IAAI;EACAA,UAAUC,mBAAmBL,KAAAA;CACjC,QAAQ;EACJ;CACJ;CAMA,IAAI,wBAAwBG,KAAKC,OAAAA,GAC7B;CAGJ,KAAK,MAAME,aAAa,CAACN,OAAOI,OAAAA,GAAU;EACtC,IAAI,CAACE,UAAUC,WAAW,GAAA,GACtB;EAEJ,IAAID,UAAUL,SAAS,MAAMK,UAAU,OAAO,OAAOA,UAAU,OAAO,OAClE;EAEJ,IAAIA,UAAUE,SAAS,IAAA,GACnB;CAER;CAEA,OAAOR;AACX"}
|
|
@@ -6,12 +6,14 @@ import { setRequestPermissionEvaluator, useRequestPermissionEvaluator } from "./
|
|
|
6
6
|
import { RequestIdentity, isRequestIdentityMasterRealmMember, setRequestIdentity, useRequestIdentity, useRequestIdentityOrFail } from "./helpers/identity.mjs";
|
|
7
7
|
import { buildActorContext } from "./helpers/actor.mjs";
|
|
8
8
|
import { getBodyRealmID } from "./helpers/body-realm-id.mjs";
|
|
9
|
+
import { LOCALE_COOKIE, useRequestLocale } from "./helpers/locale.mjs";
|
|
9
10
|
import { readFromLocations } from "./helpers/locations.mjs";
|
|
10
11
|
import { getRequestParamID, getRequestStringParam, getRequestStringParamOrFail, useRequestParamID } from "./helpers/param-id.mjs";
|
|
11
12
|
import { applyRouteRealmIDToBody, getRequestRealmID, setRequestRealmID } from "./helpers/realm-id.mjs";
|
|
13
|
+
import { sanitizeRelativeRedirect } from "./helpers/redirect.mjs";
|
|
12
14
|
import { setRequestScopes, useRequestScopes } from "./helpers/scopes.mjs";
|
|
13
15
|
import { setRequestToken, useRequestToken } from "./helpers/token.mjs";
|
|
14
16
|
import "./helpers/index.mjs";
|
|
15
17
|
import { RequestPermissionEvaluator } from "./permission/module.mjs";
|
|
16
18
|
import "./permission/index.mjs";
|
|
17
|
-
export { RequestHandlerOperation, RequestIdentity, RequestPermissionEvaluator, applyRouteRealmIDToBody, buildActorContext, getBodyRealmID, getRequestParamID, getRequestRealmID, getRequestStringParam, getRequestStringParamOrFail, isRequestIdentityMasterRealmMember, readFromLocations, setRequestIdentity, setRequestPermissionEvaluator, setRequestRealmID, setRequestScopes, setRequestToken, useRequestIdentity, useRequestIdentityOrFail, useRequestParamID, useRequestPermissionEvaluator, useRequestScopes, useRequestToken };
|
|
19
|
+
export { LOCALE_COOKIE, RequestHandlerOperation, RequestIdentity, RequestPermissionEvaluator, applyRouteRealmIDToBody, buildActorContext, getBodyRealmID, getRequestParamID, getRequestRealmID, getRequestStringParam, getRequestStringParamOrFail, isRequestIdentityMasterRealmMember, readFromLocations, sanitizeRelativeRedirect, setRequestIdentity, setRequestPermissionEvaluator, setRequestRealmID, setRequestScopes, setRequestToken, useRequestIdentity, useRequestIdentityOrFail, useRequestLocale, useRequestParamID, useRequestPermissionEvaluator, useRequestScopes, useRequestToken };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite root-absolute /public/ asset references (script/link/preload tags
|
|
3
|
+
* emitted with the fixed vite base) so they carry the path prefix under which
|
|
4
|
+
* authup is publicly served (e.g. /auth/public/...). The reverse proxy is
|
|
5
|
+
* expected to strip the prefix before the request reaches authup, so the
|
|
6
|
+
* assets middleware keeps serving at /public.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rebasePublicAssetURLs(html: string, basePath: string): string;
|
|
9
|
+
//# sourceMappingURL=base-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-path.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/ui/base-path.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAI,MAAM,CAM7E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/adapters/http/ui/base-path.ts
|
|
5
|
+
/**
|
|
6
|
+
* Rewrite root-absolute /public/ asset references (script/link/preload tags
|
|
7
|
+
* emitted with the fixed vite base) so they carry the path prefix under which
|
|
8
|
+
* authup is publicly served (e.g. /auth/public/...). The reverse proxy is
|
|
9
|
+
* expected to strip the prefix before the request reaches authup, so the
|
|
10
|
+
* assets middleware keeps serving at /public.
|
|
11
|
+
*/ function rebasePublicAssetURLs(html, basePath) {
|
|
12
|
+
if (!basePath) return html;
|
|
13
|
+
return html.replace(/(src|href)="\/public\//g, `$1="${basePath}/public/`);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { rebasePublicAssetURLs };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=base-path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-path.mjs","names":["rebasePublicAssetURLs","html","basePath","replace"],"sources":["../../../../src/adapters/http/ui/base-path.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Rewrite root-absolute /public/ asset references (script/link/preload tags\n * emitted with the fixed vite base) so they carry the path prefix under which\n * authup is publicly served (e.g. /auth/public/...). The reverse proxy is\n * expected to strip the prefix before the request reaches authup, so the\n * assets middleware keeps serving at /public.\n */\nexport function rebasePublicAssetURLs(html: string, basePath: string) : string {\n if (!basePath) {\n return html;\n }\n\n return html.replace(/(src|href)=\"\\/public\\//g, `$1=\"${basePath}/public/`);\n}\n"],"mappings":";;;;;;;;;;GAcA,SAAgBA,sBAAsBC,MAAcC,UAAgB;CAChE,IAAI,CAACA,UACD,OAAOD;CAGX,OAAOA,KAAKE,QAAQ,2BAA2B,OAAOD,SAAS,SAAS;AAC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/ui/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { rebasePublicAssetURLs } from "./base-path.mjs";
|
|
5
|
+
import { renderUIPage } from "./render.mjs";
|
|
6
|
+
import { serveWorkflowPage } from "./serve.mjs";
|
|
7
|
+
export { rebasePublicAssetURLs, renderUIPage, serveWorkflowPage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/ui/render.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAQxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYlD,wBAAsB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAwE1F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { LOCALE_COOKIE } from "../request/helpers/locale.mjs";
|
|
5
|
+
import { UI_DIST_PATH, UI_SOURCE_PATH } from "../../../path.mjs";
|
|
6
|
+
import { VITE_SERVER_STORE_KEY } from "../middleware/built-in/assets.mjs";
|
|
7
|
+
import { UI_HTTP_CLIENT_FACTORY_STORE_KEY } from "../middleware/built-in/ui-http-client.mjs";
|
|
8
|
+
import "../middleware/index.mjs";
|
|
9
|
+
import { rebasePublicAssetURLs } from "./base-path.mjs";
|
|
10
|
+
import { getURLBasePath } from "@authup/kit";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { CodeTransformation, isCodeTransformation } from "typeorm-extension";
|
|
13
|
+
import { useRequestCookie } from "@routup/basic/cookie";
|
|
14
|
+
import { load } from "locter";
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
//#region src/adapters/http/ui/render.ts
|
|
17
|
+
const COLOR_MODE_COOKIE = "vc-color-mode";
|
|
18
|
+
let cachedHtml;
|
|
19
|
+
let cachedManifest;
|
|
20
|
+
let cachedRender;
|
|
21
|
+
async function renderUIPage(event, ctx) {
|
|
22
|
+
const isJIT = isCodeTransformation(CodeTransformation.JUST_IN_TIME);
|
|
23
|
+
const colorMode = useRequestCookie(event, COLOR_MODE_COOKIE);
|
|
24
|
+
ctx.payload.config.colorMode = colorMode;
|
|
25
|
+
const locale = useRequestCookie(event, LOCALE_COOKIE);
|
|
26
|
+
ctx.payload.config.locale = locale;
|
|
27
|
+
let html;
|
|
28
|
+
let manifest;
|
|
29
|
+
let render;
|
|
30
|
+
if (isJIT) {
|
|
31
|
+
const vite = event.store[VITE_SERVER_STORE_KEY];
|
|
32
|
+
html = await fs.promises.readFile(path.join(UI_SOURCE_PATH, "index.html"), "utf-8");
|
|
33
|
+
html = await vite.transformIndexHtml("/", html);
|
|
34
|
+
manifest = {};
|
|
35
|
+
render = (await vite.ssrLoadModule("/src/server.ts")).render;
|
|
36
|
+
} else {
|
|
37
|
+
html = cachedHtml ??= await fs.promises.readFile(path.join(UI_DIST_PATH, "client", "index.html"), "utf-8");
|
|
38
|
+
manifest = cachedManifest ??= JSON.parse(await fs.promises.readFile(path.join(UI_DIST_PATH, "client", ".vite", "ssr-manifest.json"), "utf-8"));
|
|
39
|
+
render = cachedRender ??= (await load(path.join(UI_DIST_PATH, "server", "server.js"))).render;
|
|
40
|
+
}
|
|
41
|
+
const httpClientFactory = event.store[UI_HTTP_CLIENT_FACTORY_STORE_KEY];
|
|
42
|
+
const [appHtml, preloadLinks] = await render({
|
|
43
|
+
url: ctx.url,
|
|
44
|
+
manifest,
|
|
45
|
+
payload: ctx.payload,
|
|
46
|
+
httpClient: httpClientFactory ? httpClientFactory() : void 0
|
|
47
|
+
});
|
|
48
|
+
let body = html.replace("<!--preload-links-->", preloadLinks).replace("<!--app-html-->", appHtml);
|
|
49
|
+
let htmlAttrs = "lang=\"en\"";
|
|
50
|
+
if (locale && /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]+)*$/.test(locale)) htmlAttrs = `lang="${locale}"`;
|
|
51
|
+
if (colorMode === "dark" || colorMode === "light") htmlAttrs += ` class="${colorMode}"`;
|
|
52
|
+
body = body.replace(/<html\b[^>]*>/i, `<html ${htmlAttrs}>`);
|
|
53
|
+
body = rebasePublicAssetURLs(body, getURLBasePath(ctx.payload.config.baseURL));
|
|
54
|
+
event.response.headers.set("content-type", "text/html; charset=utf-8");
|
|
55
|
+
return body;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { renderUIPage };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=render.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.mjs","names":["getURLBasePath","useRequestCookie","load","fs","path","CodeTransformation","isCodeTransformation","UI_DIST_PATH","UI_SOURCE_PATH","UI_HTTP_CLIENT_FACTORY_STORE_KEY","VITE_SERVER_STORE_KEY","LOCALE_COOKIE","rebasePublicAssetURLs","COLOR_MODE_COOKIE","cachedHtml","cachedManifest","cachedRender","renderUIPage","event","ctx","isJIT","JUST_IN_TIME","colorMode","payload","config","locale","html","manifest","render","vite","store","promises","readFile","join","transformIndexHtml","ssrLoadModule","JSON","parse","httpClientFactory","appHtml","preloadLinks","url","httpClient","undefined","body","replace","htmlAttrs","test","baseURL","response","headers","set"],"sources":["../../../../src/adapters/http/ui/render.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { getURLBasePath } from '@authup/kit';\nimport { useRequestCookie } from '@routup/basic/cookie';\nimport { load } from 'locter';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { IAppEvent } from 'routup';\nimport type { ViteDevServer } from 'vite';\nimport { CodeTransformation, isCodeTransformation } from 'typeorm-extension';\nimport type { IClient } from '@authup/core-http-kit';\nimport { UI_DIST_PATH, UI_SOURCE_PATH } from '../../../path.ts';\nimport { UI_HTTP_CLIENT_FACTORY_STORE_KEY, VITE_SERVER_STORE_KEY } from '../middleware/index.ts';\nimport { LOCALE_COOKIE } from '../request/helpers/locale.ts';\nimport { rebasePublicAssetURLs } from './base-path.ts';\nimport type { UIRenderContext } from './types.ts';\n\nconst COLOR_MODE_COOKIE = 'vc-color-mode';\n\n// Process-lifetime caches for the immutable production SSR assets. The dist\n// template, manifest and server bundle don't change after boot, so read them\n// once instead of per request (the auth/login routes are hot paths). The JIT\n// (dev) path deliberately re-reads so HMR keeps working.\nlet cachedHtml: string | undefined;\nlet cachedManifest: Record<string, any> | undefined;\nlet cachedRender: CallableFunction | undefined;\n\nexport async function renderUIPage(event: IAppEvent, ctx: UIRenderContext): Promise<string> {\n const isJIT = isCodeTransformation(CodeTransformation.JUST_IN_TIME);\n\n // Mirror @vuecs/nuxt's SSR plugins: resolve the cookies server-side so\n // the HTML shell already carries the `.dark`/`.light` class and lang\n // attribute (no flash) and the client app hydrates from the same values.\n const colorMode = useRequestCookie(event, COLOR_MODE_COOKIE);\n ctx.payload.config.colorMode = colorMode;\n\n const locale = useRequestCookie(event, LOCALE_COOKIE);\n ctx.payload.config.locale = locale;\n\n let html : string;\n let manifest : Record<string, any>;\n let render : CallableFunction;\n\n if (isJIT) {\n const vite = event.store[VITE_SERVER_STORE_KEY] as ViteDevServer;\n\n html = await fs.promises.readFile(\n path.join(UI_SOURCE_PATH, 'index.html'),\n 'utf-8',\n );\n html = await vite.transformIndexHtml('/', html);\n manifest = {};\n render = (await vite.ssrLoadModule('/src/server.ts')).render;\n } else {\n html = (cachedHtml ??= await fs.promises.readFile(\n path.join(UI_DIST_PATH, 'client', 'index.html'),\n 'utf-8',\n ));\n manifest = (cachedManifest ??= JSON.parse(await fs.promises.readFile(\n path.join(UI_DIST_PATH, 'client', '.vite', 'ssr-manifest.json'),\n 'utf-8',\n )));\n render = (cachedRender ??= (await load(\n path.join(UI_DIST_PATH, 'server', 'server.js'),\n )).render);\n }\n\n const httpClientFactory = event.store[UI_HTTP_CLIENT_FACTORY_STORE_KEY] as (() => IClient) | undefined;\n\n const [appHtml, preloadLinks] = await render({\n url: ctx.url,\n manifest,\n payload: ctx.payload,\n httpClient: httpClientFactory ? httpClientFactory() : undefined,\n });\n\n let body = html\n .replace('<!--preload-links-->', preloadLinks)\n .replace('<!--app-html-->', appHtml);\n\n let htmlAttrs = 'lang=\"en\"';\n if (locale && /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]+)*$/.test(locale)) {\n htmlAttrs = `lang=\"${locale}\"`;\n }\n if (colorMode === 'dark' || colorMode === 'light') {\n htmlAttrs += ` class=\"${colorMode}\"`;\n }\n // Match the opening <html> tag by pattern rather than an exact literal,\n // so a reformatted tag / dev-mode transformIndexHtml rewrite still gets\n // the lang + color-mode attributes (no silent FOUC).\n body = body.replace(/<html\\b[^>]*>/i, `<html ${htmlAttrs}>`);\n\n // When authup is publicly served under a sub-path (publicUrl carries a\n // pathname, e.g. https://example.com/auth), the fixed /public/ vite base\n // would bypass the proxy mapping — rebase asset URLs onto the prefix.\n body = rebasePublicAssetURLs(body, getURLBasePath(ctx.payload.config.baseURL));\n\n event.response.headers.set('content-type', 'text/html; charset=utf-8');\n return body;\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAMa,oBAAoB;AAM1B,IAAIC;AACJ,IAAIC;AACJ,IAAIC;AAEJ,eAAsBC,aAAaC,OAAkBC,KAAoB;CACrE,MAAMC,QAAQd,qBAAqBD,mBAAmBgB,YAAY;CAKlE,MAAMC,YAAYrB,iBAAiBiB,OAAOL,iBAAAA;CAC1CM,IAAII,QAAQC,OAAOF,YAAYA;CAE/B,MAAMG,SAASxB,iBAAiBiB,OAAOP,aAAAA;CACvCQ,IAAII,QAAQC,OAAOC,SAASA;CAE5B,IAAIC;CACJ,IAAIC;CACJ,IAAIC;CAEJ,IAAIR,OAAO;EACP,MAAMS,OAAOX,MAAMY,MAAMpB;EAEzBgB,OAAO,MAAMvB,GAAG4B,SAASC,SACrB5B,KAAK6B,KAAKzB,gBAAgB,YAAA,GAC1B,OAAA;EAEJkB,OAAO,MAAMG,KAAKK,mBAAmB,KAAKR,IAAAA;EAC1CC,WAAW,CAAC;EACZC,UAAU,MAAMC,KAAKM,cAAc,gBAAA,EAAA,CAAmBP;CAC1D,OAAO;EACHF,OAAQZ,eAAe,MAAMX,GAAG4B,SAASC,SACrC5B,KAAK6B,KAAK1B,cAAc,UAAU,YAAA,GAClC,OAAA;EAEJoB,WAAYZ,mBAAmBqB,KAAKC,MAAM,MAAMlC,GAAG4B,SAASC,SACxD5B,KAAK6B,KAAK1B,cAAc,UAAU,SAAS,mBAAA,GAC3C,OAAA,CAAA;EAEJqB,SAAUZ,kBAAkB,MAAMd,KAC9BE,KAAK6B,KAAK1B,cAAc,UAAU,WAAA,CAAA,EAAA,CACnCqB;CACP;CAEA,MAAMU,oBAAoBpB,MAAMY,MAAMrB;CAEtC,MAAM,CAAC8B,SAASC,gBAAgB,MAAMZ,OAAO;EACzCa,KAAKtB,IAAIsB;EACTd;EACAJ,SAASJ,IAAII;EACbmB,YAAYJ,oBAAoBA,kBAAAA,IAAsBK,KAAAA;CAC1D,CAAA;CAEA,IAAIC,OAAOlB,KACNmB,QAAQ,wBAAwBL,YAAAA,CAAAA,CAChCK,QAAQ,mBAAmBN,OAAAA;CAEhC,IAAIO,YAAY;CAChB,IAAIrB,UAAU,kCAAkCsB,KAAKtB,MAAAA,GACjDqB,YAAY,SAASrB,OAAO;CAEhC,IAAIH,cAAc,UAAUA,cAAc,SACtCwB,aAAa,WAAWxB,UAAU;CAKtCsB,OAAOA,KAAKC,QAAQ,kBAAkB,SAASC,UAAU,EAAE;CAK3DF,OAAOhC,sBAAsBgC,MAAM5C,eAAemB,IAAII,QAAQC,OAAOwB,OAAO,CAAA;CAE5E9B,MAAM+B,SAASC,QAAQC,IAAI,gBAAgB,0BAAA;CAC3C,OAAOP;AACX"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StatusResponseFeatures } from '@authup/core-http-kit';
|
|
2
|
+
import type { IAppEvent } from 'routup';
|
|
3
|
+
export type ServeWorkflowPageOptions = {
|
|
4
|
+
url: string;
|
|
5
|
+
baseURL: string;
|
|
6
|
+
features: StatusResponseFeatures;
|
|
7
|
+
realmAware?: boolean;
|
|
8
|
+
tokenAware?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Single SSR payload-assembly path for the auth workflow GET routes:
|
|
12
|
+
* whitelists query params, applies the open-redirect guard, and renders.
|
|
13
|
+
* Keeps the four workflow controllers as thin POST adapters.
|
|
14
|
+
*/
|
|
15
|
+
export declare function serveWorkflowPage(event: IAppEvent, options: ServeWorkflowPageOptions): Promise<string>;
|
|
16
|
+
//# sourceMappingURL=serve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/ui/serve.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC,MAAM,MAAM,wBAAwB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,sBAAsB,CAAC;IAIjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { sanitizeRelativeRedirect } from "../request/helpers/redirect.mjs";
|
|
5
|
+
import "../request/index.mjs";
|
|
6
|
+
import { renderUIPage } from "./render.mjs";
|
|
7
|
+
import { useRequestQuery } from "@routup/basic/query";
|
|
8
|
+
//#region src/adapters/http/ui/serve.ts
|
|
9
|
+
/**
|
|
10
|
+
* Single SSR payload-assembly path for the auth workflow GET routes:
|
|
11
|
+
* whitelists query params, applies the open-redirect guard, and renders.
|
|
12
|
+
* Keeps the four workflow controllers as thin POST adapters.
|
|
13
|
+
*/ function serveWorkflowPage(event, options) {
|
|
14
|
+
const query = useRequestQuery(event);
|
|
15
|
+
const data = {
|
|
16
|
+
features: options.features,
|
|
17
|
+
redirect: sanitizeRelativeRedirect(query.redirect)
|
|
18
|
+
};
|
|
19
|
+
if (options.realmAware) data.realmId = typeof query.realm_id === "string" ? query.realm_id : void 0;
|
|
20
|
+
if (options.tokenAware) data.token = typeof query.token === "string" ? query.token : void 0;
|
|
21
|
+
return renderUIPage(event, {
|
|
22
|
+
url: options.url,
|
|
23
|
+
payload: {
|
|
24
|
+
config: { baseURL: options.baseURL },
|
|
25
|
+
data
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { serveWorkflowPage };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=serve.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.mjs","names":["useRequestQuery","sanitizeRelativeRedirect","renderUIPage","serveWorkflowPage","event","options","query","data","features","redirect","realmAware","realmId","realm_id","undefined","tokenAware","token","url","payload","config","baseURL"],"sources":["../../../../src/adapters/http/ui/serve.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { StatusResponseFeatures } from '@authup/core-http-kit';\nimport { useRequestQuery } from '@routup/basic/query';\nimport type { IAppEvent } from 'routup';\nimport { sanitizeRelativeRedirect } from '../request/index.ts';\nimport { renderUIPage } from './render.ts';\n\nexport type ServeWorkflowPageOptions = {\n url: string,\n baseURL: string,\n features: StatusResponseFeatures,\n // Whether the page consumes the `realm_id` / `token` query params (e.g.\n // prefill from an email deep link). Off by default so a page never\n // reflects a param it doesn't use.\n realmAware?: boolean,\n tokenAware?: boolean,\n};\n\n/**\n * Single SSR payload-assembly path for the auth workflow GET routes:\n * whitelists query params, applies the open-redirect guard, and renders.\n * Keeps the four workflow controllers as thin POST adapters.\n */\nexport function serveWorkflowPage(\n event: IAppEvent,\n options: ServeWorkflowPageOptions,\n): Promise<string> {\n const query = useRequestQuery(event);\n\n const data: Record<string, any> = {\n features: options.features,\n redirect: sanitizeRelativeRedirect(query.redirect),\n };\n\n if (options.realmAware) {\n data.realmId = typeof query.realm_id === 'string' ? query.realm_id : undefined;\n }\n\n if (options.tokenAware) {\n data.token = typeof query.token === 'string' ? query.token : undefined;\n }\n\n return renderUIPage(event, {\n url: options.url,\n payload: {\n config: { baseURL: options.baseURL },\n data,\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;GA6BA,SAAgBG,kBACZC,OACAC,SAAiC;CAEjC,MAAMC,QAAQN,gBAAgBI,KAAAA;CAE9B,MAAMG,OAA4B;EAC9BC,UAAUH,QAAQG;EAClBC,UAAUR,yBAAyBK,MAAMG,QAAQ;CACrD;CAEA,IAAIJ,QAAQK,YACRH,KAAKI,UAAU,OAAOL,MAAMM,aAAa,WAAWN,MAAMM,WAAWC,KAAAA;CAGzE,IAAIR,QAAQS,YACRP,KAAKQ,QAAQ,OAAOT,MAAMS,UAAU,WAAWT,MAAMS,QAAQF,KAAAA;CAGjE,OAAOX,aAAaE,OAAO;EACvBY,KAAKX,QAAQW;EACbC,SAAS;GACLC,QAAQ,EAAEC,SAASd,QAAQc,QAAQ;GACnCZ;EACJ;CACJ,CAAA;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/ui/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE;QACL,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL,CAAC"}
|
package/dist/app/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { CacheInjectionKey } from "./modules/cache/constants.mjs";
|
|
|
6
6
|
import { ModuleName } from "./modules/constants.mjs";
|
|
7
7
|
import { ConfigEnvironmentVariableName, ConfigInjectionKey } from "./modules/config/constants.mjs";
|
|
8
8
|
import { ConfigModule } from "./modules/config/module.mjs";
|
|
9
|
+
import { getAppOrigins } from "./modules/config/origins.mjs";
|
|
9
10
|
import { CacheModule } from "./modules/cache/module.mjs";
|
|
10
11
|
import { SessionRepository } from "./modules/authentication/repositories/session.mjs";
|
|
11
12
|
import { AuthenticationModule } from "./modules/authentication/module.mjs";
|
|
@@ -50,7 +51,7 @@ import { LDAPInjectionKey } from "./modules/ldap/constants.mjs";
|
|
|
50
51
|
import { LdapModule } from "./modules/ldap/module.mjs";
|
|
51
52
|
import { IdentityModule } from "./modules/identity/module.mjs";
|
|
52
53
|
import { OAuth2Module } from "./modules/oauth2/module.mjs";
|
|
53
|
-
import { MailInjectionKey } from "./modules/mail/constants.mjs";
|
|
54
|
+
import { MailInjectionKey, MailTemplateRendererInjectionKey } from "./modules/mail/constants.mjs";
|
|
54
55
|
import { MailModule } from "./modules/mail/module.mjs";
|
|
55
56
|
import { HTTPModule } from "./modules/http/module.mjs";
|
|
56
57
|
import { DefaultProvisioningSource } from "./modules/provisioning/sources/default/module.mjs";
|
|
@@ -61,4 +62,4 @@ import { RuntimeModule } from "./modules/runtime/module.mjs";
|
|
|
61
62
|
import "./modules/index.mjs";
|
|
62
63
|
import { ApplicationBuilder } from "./builder.mjs";
|
|
63
64
|
import { createApplication } from "./factory.mjs";
|
|
64
|
-
export { ApplicationBuilder, AuthenticationInjectionKey, AuthenticationModule, CacheInjectionKey, CacheModule, ClientIdentityRepository, ClientPermissionRepositoryAdapter, ClientRepositoryAdapter, ClientRoleRepositoryAdapter, ClientScopeRepositoryAdapter, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DatabaseInjectionKey, DatabaseModule, DefaultProvisioningSource, FileProvisioningSource, HTTPInjectionKey, HTTPModule, IdentityInjectionKey, IdentityModule, IdentityProviderAccountRepository, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, LDAPInjectionKey, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, ModuleName, OAuth2InjectionToken, OAuth2Module, PermissionDatabaseProvider, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PolicyRepositoryAdapter, ProvisionerModule, RealmRepositoryAdapter, RobotIdentityRepository, RobotPermissionRepositoryAdapter, RobotRepositoryAdapter, RobotRoleRepositoryAdapter, RoleAttributeRepositoryAdapter, RolePermissionRepositoryAdapter, RoleRepositoryAdapter, RuntimeModule, ScopeRepositoryAdapter, SessionRepository, UserAttributeRepositoryAdapter, UserIdentityRepository, UserPermissionRepositoryAdapter, UserRepositoryAdapter, UserRoleRepositoryAdapter, createApplication };
|
|
65
|
+
export { ApplicationBuilder, AuthenticationInjectionKey, AuthenticationModule, CacheInjectionKey, CacheModule, ClientIdentityRepository, ClientPermissionRepositoryAdapter, ClientRepositoryAdapter, ClientRoleRepositoryAdapter, ClientScopeRepositoryAdapter, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DatabaseInjectionKey, DatabaseModule, DefaultProvisioningSource, FileProvisioningSource, HTTPInjectionKey, HTTPModule, IdentityInjectionKey, IdentityModule, IdentityProviderAccountRepository, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, LDAPInjectionKey, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, MailTemplateRendererInjectionKey, ModuleName, OAuth2InjectionToken, OAuth2Module, PermissionDatabaseProvider, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PolicyRepositoryAdapter, ProvisionerModule, RealmRepositoryAdapter, RobotIdentityRepository, RobotPermissionRepositoryAdapter, RobotRepositoryAdapter, RobotRoleRepositoryAdapter, RoleAttributeRepositoryAdapter, RolePermissionRepositoryAdapter, RoleRepositoryAdapter, RuntimeModule, ScopeRepositoryAdapter, SessionRepository, UserAttributeRepositoryAdapter, UserIdentityRepository, UserPermissionRepositoryAdapter, UserRepositoryAdapter, UserRoleRepositoryAdapter, createApplication, getAppOrigins };
|
|
@@ -9,6 +9,7 @@ export declare enum ConfigEnvironmentVariableName {
|
|
|
9
9
|
HOST = "HOST",
|
|
10
10
|
PORT = "PORT",
|
|
11
11
|
PUBLIC_URL = "PUBLIC_URL",
|
|
12
|
+
ADDITIONAL_DOMAINS = "ADDITIONAL_DOMAINS",
|
|
12
13
|
TOKEN_ACCESS_MAX_AGE = "TOKEN_ACCESS_MAX_AGE",
|
|
13
14
|
TOKEN_REFRESH_MAX_AGE = "TOKEN_REFRESH_MAX_AGE",
|
|
14
15
|
REGISTRATION_ENABLED = "REGISTRATION_ENABLED",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/constants.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oBAAmC,CAAC;AAEnE,oBAAY,6BAA6B;IACrC,QAAQ,aAAa;IACrB,uBAAuB,4BAA4B;IAEnD,KAAK,UAAU;IACf,IAAI,SAAS;IAEb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IAEvD,iBAAiB,sBAAsB;IACvC,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IAEzD,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,yBAAyB,8BAA8B;IAEvD,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,wBAAwB,6BAA6B;IAErD,WAAW,gBAAgB;IAC3B,qCAAqC,0CAA0C;CAClF"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/constants.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oBAAmC,CAAC;AAEnE,oBAAY,6BAA6B;IACrC,QAAQ,aAAa;IACrB,uBAAuB,4BAA4B;IAEnD,KAAK,UAAU;IACf,IAAI,SAAS;IAEb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IAEvD,iBAAiB,sBAAsB;IACvC,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IAEzD,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;IAC3C,yBAAyB,8BAA8B;IAEvD,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,wBAAwB,6BAA6B;IAErD,WAAW,gBAAgB;IAC3B,qCAAqC,0CAA0C;CAClF"}
|
|
@@ -12,6 +12,7 @@ var ConfigEnvironmentVariableName = /*#__PURE__*/ function(ConfigEnvironmentVari
|
|
|
12
12
|
ConfigEnvironmentVariableName["HOST"] = "HOST";
|
|
13
13
|
ConfigEnvironmentVariableName["PORT"] = "PORT";
|
|
14
14
|
ConfigEnvironmentVariableName["PUBLIC_URL"] = "PUBLIC_URL";
|
|
15
|
+
ConfigEnvironmentVariableName["ADDITIONAL_DOMAINS"] = "ADDITIONAL_DOMAINS";
|
|
15
16
|
ConfigEnvironmentVariableName["TOKEN_ACCESS_MAX_AGE"] = "TOKEN_ACCESS_MAX_AGE";
|
|
16
17
|
ConfigEnvironmentVariableName["TOKEN_REFRESH_MAX_AGE"] = "TOKEN_REFRESH_MAX_AGE";
|
|
17
18
|
ConfigEnvironmentVariableName["REGISTRATION_ENABLED"] = "REGISTRATION_ENABLED";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":["TypedToken","ConfigInjectionKey","ConfigEnvironmentVariableName"],"sources":["../../../../src/app/modules/config/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { TypedToken } from 'eldin';\nimport type { Config } from './types.ts';\n\nexport const ConfigInjectionKey = new TypedToken<Config>('Config');\n\nexport enum ConfigEnvironmentVariableName {\n NODE_ENV = 'NODE_ENV',\n WRITABLE_DIRECTORY_PATH = 'WRITABLE_DIRECTORY_PATH',\n\n REDIS = 'REDIS',\n SMTP = 'SMTP',\n\n HOST = 'HOST',\n PORT = 'PORT',\n PUBLIC_URL = 'PUBLIC_URL',\n TOKEN_ACCESS_MAX_AGE = 'TOKEN_ACCESS_MAX_AGE',\n TOKEN_REFRESH_MAX_AGE = 'TOKEN_REFRESH_MAX_AGE',\n REGISTRATION_ENABLED = 'REGISTRATION_ENABLED',\n EMAIL_VERIFICATION_ENABLED = 'EMAIL_VERIFICATION_ENABLED',\n PASSWORD_RECOVERY_ENABLED = 'PASSWORD_RECOVERY_ENABLED',\n\n CLIENT_AUTH_BASIC = 'CLIENT_AUTH_BASIC',\n CLIENT_SYSTEM_ENABLED = 'CLIENT_SYSTEM_ENABLED',\n CLIENT_SYSTEM_SECRET = 'CLIENT_SYSTEM_SECRET',\n CLIENT_SYSTEM_SECRET_RESET = 'CLIENT_SYSTEM_SECRET_RESET',\n\n USER_AUTH_BASIC = 'USER_AUTH_BASIC',\n USER_ADMIN_ENABLED = 'USER_ADMIN_ENABLED',\n USER_ADMIN_PASSWORD = 'USER_ADMIN_PASSWORD',\n USER_ADMIN_PASSWORD_RESET = 'USER_ADMIN_PASSWORD_RESET',\n\n ROBOT_AUTH_BASIC = 'ROBOT_AUTH_BASIC',\n ROBOT_ADMIN_ENABLED = 'ROBOT_ADMIN_ENABLED',\n ROBOT_ADMIN_SECRET = 'ROBOT_ADMIN_SECRET',\n ROBOT_ADMIN_SECRET_RESET = 'ROBOT_ADMIN_SECRET_RESET',\n\n PERMISSIONS = 'PERMISSIONS',\n PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT = 'PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT',\n}\n"],"mappings":";;;;;AAUA,MAAaC,qBAAqB,IAAID,WAAmB,QAAA;AAEzD,IAAO,gCAAKE,uBAAAA,+BAAAA
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["TypedToken","ConfigInjectionKey","ConfigEnvironmentVariableName"],"sources":["../../../../src/app/modules/config/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { TypedToken } from 'eldin';\nimport type { Config } from './types.ts';\n\nexport const ConfigInjectionKey = new TypedToken<Config>('Config');\n\nexport enum ConfigEnvironmentVariableName {\n NODE_ENV = 'NODE_ENV',\n WRITABLE_DIRECTORY_PATH = 'WRITABLE_DIRECTORY_PATH',\n\n REDIS = 'REDIS',\n SMTP = 'SMTP',\n\n HOST = 'HOST',\n PORT = 'PORT',\n PUBLIC_URL = 'PUBLIC_URL',\n ADDITIONAL_DOMAINS = 'ADDITIONAL_DOMAINS',\n TOKEN_ACCESS_MAX_AGE = 'TOKEN_ACCESS_MAX_AGE',\n TOKEN_REFRESH_MAX_AGE = 'TOKEN_REFRESH_MAX_AGE',\n REGISTRATION_ENABLED = 'REGISTRATION_ENABLED',\n EMAIL_VERIFICATION_ENABLED = 'EMAIL_VERIFICATION_ENABLED',\n PASSWORD_RECOVERY_ENABLED = 'PASSWORD_RECOVERY_ENABLED',\n\n CLIENT_AUTH_BASIC = 'CLIENT_AUTH_BASIC',\n CLIENT_SYSTEM_ENABLED = 'CLIENT_SYSTEM_ENABLED',\n CLIENT_SYSTEM_SECRET = 'CLIENT_SYSTEM_SECRET',\n CLIENT_SYSTEM_SECRET_RESET = 'CLIENT_SYSTEM_SECRET_RESET',\n\n USER_AUTH_BASIC = 'USER_AUTH_BASIC',\n USER_ADMIN_ENABLED = 'USER_ADMIN_ENABLED',\n USER_ADMIN_PASSWORD = 'USER_ADMIN_PASSWORD',\n USER_ADMIN_PASSWORD_RESET = 'USER_ADMIN_PASSWORD_RESET',\n\n ROBOT_AUTH_BASIC = 'ROBOT_AUTH_BASIC',\n ROBOT_ADMIN_ENABLED = 'ROBOT_ADMIN_ENABLED',\n ROBOT_ADMIN_SECRET = 'ROBOT_ADMIN_SECRET',\n ROBOT_ADMIN_SECRET_RESET = 'ROBOT_ADMIN_SECRET_RESET',\n\n PERMISSIONS = 'PERMISSIONS',\n PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT = 'PERMISSIONS_DEFAULT_POLICY_ASSIGNMENT',\n}\n"],"mappings":";;;;;AAUA,MAAaC,qBAAqB,IAAID,WAAmB,QAAA;AAEzD,IAAO,gCAAKE,uBAAAA,+BAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -3,4 +3,5 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { ConfigEnvironmentVariableName, ConfigInjectionKey } from "./constants.mjs";
|
|
5
5
|
import { ConfigModule } from "./module.mjs";
|
|
6
|
-
|
|
6
|
+
import { getAppOrigins } from "./origins.mjs";
|
|
7
|
+
export { ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, getAppOrigins };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/normalize.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,eAAe,CAAC,KAAK,GAAE,WAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/normalize.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,eAAe,CAAC,KAAK,GAAE,WAAgB,GAAG,MAAM,CA0F/D"}
|
|
@@ -22,8 +22,14 @@ function normalizeConfig(input = {}) {
|
|
|
22
22
|
publicUrl = `http://${toPublicHost(host)}:${match[2] || port}`;
|
|
23
23
|
} else publicUrl = `http://${toPublicHost(host)}:${port}`;
|
|
24
24
|
}
|
|
25
|
+
const env = read("NODE_ENV", EnvironmentName.DEVELOPMENT);
|
|
26
|
+
const additionalDomains = [...parsed.additionalDomains ?? []];
|
|
27
|
+
if (env !== EnvironmentName.PRODUCTION) {
|
|
28
|
+
const devOrigin = "http://localhost:3000";
|
|
29
|
+
if (!additionalDomains.includes(devOrigin)) additionalDomains.push(devOrigin);
|
|
30
|
+
}
|
|
25
31
|
return {
|
|
26
|
-
env
|
|
32
|
+
env,
|
|
27
33
|
rootPath: process.cwd(),
|
|
28
34
|
writableDirectoryPath,
|
|
29
35
|
logger: true,
|
|
@@ -58,7 +64,8 @@ function normalizeConfig(input = {}) {
|
|
|
58
64
|
robotAdminSecretReset: false,
|
|
59
65
|
permissions: [],
|
|
60
66
|
permissionsDefaultPolicyAssignment: true,
|
|
61
|
-
...parsed
|
|
67
|
+
...parsed,
|
|
68
|
+
additionalDomains
|
|
62
69
|
};
|
|
63
70
|
}
|
|
64
71
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.mjs","names":["read","path","process","EnvironmentName","toPublicHost","parseConfig","normalizeConfig","input","parsed","writableDirectoryPath","join","cwd","port","host","publicUrl","regex","match","env","DEVELOPMENT","rootPath","logger","redis","smtp","middlewareBody","middlewareCookie","middlewareCors","middlewarePrometheus","middlewareQuery","middlewareRateLimit","middlewareSwagger","tokenRefreshMaxAge","tokenAccessMaxAge","registrationEnabled","emailVerificationEnabled","passwordRecoveryEnabled","clientAuthBasic","clientSystemEnabled","clientSystemSecret","clientSystemSecretReset","userAuthBasic","userAdminEnabled","userAdminPassword","userAdminPasswordReset","robotAuthBasic","robotAdminEnabled","robotAdminSecret","robotAdminSecretReset","permissions","permissionsDefaultPolicyAssignment"],"sources":["../../../../src/app/modules/config/normalize.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { read } from 'envix';\nimport path from 'node:path';\nimport process from 'node:process';\nimport { EnvironmentName } from '@authup/kit';\nimport { toPublicHost } from '../../../utils/host.ts';\nimport { parseConfig } from './parse.ts';\nimport type { Config, ConfigInput } from './types.ts';\n\nexport function normalizeConfig(input: ConfigInput = {}): Config {\n const parsed = parseConfig(input);\n\n const writableDirectoryPath = parsed.writableDirectoryPath ||\n path.join(process.cwd(), 'writable');\n\n const port = parsed.port || 3001;\n let host = parsed.host || '0.0.0.0';\n\n let publicUrl : string;\n if (parsed.publicUrl) {\n publicUrl = parsed.publicUrl;\n } else {\n const regex = /^([^:]+)(?::(\\d+))?$/;\n const match = host.match(regex);\n if (match) {\n [, host] = match;\n publicUrl = `http://${toPublicHost(host)}:${match[2] || port}`;\n } else {\n publicUrl = `http://${toPublicHost(host)}:${port}`;\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"normalize.mjs","names":["read","path","process","EnvironmentName","toPublicHost","parseConfig","normalizeConfig","input","parsed","writableDirectoryPath","join","cwd","port","host","publicUrl","regex","match","env","DEVELOPMENT","additionalDomains","PRODUCTION","devOrigin","includes","push","rootPath","logger","redis","smtp","middlewareBody","middlewareCookie","middlewareCors","middlewarePrometheus","middlewareQuery","middlewareRateLimit","middlewareSwagger","tokenRefreshMaxAge","tokenAccessMaxAge","registrationEnabled","emailVerificationEnabled","passwordRecoveryEnabled","clientAuthBasic","clientSystemEnabled","clientSystemSecret","clientSystemSecretReset","userAuthBasic","userAdminEnabled","userAdminPassword","userAdminPasswordReset","robotAuthBasic","robotAdminEnabled","robotAdminSecret","robotAdminSecretReset","permissions","permissionsDefaultPolicyAssignment"],"sources":["../../../../src/app/modules/config/normalize.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { read } from 'envix';\nimport path from 'node:path';\nimport process from 'node:process';\nimport { EnvironmentName } from '@authup/kit';\nimport { toPublicHost } from '../../../utils/host.ts';\nimport { parseConfig } from './parse.ts';\nimport type { Config, ConfigInput } from './types.ts';\n\nexport function normalizeConfig(input: ConfigInput = {}): Config {\n const parsed = parseConfig(input);\n\n const writableDirectoryPath = parsed.writableDirectoryPath ||\n path.join(process.cwd(), 'writable');\n\n const port = parsed.port || 3001;\n let host = parsed.host || '0.0.0.0';\n\n let publicUrl : string;\n if (parsed.publicUrl) {\n publicUrl = parsed.publicUrl;\n } else {\n const regex = /^([^:]+)(?::(\\d+))?$/;\n const match = host.match(regex);\n if (match) {\n [, host] = match;\n publicUrl = `http://${toPublicHost(host)}:${match[2] || port}`;\n } else {\n publicUrl = `http://${toPublicHost(host)}:${port}`;\n }\n }\n\n const env = read('NODE_ENV', EnvironmentName.DEVELOPMENT);\n\n // In non-production (development & test) client-web runs on :3000 while\n // the API (publicUrl) runs on :3001. Seed :3000 into the trusted origins\n // so the redirect allowlist (<origin>/**) and CORS accept logins from the\n // dev UI out of the box; otherwise the realm-selection login is dead on\n // first run.\n // Copy — never mutate the caller-supplied parsed array in place, or a\n // repeated normalizeConfig() on the same input accumulates the dev origin\n // into a security-sensitive allowlist.\n const additionalDomains = [...(parsed.additionalDomains ?? [])];\n if (env !== EnvironmentName.PRODUCTION) {\n const devOrigin = 'http://localhost:3000';\n if (!additionalDomains.includes(devOrigin)) {\n additionalDomains.push(devOrigin);\n }\n }\n\n return {\n env,\n rootPath: process.cwd(),\n writableDirectoryPath,\n\n logger: true,\n redis: false,\n smtp: false,\n\n port,\n host,\n publicUrl,\n\n middlewareBody: true,\n middlewareCookie: true,\n middlewareCors: true,\n middlewarePrometheus: true,\n middlewareQuery: true,\n middlewareRateLimit: true,\n middlewareSwagger: true,\n tokenRefreshMaxAge: 259_200,\n tokenAccessMaxAge: 3_600,\n registrationEnabled: false,\n emailVerificationEnabled: false,\n passwordRecoveryEnabled: false,\n\n clientAuthBasic: false,\n clientSystemEnabled: false,\n clientSystemSecret: 'start123',\n clientSystemSecretReset: false,\n\n userAuthBasic: false,\n userAdminEnabled: true,\n userAdminPassword: 'start123',\n userAdminPasswordReset: false,\n\n robotAuthBasic: false,\n robotAdminEnabled: false,\n robotAdminSecret: 'start123',\n robotAdminSecretReset: false,\n\n permissions: [],\n permissionsDefaultPolicyAssignment: true,\n ...parsed,\n\n // After the spread so the dev-seeded value wins over the raw\n // parsed list (parsed.additionalDomains is already merged in above).\n additionalDomains,\n };\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgBM,gBAAgBC,QAAqB,CAAC,GAAC;CACnD,MAAMC,SAASH,YAAYE,KAAAA;CAE3B,MAAME,wBAAwBD,OAAOC,yBACjCR,KAAKS,KAAKR,QAAQS,IAAG,GAAI,UAAA;CAE7B,MAAMC,OAAOJ,OAAOI,QAAQ;CAC5B,IAAIC,OAAOL,OAAOK,QAAQ;CAE1B,IAAIC;CACJ,IAAIN,OAAOM,WACPA,YAAYN,OAAOM;MAChB;EAEH,MAAME,QAAQH,KAAKG,MAAMD,sBAAAA;EACzB,IAAIC,OAAO;GACP,GAAGH,QAAQG;GACXF,YAAY,UAAUV,aAAaS,IAAAA,EAAM,GAAGG,MAAM,MAAMJ;EAC5D,OACIE,YAAY,UAAUV,aAAaS,IAAAA,EAAM,GAAGD;CAEpD;CAEA,MAAMK,MAAMjB,KAAK,YAAYG,gBAAgBe,WAAW;CAUxD,MAAMC,oBAAoB,CAAA,GAAKX,OAAOW,qBAAqB,CAAA,CAAA;CAC3D,IAAIF,QAAQd,gBAAgBiB,YAAY;EACpC,MAAMC,YAAY;EAClB,IAAI,CAACF,kBAAkBG,SAASD,SAAAA,GAC5BF,kBAAkBI,KAAKF,SAAAA;CAE/B;CAEA,OAAO;EACHJ;EACAO,UAAUtB,QAAQS,IAAG;EACrBF;EAEAgB,QAAQ;EACRC,OAAO;EACPC,MAAM;EAENf;EACAC;EACAC;EAEAc,gBAAgB;EAChBC,kBAAkB;EAClBC,gBAAgB;EAChBC,sBAAsB;EACtBC,iBAAiB;EACjBC,qBAAqB;EACrBC,mBAAmB;EACnBC,oBAAoB;EACpBC,mBAAmB;EACnBC,qBAAqB;EACrBC,0BAA0B;EAC1BC,yBAAyB;EAEzBC,iBAAiB;EACjBC,qBAAqB;EACrBC,oBAAoB;EACpBC,yBAAyB;EAEzBC,eAAe;EACfC,kBAAkB;EAClBC,mBAAmB;EACnBC,wBAAwB;EAExBC,gBAAgB;EAChBC,mBAAmB;EACnBC,kBAAkB;EAClBC,uBAAuB;EAEvBC,aAAa,CAAA;EACbC,oCAAoC;EACpC,GAAG7C;EAIHW;CACJ;AACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Derive the set of trusted application origins (scheme://host[:port]).
|
|
4
|
+
*
|
|
5
|
+
* publicUrl may carry a path; both the OAuth2 redirect allowlist and the
|
|
6
|
+
* CORS origin allowlist need bare origins, so extract the origin from each
|
|
7
|
+
* configured URL and de-duplicate.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAppOrigins(config: Pick<Config, 'publicUrl' | 'additionalDomains'>): string[];
|
|
10
|
+
//# sourceMappingURL=origins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../../../src/app/modules/config/origins.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,CAAC,GAAG,MAAM,EAAE,CAS/F"}
|