@authup/server-core 1.0.0-beta.57 → 1.0.0-beta.59
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/adapters/database/logger/module.mjs +2 -4
- package/dist/adapters/database/logger/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/index.mjs +2 -1
- package/dist/adapters/http/controllers/workflows/account/index.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/account/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/account/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/account/module.d.ts +24 -0
- package/dist/adapters/http/controllers/workflows/account/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/account/module.mjs +63 -0
- package/dist/adapters/http/controllers/workflows/account/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/workflows/activate/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +2 -2
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.d.ts +1 -0
- package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.mjs +3 -1
- package/dist/adapters/http/controllers/workflows/logout/module.mjs +2 -2
- package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/register/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/userinfo/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/userinfo/module.mjs +5 -1
- package/dist/adapters/http/controllers/workflows/userinfo/module.mjs.map +1 -1
- package/dist/adapters/http/index.mjs +3 -1
- package/dist/adapters/http/middleware/built-in/assets.d.ts +8 -1
- package/dist/adapters/http/middleware/built-in/assets.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/assets.mjs +48 -4
- package/dist/adapters/http/middleware/built-in/assets.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs +2 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.d.ts +2 -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/rate-limit.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/rate-limit.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/theme.d.ts +15 -0
- package/dist/adapters/http/middleware/built-in/theme.d.ts.map +1 -0
- package/dist/adapters/http/middleware/built-in/theme.mjs +27 -0
- package/dist/adapters/http/middleware/built-in/theme.mjs.map +1 -0
- package/dist/adapters/http/middleware/built-in/types.d.ts +14 -0
- package/dist/adapters/http/middleware/built-in/types.d.ts.map +1 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -1
- package/dist/adapters/http/middleware/index.mjs +2 -1
- package/dist/adapters/http/request/client-certificate.mjs +1 -1
- package/dist/adapters/http/request/client-certificate.mjs.map +1 -1
- package/dist/adapters/http/request/helpers/locations.mjs +1 -3
- package/dist/adapters/http/request/helpers/locations.mjs.map +1 -1
- package/dist/adapters/http/ui/account-console/index.d.ts +4 -0
- package/dist/adapters/http/ui/account-console/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/account-console/index.mjs +6 -0
- package/dist/adapters/http/ui/account-console/module.d.ts +28 -0
- package/dist/adapters/http/ui/account-console/module.d.ts.map +1 -0
- package/dist/adapters/http/ui/account-console/module.mjs +80 -0
- package/dist/adapters/http/ui/account-console/module.mjs.map +1 -0
- package/dist/adapters/http/ui/account-console/ref.d.ts +30 -0
- package/dist/adapters/http/ui/account-console/ref.d.ts.map +1 -0
- package/dist/adapters/http/ui/account-console/ref.mjs +50 -0
- package/dist/adapters/http/ui/account-console/ref.mjs.map +1 -0
- package/dist/adapters/http/ui/account-console/types.d.ts +11 -0
- package/dist/adapters/http/ui/account-console/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/account-console/types.mjs +4 -0
- package/dist/adapters/http/ui/{internal-http-client.d.ts → auth-console/http-client.d.ts} +1 -1
- package/dist/adapters/http/ui/auth-console/http-client.d.ts.map +1 -0
- package/dist/adapters/http/ui/{internal-http-client.mjs → auth-console/http-client.mjs} +2 -2
- package/dist/adapters/http/ui/auth-console/http-client.mjs.map +1 -0
- package/dist/adapters/http/ui/auth-console/index.d.ts +6 -0
- package/dist/adapters/http/ui/auth-console/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/auth-console/index.mjs +8 -0
- package/dist/adapters/http/ui/auth-console/module.d.ts +4 -0
- package/dist/adapters/http/ui/auth-console/module.d.ts.map +1 -0
- package/dist/adapters/http/ui/auth-console/module.mjs +73 -0
- package/dist/adapters/http/ui/auth-console/module.mjs.map +1 -0
- package/dist/adapters/http/ui/auth-console/resolve.d.ts +21 -0
- package/dist/adapters/http/ui/auth-console/resolve.d.ts.map +1 -0
- package/dist/adapters/http/ui/auth-console/resolve.mjs +53 -0
- package/dist/adapters/http/ui/auth-console/resolve.mjs.map +1 -0
- package/dist/adapters/http/ui/{serve.d.ts → auth-console/serve.d.ts} +1 -8
- package/dist/adapters/http/ui/auth-console/serve.d.ts.map +1 -0
- package/dist/adapters/http/ui/{serve.mjs → auth-console/serve.mjs} +5 -5
- package/dist/adapters/http/ui/auth-console/serve.mjs.map +1 -0
- package/dist/adapters/http/ui/auth-console/types.d.ts +26 -0
- package/dist/adapters/http/ui/auth-console/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/auth-console/types.mjs +4 -0
- package/dist/adapters/http/ui/console-packages/index.d.ts +3 -0
- package/dist/adapters/http/ui/console-packages/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/console-packages/index.mjs +5 -0
- package/dist/adapters/http/ui/console-packages/module.d.ts +33 -0
- package/dist/adapters/http/ui/console-packages/module.d.ts.map +1 -0
- package/dist/adapters/http/ui/console-packages/module.mjs +70 -0
- package/dist/adapters/http/ui/console-packages/module.mjs.map +1 -0
- package/dist/adapters/http/ui/console-packages/types.d.ts +12 -0
- package/dist/adapters/http/ui/console-packages/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/console-packages/types.mjs +4 -0
- package/dist/adapters/http/ui/index.d.ts +5 -5
- package/dist/adapters/http/ui/index.d.ts.map +1 -1
- package/dist/adapters/http/ui/index.mjs +22 -5
- package/dist/adapters/http/ui/shared/html.d.ts +76 -0
- package/dist/adapters/http/ui/shared/html.d.ts.map +1 -0
- package/dist/adapters/http/ui/shared/html.mjs +103 -0
- package/dist/adapters/http/ui/shared/html.mjs.map +1 -0
- package/dist/adapters/http/ui/shared/index.d.ts +2 -0
- package/dist/adapters/http/ui/shared/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/shared/index.mjs +5 -0
- package/dist/adapters/http/ui/theme/apply.d.ts +12 -0
- package/dist/adapters/http/ui/theme/apply.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/apply.mjs +29 -0
- package/dist/adapters/http/ui/theme/apply.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/assets.d.ts +20 -0
- package/dist/adapters/http/ui/theme/assets.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/assets.mjs +86 -0
- package/dist/adapters/http/ui/theme/assets.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/constants.d.ts +16 -0
- package/dist/adapters/http/ui/theme/constants.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/constants.mjs +20 -0
- package/dist/adapters/http/ui/theme/constants.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/contract/constants.d.ts +120 -0
- package/dist/adapters/http/ui/theme/contract/constants.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/constants.mjs +136 -0
- package/dist/adapters/http/ui/theme/contract/constants.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/contract/head.d.ts +12 -0
- package/dist/adapters/http/ui/theme/contract/head.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/head.mjs +61 -0
- package/dist/adapters/http/ui/theme/contract/head.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/contract/index.d.ts +6 -0
- package/dist/adapters/http/ui/theme/contract/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/index.mjs +8 -0
- package/dist/adapters/http/ui/theme/contract/manifest.d.ts +25 -0
- package/dist/adapters/http/ui/theme/contract/manifest.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/manifest.mjs +77 -0
- package/dist/adapters/http/ui/theme/contract/manifest.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/contract/types.d.ts +26 -0
- package/dist/adapters/http/ui/theme/contract/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/types.mjs +4 -0
- package/dist/adapters/http/ui/theme/contract/utils.d.ts +11 -0
- package/dist/adapters/http/ui/theme/contract/utils.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/contract/utils.mjs +22 -0
- package/dist/adapters/http/ui/theme/contract/utils.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/index.d.ts +7 -0
- package/dist/adapters/http/ui/theme/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/index.mjs +13 -0
- package/dist/adapters/http/ui/theme/module.d.ts +79 -0
- package/dist/adapters/http/ui/theme/module.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/module.mjs +206 -0
- package/dist/adapters/http/ui/theme/module.mjs.map +1 -0
- package/dist/adapters/http/ui/theme/types.d.ts +42 -0
- package/dist/adapters/http/ui/theme/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/theme/types.mjs +4 -0
- package/dist/app/index.mjs +3 -1
- package/dist/app/modules/authentication/module.mjs +6 -3
- package/dist/app/modules/authentication/module.mjs.map +1 -1
- package/dist/app/modules/config/constants.d.ts +5 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +5 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/helpers.mjs +3 -2
- package/dist/app/modules/config/helpers.mjs.map +1 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +8 -0
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/origins.d.ts.map +1 -1
- package/dist/app/modules/config/origins.mjs +2 -0
- package/dist/app/modules/config/origins.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +10 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/read/module.mjs +8 -3
- package/dist/app/modules/config/read/module.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +63 -3
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/config/validator.d.ts.map +1 -1
- package/dist/app/modules/config/validator.mjs +5 -0
- package/dist/app/modules/config/validator.mjs.map +1 -1
- package/dist/app/modules/database/module.mjs +2 -1
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +7 -1
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +2 -1
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +214 -128
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.d.ts +9 -1
- package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +28 -8
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +6 -3
- package/dist/app/modules/identity/module.mjs.map +1 -1
- package/dist/app/modules/index.mjs +3 -1
- package/dist/app/modules/oauth2/module.mjs +37 -17
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs +1 -1
- package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/constants.d.ts +12 -0
- package/dist/app/modules/provisioning/constants.d.ts.map +1 -0
- package/dist/app/modules/provisioning/constants.mjs +16 -0
- package/dist/app/modules/provisioning/constants.mjs.map +1 -0
- package/dist/app/modules/provisioning/index.d.ts +2 -0
- package/dist/app/modules/provisioning/index.d.ts.map +1 -1
- package/dist/app/modules/provisioning/index.mjs +3 -1
- package/dist/app/modules/provisioning/lazy-wildcard.d.ts +15 -0
- package/dist/app/modules/provisioning/lazy-wildcard.d.ts.map +1 -0
- package/dist/app/modules/provisioning/lazy-wildcard.mjs +23 -0
- package/dist/app/modules/provisioning/lazy-wildcard.mjs.map +1 -0
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +30 -11
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/composite/module.d.ts +0 -19
- package/dist/app/modules/provisioning/sources/composite/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/composite/module.mjs +7 -77
- package/dist/app/modules/provisioning/sources/composite/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.mjs +11 -2
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/core/authentication/session/module.mjs +2 -4
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/entities/client/index.d.ts +1 -1
- package/dist/core/entities/client/index.d.ts.map +1 -1
- package/dist/core/entities/client/index.mjs +2 -2
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +1 -1
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/system-clients.d.ts +95 -0
- package/dist/core/entities/client/system-clients.d.ts.map +1 -0
- package/dist/core/entities/client/system-clients.mjs +158 -0
- package/dist/core/entities/client/system-clients.mjs.map +1 -0
- package/dist/core/entities/client/types.d.ts +17 -4
- package/dist/core/entities/client/types.d.ts.map +1 -1
- package/dist/core/entities/client-permission/service.mjs +12 -9
- package/dist/core/entities/client-permission/service.mjs.map +1 -1
- package/dist/core/entities/index.mjs +2 -2
- package/dist/core/entities/key/service.mjs +4 -2
- package/dist/core/entities/key/service.mjs.map +1 -1
- package/dist/core/entities/permission/service.d.ts.map +1 -1
- package/dist/core/entities/permission/service.mjs +1 -1
- package/dist/core/entities/permission/service.mjs.map +1 -1
- package/dist/core/entities/policy/service.d.ts.map +1 -1
- package/dist/core/entities/policy/service.mjs +3 -2
- package/dist/core/entities/policy/service.mjs.map +1 -1
- package/dist/core/entities/realm/service.d.ts +8 -6
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +6 -9
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/entities/role/service.d.ts.map +1 -1
- package/dist/core/entities/role/service.mjs +1 -1
- package/dist/core/entities/role/service.mjs.map +1 -1
- package/dist/core/entities/role-permission/service.mjs +12 -9
- package/dist/core/entities/role-permission/service.mjs.map +1 -1
- package/dist/core/entities/scope/service.d.ts.map +1 -1
- package/dist/core/entities/scope/service.mjs +1 -1
- package/dist/core/entities/scope/service.mjs.map +1 -1
- package/dist/core/entities/user/service.d.ts.map +1 -1
- package/dist/core/entities/user/service.mjs +1 -1
- package/dist/core/entities/user/service.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/helpers.mjs +1 -1
- package/dist/core/entities/user-authenticator/helpers.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/service.mjs +7 -7
- package/dist/core/entities/user-authenticator/service.mjs.map +1 -1
- package/dist/core/entities/user-permission/service.mjs +12 -9
- package/dist/core/entities/user-permission/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +1 -1
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/index.mjs +6 -2
- package/dist/core/key/types.d.ts +2 -1
- package/dist/core/key/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +2 -2
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/end-session/service.d.ts.map +1 -1
- package/dist/core/oauth2/end-session/service.mjs +2 -2
- package/dist/core/oauth2/end-session/service.mjs.map +1 -1
- package/dist/core/provisioning/constants.d.ts +8 -0
- package/dist/core/provisioning/constants.d.ts.map +1 -0
- package/dist/core/provisioning/constants.mjs +14 -0
- package/dist/core/provisioning/constants.mjs.map +1 -0
- package/dist/core/provisioning/entities/index.mjs +2 -1
- package/dist/core/provisioning/entities/realm/index.d.ts +1 -0
- package/dist/core/provisioning/entities/realm/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/realm/index.mjs +2 -1
- package/dist/core/provisioning/entities/realm/validator.d.ts +11 -0
- package/dist/core/provisioning/entities/realm/validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/realm/validator.mjs +14 -0
- package/dist/core/provisioning/entities/realm/validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/realm/wildcard-validator.d.ts +19 -0
- package/dist/core/provisioning/entities/realm/wildcard-validator.d.ts.map +1 -0
- package/dist/core/provisioning/entities/realm/wildcard-validator.mjs +65 -0
- package/dist/core/provisioning/entities/realm/wildcard-validator.mjs.map +1 -0
- package/dist/core/provisioning/index.d.ts +3 -0
- package/dist/core/provisioning/index.d.ts.map +1 -1
- package/dist/core/provisioning/index.mjs +7 -1
- package/dist/core/provisioning/merge/index.d.ts +3 -0
- package/dist/core/provisioning/merge/index.d.ts.map +1 -0
- package/dist/core/provisioning/merge/index.mjs +5 -0
- package/dist/core/provisioning/merge/module.d.ts +18 -0
- package/dist/core/provisioning/merge/module.d.ts.map +1 -0
- package/dist/core/provisioning/merge/module.mjs +82 -0
- package/dist/core/provisioning/merge/module.mjs.map +1 -0
- package/dist/core/provisioning/merge/types.d.ts +34 -0
- package/dist/core/provisioning/merge/types.d.ts.map +1 -0
- package/dist/core/provisioning/merge/types.mjs +4 -0
- package/dist/core/provisioning/synchronizer/client/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/client/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/permission/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/permission/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/realm/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/realm/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/role/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/role/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/scope/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/scope/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/user/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/user/module.mjs.map +1 -1
- package/dist/core/provisioning/types.d.ts +10 -0
- package/dist/core/provisioning/types.d.ts.map +1 -1
- package/dist/core/provisioning/wildcard/index.d.ts +3 -0
- package/dist/core/provisioning/wildcard/index.d.ts.map +1 -0
- package/dist/core/provisioning/wildcard/index.mjs +5 -0
- package/dist/core/provisioning/wildcard/module.d.ts +53 -0
- package/dist/core/provisioning/wildcard/module.d.ts.map +1 -0
- package/dist/core/provisioning/wildcard/module.mjs +91 -0
- package/dist/core/provisioning/wildcard/module.mjs.map +1 -0
- package/dist/core/provisioning/wildcard/types.d.ts +19 -0
- package/dist/core/provisioning/wildcard/types.d.ts.map +1 -0
- package/dist/core/provisioning/wildcard/types.mjs +4 -0
- package/dist/index.mjs +5 -1
- package/dist/path.d.ts +0 -2
- package/dist/path.d.ts.map +1 -1
- package/dist/path.mjs +1 -3
- package/dist/path.mjs.map +1 -1
- package/dist/swagger.json +485 -17
- package/package.json +26 -63
- package/dist/adapters/http/ui/base-path.d.ts +0 -9
- package/dist/adapters/http/ui/base-path.d.ts.map +0 -1
- package/dist/adapters/http/ui/base-path.mjs +0 -18
- package/dist/adapters/http/ui/base-path.mjs.map +0 -1
- package/dist/adapters/http/ui/internal-http-client.d.ts.map +0 -1
- package/dist/adapters/http/ui/internal-http-client.mjs.map +0 -1
- package/dist/adapters/http/ui/render.d.ts +0 -4
- package/dist/adapters/http/ui/render.d.ts.map +0 -1
- package/dist/adapters/http/ui/render.mjs +0 -63
- package/dist/adapters/http/ui/render.mjs.map +0 -1
- package/dist/adapters/http/ui/serve.d.ts.map +0 -1
- package/dist/adapters/http/ui/serve.mjs.map +0 -1
- package/dist/adapters/http/ui/types.d.ts +0 -20
- package/dist/adapters/http/ui/types.d.ts.map +0 -1
- package/dist/core/entities/client/web-client.d.ts +0 -72
- package/dist/core/entities/client/web-client.d.ts.map +0 -1
- package/dist/core/entities/client/web-client.mjs +0 -123
- package/dist/core/entities/client/web-client.mjs.map +0 -1
- package/dist/ui/client/.vite/ssr-manifest.json +0 -54812
- 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-Bk6-OZy9.css +0 -2
- package/dist/ui/client/assets/index-DO6_7NTJ.js +0 -106
- 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 +0 -22
- package/dist/ui/server/assets/multipart-parser-BCMy8Xwv.js +0 -181
- package/dist/ui/server/assets/multipart-parser-BVY8pIV2.js +0 -176
- package/dist/ui/server/server.js +0 -158420
- /package/dist/adapters/http/{ui → middleware/built-in}/types.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/provisioning/sources/composite/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/provisioning/sources/composite/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAEtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,qBAAa,2BAA4B,YAAW,mBAAmB;IACnE,SAAS,CAAC,OAAO,EAAG,mBAAmB,EAAE,CAAC;gBAE9B,OAAO,EAAG,mBAAmB,EAAE;IAIrC,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAYlE,KAAK,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,sBAAsB;CAOvE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import {
|
|
4
|
+
import { mergeProvisioningEntities } from "../../../../../core/provisioning/merge/module.mjs";
|
|
5
|
+
import "../../../../../core/provisioning/merge/index.mjs";
|
|
5
6
|
//#region src/app/modules/provisioning/sources/composite/module.ts
|
|
6
7
|
var CompositeProvisioningSource = class {
|
|
7
8
|
sources;
|
|
@@ -14,82 +15,11 @@ var CompositeProvisioningSource = class {
|
|
|
14
15
|
return output;
|
|
15
16
|
}
|
|
16
17
|
merge(target, source) {
|
|
17
|
-
target.policies =
|
|
18
|
-
target.permissions =
|
|
19
|
-
target.roles =
|
|
20
|
-
target.scopes =
|
|
21
|
-
target.realms =
|
|
22
|
-
}
|
|
23
|
-
buildEntityKey(attributes) {
|
|
24
|
-
if (!attributes.name) return void 0;
|
|
25
|
-
return `${attributes.name}:${attributes.realmId || ""}:${attributes.clientId || ""}`;
|
|
26
|
-
}
|
|
27
|
-
mergeEntities(target, source) {
|
|
28
|
-
if (!source) return target;
|
|
29
|
-
if (!target) return [...source];
|
|
30
|
-
const result = [...target];
|
|
31
|
-
source.forEach((item) => {
|
|
32
|
-
const key = this.buildEntityKey(item.attributes);
|
|
33
|
-
if (!key) {
|
|
34
|
-
result.push(item);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const idx = result.findIndex((r) => this.buildEntityKey(r.attributes) === key);
|
|
38
|
-
if (idx !== -1) result[idx] = this.mergeEntity(result[idx], item);
|
|
39
|
-
else result.push(item);
|
|
40
|
-
});
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Deep-merge two entries sharing a composite key. The later source wins
|
|
45
|
-
* per attribute, but relations are UNIONED — a later source (e.g. a
|
|
46
|
-
* mounted provisioning file) extending a built-in entry (the default
|
|
47
|
-
* source's master realm) must not silently drop the built-in relations
|
|
48
|
-
* (admin user, system client).
|
|
49
|
-
*
|
|
50
|
-
* Policy extraAttributes merge per key with the later source winning —
|
|
51
|
-
* like attributes, NOT like relations: an EA value (a names denylist,
|
|
52
|
-
* an ATTRIBUTES query tree) is policy configuration, and unioning would
|
|
53
|
-
* make shrinking a list impossible and fabricate predicates neither
|
|
54
|
-
* source authored.
|
|
55
|
-
*/ mergeEntity(target, source) {
|
|
56
|
-
const output = {
|
|
57
|
-
...target,
|
|
58
|
-
...source
|
|
59
|
-
};
|
|
60
|
-
output.attributes = {
|
|
61
|
-
...target.attributes,
|
|
62
|
-
...source.attributes
|
|
63
|
-
};
|
|
64
|
-
if (target.strategy && !source.strategy) output.strategy = target.strategy;
|
|
65
|
-
if (target.relations && source.relations) output.relations = this.mergeRecord(target.relations, source.relations);
|
|
66
|
-
else if (target.relations && !source.relations) output.relations = target.relations;
|
|
67
|
-
if (target.extraAttributes && source.extraAttributes) output.extraAttributes = {
|
|
68
|
-
...target.extraAttributes,
|
|
69
|
-
...source.extraAttributes
|
|
70
|
-
};
|
|
71
|
-
else if (target.extraAttributes && !source.extraAttributes) output.extraAttributes = target.extraAttributes;
|
|
72
|
-
if (target.children && source.children) output.children = this.mergeEntities(target.children, source.children);
|
|
73
|
-
else if (target.children && !source.children) output.children = target.children;
|
|
74
|
-
return output;
|
|
75
|
-
}
|
|
76
|
-
mergeRecord(target, source) {
|
|
77
|
-
const output = { ...target };
|
|
78
|
-
for (const key of Object.keys(source)) output[key] = key in target ? this.mergeValue(target[key], source[key]) : source[key];
|
|
79
|
-
return output;
|
|
80
|
-
}
|
|
81
|
-
mergeValue(target, source) {
|
|
82
|
-
if (typeof target === "undefined") return source;
|
|
83
|
-
if (typeof source === "undefined") return target;
|
|
84
|
-
if (Array.isArray(target) && Array.isArray(source)) {
|
|
85
|
-
if (this.isEntityArray(target) || this.isEntityArray(source)) return this.mergeEntities(target, source);
|
|
86
|
-
return [.../* @__PURE__ */ new Set([...target, ...source])];
|
|
87
|
-
}
|
|
88
|
-
if (isObject(target) && isObject(source)) return this.mergeRecord(target, source);
|
|
89
|
-
return source;
|
|
90
|
-
}
|
|
91
|
-
isEntityArray(value) {
|
|
92
|
-
return value.some((item) => isObject(item) && "attributes" in item);
|
|
18
|
+
target.policies = mergeProvisioningEntities(target.policies, source.policies);
|
|
19
|
+
target.permissions = mergeProvisioningEntities(target.permissions, source.permissions);
|
|
20
|
+
target.roles = mergeProvisioningEntities(target.roles, source.roles);
|
|
21
|
+
target.scopes = mergeProvisioningEntities(target.scopes, source.scopes);
|
|
22
|
+
target.realms = mergeProvisioningEntities(target.realms, source.realms);
|
|
93
23
|
}
|
|
94
24
|
};
|
|
95
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["mergeProvisioningEntities","CompositeProvisioningSource","sources","load","container","output","sourcesData","Promise","all","map","source","sourceData","merge","target","policies","permissions","roles","scopes","realms"],"sources":["../../../../../../src/app/modules/provisioning/sources/composite/module.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 { RootProvisioningEntity } from '../../../../../core/provisioning/entities/root/index.ts';\nimport { mergeProvisioningEntities } from '../../../../../core/provisioning/merge/index.ts';\nimport type { IProvisioningSource } from '../../../../../core/provisioning/types.ts';\nimport type { IContainer } from 'eldin';\n\nexport class CompositeProvisioningSource implements IProvisioningSource {\n protected sources : IProvisioningSource[];\n\n constructor(sources : IProvisioningSource[]) {\n this.sources = sources;\n }\n\n async load(container: IContainer): Promise<RootProvisioningEntity> {\n const output : RootProvisioningEntity = {};\n\n const sourcesData = await Promise.all(\n (this.sources).map((source) => source.load(container)),\n );\n\n sourcesData.map((sourceData) => this.merge(output, sourceData));\n\n return output;\n }\n\n merge(target: RootProvisioningEntity, source: RootProvisioningEntity) {\n target.policies = mergeProvisioningEntities(target.policies, source.policies);\n target.permissions = mergeProvisioningEntities(target.permissions, source.permissions);\n target.roles = mergeProvisioningEntities(target.roles, source.roles);\n target.scopes = mergeProvisioningEntities(target.scopes, source.scopes);\n target.realms = mergeProvisioningEntities(target.realms, source.realms);\n }\n}\n"],"mappings":";;;;;;AAYA,IAAaC,8BAAb,MAAaA;CACCC;CAEV,YAAYA,SAAiC;EACzC,KAAKA,UAAUA;CACnB;CAEA,MAAMC,KAAKC,WAAwD;EAC/D,MAAMC,SAAkC,CAAC;EAMzCC,CAAAA,MAJ0BC,QAAQC,IAC9B,KAAMN,QAASO,KAAKC,WAAWA,OAAOP,KAAKC,SAAAA,CAAAA,CAAAA,EAAAA,CAGnCK,KAAKE,eAAe,KAAKC,MAAMP,QAAQM,UAAAA,CAAAA;EAEnD,OAAON;CACX;CAEAO,MAAMC,QAAgCH,QAAgC;EAClEG,OAAOC,WAAWd,0BAA0Ba,OAAOC,UAAUJ,OAAOI,QAAQ;EAC5ED,OAAOE,cAAcf,0BAA0Ba,OAAOE,aAAaL,OAAOK,WAAW;EACrFF,OAAOG,QAAQhB,0BAA0Ba,OAAOG,OAAON,OAAOM,KAAK;EACnEH,OAAOI,SAASjB,0BAA0Ba,OAAOI,QAAQP,OAAOO,MAAM;EACtEJ,OAAOK,SAASlB,0BAA0Ba,OAAOK,QAAQR,OAAOQ,MAAM;CAC1E;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/provisioning/sources/file/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/provisioning/sources/file/module.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAErF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAOlE,qBAAa,sBAAuB,YAAW,mBAAmB;IAC9D,SAAS,CAAC,OAAO,EAAE,+BAA+B,CAAC;IAEnD,SAAS,CAAC,aAAa,EAAE,yBAAyB,CAAC;gBAEvC,OAAO,EAAE,+BAA+B;IAM9C,IAAI,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAiEhD"}
|
|
@@ -6,6 +6,7 @@ import "../../../../../core/provisioning/entities/index.mjs";
|
|
|
6
6
|
import { CompositeProvisioningSource } from "../composite/module.mjs";
|
|
7
7
|
import "../composite/index.mjs";
|
|
8
8
|
import { ValidatorGroup, isObject } from "@authup/kit";
|
|
9
|
+
import { isValidupError, stringifyPath } from "validup";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
import { locateMany, read } from "locter";
|
|
11
12
|
//#region src/app/modules/provisioning/sources/file/module.ts
|
|
@@ -25,14 +26,22 @@ var FileProvisioningSource = class {
|
|
|
25
26
|
this.rootValidator = new RootProvisioningValidator();
|
|
26
27
|
}
|
|
27
28
|
async load() {
|
|
28
|
-
const
|
|
29
|
+
const cwd = path.isAbsolute(this.options.cwd) ? this.options.cwd : path.join(process.cwd(), this.options.cwd);
|
|
30
|
+
const locations = await locateMany("*.{json,yaml,yml,ts,mts,mjs,js}", { cwd });
|
|
29
31
|
const compositeSource = new CompositeProvisioningSource([]);
|
|
30
32
|
const output = {};
|
|
31
33
|
for (const location of locations) {
|
|
32
34
|
const raw = await read(location);
|
|
33
35
|
const entity = typeof location.extension === "string" && MODULE_FILE_EXTENSIONS.has(location.extension.toLowerCase()) && isObject(raw) && "default" in raw ? raw.default : raw;
|
|
34
36
|
if (!isObject(entity)) throw new Error(`The provisioning file "${location.path}" must contain an object at its root.`);
|
|
35
|
-
|
|
37
|
+
let data;
|
|
38
|
+
try {
|
|
39
|
+
data = await this.rootValidator.run(entity, { group: ValidatorGroup.PROVISIONING });
|
|
40
|
+
} catch (e) {
|
|
41
|
+
if (!isValidupError(e)) throw e;
|
|
42
|
+
const issues = e.issues.map((issue) => ` ${stringifyPath(issue.path)}: ${issue.message}`).join("\n");
|
|
43
|
+
throw new Error(`The provisioning file "${location.path}" is invalid.\n${issues}`, { cause: e });
|
|
44
|
+
}
|
|
36
45
|
compositeSource.merge(output, data);
|
|
37
46
|
}
|
|
38
47
|
return output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["ValidatorGroup","isObject","locateMany","read","path","RootProvisioningValidator","CompositeProvisioningSource","MODULE_FILE_EXTENSIONS","Set","FileProvisioningSource","options","rootValidator","load","cwd","isAbsolute","join","process","locations","compositeSource","output","location","raw","isModule","extension","has","toLowerCase","entity","default","Error","data","run","group","PROVISIONING","merge"],"sources":["../../../../../../src/app/modules/provisioning/sources/file/module.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 { ValidatorGroup, isObject } from '@authup/kit';\nimport { locateMany, read } from 'locter';\nimport path from 'node:path';\nimport type { RootProvisioningEntity } from '../../../../../core/provisioning/entities/index.ts';\nimport { RootProvisioningValidator } from '../../../../../core/provisioning/entities/index.ts';\nimport type { IProvisioningSource } from '../../../../../core/provisioning/types.ts';\nimport { CompositeProvisioningSource } from '../composite/index.ts';\nimport type { FileEntitySchemaImporterOptions } from './types.ts';\n\n// Extensions locter loads as an ES module namespace ({ default, ...named }),\n// as opposed to data files (json/yaml/yml) whose parsed value is returned\n// directly. Only the former should have their `default` export unwrapped.\nconst MODULE_FILE_EXTENSIONS = new Set(['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs']);\n\nexport class FileProvisioningSource implements IProvisioningSource {\n protected options: FileEntitySchemaImporterOptions;\n\n protected rootValidator: RootProvisioningValidator;\n\n constructor(options: FileEntitySchemaImporterOptions) {\n this.options = options;\n\n this.rootValidator = new RootProvisioningValidator();\n }\n\n async load(): Promise<RootProvisioningEntity> {\n const cwd = path.isAbsolute(this.options.cwd) ?\n this.options.cwd :\n path.join(process.cwd(), this.options.cwd);\n\n const locations = await locateMany('*.{json,yaml,yml,ts,mts,mjs,js}', { cwd });\n\n const compositeSource = new CompositeProvisioningSource([]);\n\n const output : RootProvisioningEntity = {};\n for (const location of locations) {\n const raw = await read(location);\n // Unwrap the default export only for module files; a data file\n // (json/yaml) whose root legitimately carries a `default` key must\n // keep all of its keys.\n const isModule = typeof location.extension === 'string' &&\n MODULE_FILE_EXTENSIONS.has(location.extension.toLowerCase());\n const entity = isModule && isObject(raw) && 'default' in raw ?\n raw.default :\n raw;\n\n // Fail closed on a malformed root (top-level list/scalar, or an\n // empty file parsing to null) instead of silently provisioning\n // nothing — the same silent-skip class the loader otherwise avoids.\n if (!isObject(entity)) {\n throw new Error(`The provisioning file \"${location.path}\" must contain an object at its root.`);\n }\n\n // Provisioning files use the camelCase management vocabulary\n // (plan 073). Keys are NOT rewritten here: a blanket snake->camel\n // pass cannot tell a schema property from a data-identifier map key\n // (`clientPermissions`/`clientRoles` are keyed by client name, and\n // client names may contain underscores), so it would silently\n // corrupt those keys. Unmounted keys are stripped by the validator.\n
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["ValidatorGroup","isObject","locateMany","read","path","isValidupError","stringifyPath","RootProvisioningValidator","CompositeProvisioningSource","MODULE_FILE_EXTENSIONS","Set","FileProvisioningSource","options","rootValidator","load","cwd","isAbsolute","join","process","locations","compositeSource","output","location","raw","isModule","extension","has","toLowerCase","entity","default","Error","data","run","group","PROVISIONING","e","issues","map","issue","message","cause","merge"],"sources":["../../../../../../src/app/modules/provisioning/sources/file/module.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 { ValidatorGroup, isObject } from '@authup/kit';\nimport { locateMany, read } from 'locter';\nimport path from 'node:path';\nimport { isValidupError, stringifyPath } from 'validup';\nimport type { RootProvisioningEntity } from '../../../../../core/provisioning/entities/index.ts';\nimport { RootProvisioningValidator } from '../../../../../core/provisioning/entities/index.ts';\nimport type { IProvisioningSource } from '../../../../../core/provisioning/types.ts';\nimport { CompositeProvisioningSource } from '../composite/index.ts';\nimport type { FileEntitySchemaImporterOptions } from './types.ts';\n\n// Extensions locter loads as an ES module namespace ({ default, ...named }),\n// as opposed to data files (json/yaml/yml) whose parsed value is returned\n// directly. Only the former should have their `default` export unwrapped.\nconst MODULE_FILE_EXTENSIONS = new Set(['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs']);\n\nexport class FileProvisioningSource implements IProvisioningSource {\n protected options: FileEntitySchemaImporterOptions;\n\n protected rootValidator: RootProvisioningValidator;\n\n constructor(options: FileEntitySchemaImporterOptions) {\n this.options = options;\n\n this.rootValidator = new RootProvisioningValidator();\n }\n\n async load(): Promise<RootProvisioningEntity> {\n const cwd = path.isAbsolute(this.options.cwd) ?\n this.options.cwd :\n path.join(process.cwd(), this.options.cwd);\n\n const locations = await locateMany('*.{json,yaml,yml,ts,mts,mjs,js}', { cwd });\n\n const compositeSource = new CompositeProvisioningSource([]);\n\n const output : RootProvisioningEntity = {};\n for (const location of locations) {\n const raw = await read(location);\n // Unwrap the default export only for module files; a data file\n // (json/yaml) whose root legitimately carries a `default` key must\n // keep all of its keys.\n const isModule = typeof location.extension === 'string' &&\n MODULE_FILE_EXTENSIONS.has(location.extension.toLowerCase());\n const entity = isModule && isObject(raw) && 'default' in raw ?\n raw.default :\n raw;\n\n // Fail closed on a malformed root (top-level list/scalar, or an\n // empty file parsing to null) instead of silently provisioning\n // nothing — the same silent-skip class the loader otherwise avoids.\n if (!isObject(entity)) {\n throw new Error(`The provisioning file \"${location.path}\" must contain an object at its root.`);\n }\n\n // Provisioning files use the camelCase management vocabulary\n // (plan 073). Keys are NOT rewritten here: a blanket snake->camel\n // pass cannot tell a schema property from a data-identifier map key\n // (`clientPermissions`/`clientRoles` are keyed by client name, and\n // client names may contain underscores), so it would silently\n // corrupt those keys. Unmounted keys are stripped by the validator.\n let data : RootProvisioningEntity;\n try {\n data = await this.rootValidator.run(\n entity as Record<string, any>,\n { group: ValidatorGroup.PROVISIONING },\n );\n } catch (e) {\n // The raw ValidupError message is a generic\n // \"Property <path> is invalid\" and names neither the file nor\n // the reason, so a bad entry in one of several mounted files\n // aborted the boot with nothing to act on. Re-throw with the\n // file path and every issue message attached.\n if (!isValidupError(e)) {\n throw e;\n }\n\n const issues = e.issues\n .map((issue) => ` ${stringifyPath(issue.path)}: ${issue.message}`)\n .join('\\n');\n\n throw new Error(\n `The provisioning file \"${location.path}\" is invalid.\\n${issues}`,\n { cause: e },\n );\n }\n\n compositeSource.merge(output, data);\n }\n\n return output;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAMS,yCAAyB,IAAIC,IAAI;CAAC;CAAO;CAAQ;CAAQ;CAAO;CAAQ;AAAO,CAAA;AAErF,IAAaC,yBAAb,MAAaA;CACCC;CAEAC;CAEV,YAAYD,SAA0C;EAClD,KAAKA,UAAUA;EAEf,KAAKC,gBAAgB,IAAIN,0BAAAA;CAC7B;CAEA,MAAMO,OAAwC;EAC1C,MAAMC,MAAMX,KAAKY,WAAW,KAAKJ,QAAQG,GAAG,IACxC,KAAKH,QAAQG,MACbX,KAAKa,KAAKC,QAAQH,IAAG,GAAI,KAAKH,QAAQG,GAAG;EAE7C,MAAMI,YAAY,MAAMjB,WAAW,mCAAmC,EAAEa,IAAI,CAAA;EAE5E,MAAMK,kBAAkB,IAAIZ,4BAA4B,CAAA,CAAE;EAE1D,MAAMa,SAAkC,CAAC;EACzC,KAAK,MAAMC,YAAYH,WAAW;GAC9B,MAAMI,MAAM,MAAMpB,KAAKmB,QAAAA;GAMvB,MAAMM,SAFW,OAAON,SAASG,cAAc,YAC3ChB,uBAAuBiB,IAAIJ,SAASG,UAAUE,YAAW,CAAA,KAClC1B,SAASsB,GAAAA,KAAQ,aAAaA,MACrDA,IAAIM,UACJN;GAKJ,IAAI,CAACtB,SAAS2B,MAAAA,GACV,MAAM,IAAIE,MAAM,0BAA0BR,SAASlB,KAAK,sCAAsC;GASlG,IAAI2B;GACJ,IAAI;IACAA,OAAO,MAAM,KAAKlB,cAAcmB,IAC5BJ,QACA,EAAEK,OAAOjC,eAAekC,aAAa,CAAA;GAE7C,SAASC,GAAG;IAMR,IAAI,CAAC9B,eAAe8B,CAAAA,GAChB,MAAMA;IAGV,MAAMC,SAASD,EAAEC,OACZC,KAAKC,UAAU,KAAKhC,cAAcgC,MAAMlC,IAAI,EAAE,IAAIkC,MAAMC,SAAS,CAAA,CACjEtB,KAAK,IAAA;IAEV,MAAM,IAAIa,MACN,0BAA0BR,SAASlB,KAAK,iBAAiBgC,UACzD,EAAEI,OAAOL,EAAE,CAAA;GAEnB;GAEAf,gBAAgBqB,MAAMpB,QAAQU,IAAAA;EAClC;EAEA,OAAOV;CACX;AACJ"}
|
|
@@ -23,15 +23,13 @@ var SessionManager = class {
|
|
|
23
23
|
case IdentityType.CLIENT:
|
|
24
24
|
input.clientId = input.sub;
|
|
25
25
|
break;
|
|
26
|
-
case IdentityType.USER:
|
|
27
|
-
input.userId = input.sub;
|
|
28
|
-
break;
|
|
26
|
+
case IdentityType.USER: input.userId = input.sub;
|
|
29
27
|
}
|
|
30
28
|
return this.repository.save(input);
|
|
31
29
|
}
|
|
32
30
|
async ping(session) {
|
|
33
31
|
if (session.seenAt) {
|
|
34
|
-
if (new Date(session.seenAt).getTime() +
|
|
32
|
+
if (new Date(session.seenAt).getTime() + 5e3 > Date.now()) return session;
|
|
35
33
|
}
|
|
36
34
|
session.seenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
37
35
|
return this.repository.save(session);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["IdentityType","JWTError","SessionManager","options","repository","ctx","create","input","ipAddress","userAgent","expiresAt","Date","now","maxAge","toISOString","subKind","CLIENT","clientId","sub","USER","userId","save","ping","session","seenAt","getTime","threshold","refresh","refreshedAt","markMfaVerified","mfaAt","findOneById","id","revoke","removeById","verify","ms","remove","expired"],"sources":["../../../../src/core/authentication/session/module.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 type { Session } from '@authup/core-kit';\nimport { IdentityType } from '@authup/core-kit';\nimport { JWTError } from '@authup/specs';\nimport type {\n ISessionManager, \n ISessionRepository, \n SessionManagerContext, \n SessionManagerOptions,\n} from './types.ts';\n\nexport class SessionManager implements ISessionManager {\n protected options: SessionManagerOptions;\n\n protected repository: ISessionRepository;\n\n // -----------------------------------------------------\n\n constructor(ctx: SessionManagerContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n }\n\n // -----------------------------------------------------\n\n /**\n * Create/Update session\n *\n * @param input\n */\n async create(input: Partial<Session>): Promise<Session> {\n input.ipAddress = input.ipAddress || '127.0.0.1';\n input.userAgent = input.userAgent || 'system';\n input.expiresAt = input.expiresAt || new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n switch (input.subKind) {\n case IdentityType.CLIENT: {\n input.clientId = input.sub;\n break;\n }\n case IdentityType.USER: {\n input.userId = input.sub;\n break;\n }\n }\n\n return this.repository.save(input);\n }\n\n // -----------------------------------------------------\n\n async ping(session: Session): Promise<Session> {\n if (session.seenAt) {\n const seenAt = new Date(session.seenAt).getTime();\n const threshold = seenAt + (5 * 1_000);\n\n if (threshold > Date.now()) {\n return session;\n }\n }\n\n session.seenAt = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async refresh(session: Session): Promise<Session> {\n const now = new Date().toISOString();\n session.refreshedAt = now;\n session.seenAt = now;\n\n session.expiresAt = new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async markMfaVerified(session: Session): Promise<Session> {\n session.mfaAt = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n /**\n * Verify session on token inspection/verification.\n *\n * @param id\n * @throws JWTError\n */\n async findOneById(id: string): Promise<Session | null> {\n return this.repository.findOneById(id);\n }\n\n // -----------------------------------------------------\n\n async revoke(id: string): Promise<void> {\n await this.repository.removeById(id);\n }\n\n // -----------------------------------------------------\n\n async verify(session: Session): Promise<void> {\n const ms = new Date(session.expiresAt).getTime();\n if (Date.now() > ms) {\n await this.repository.remove(session);\n\n // todo: better error\n throw JWTError.expired();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAaE,iBAAb,MAAaA;CACCC;CAEAC;CAIV,YAAYC,KAA4B;EACpC,KAAKF,UAAUE,IAAIF;EACnB,KAAKC,aAAaC,IAAID;CAC1B;;;;;IASA,MAAME,OAAOC,OAA2C;EACpDA,MAAMC,YAAYD,MAAMC,aAAa;EACrCD,MAAME,YAAYF,MAAME,aAAa;EACrCF,MAAMG,YAAYH,MAAMG,aAAa,IAAIC,KACrCA,KAAKC,IAAG,IAAM,KAAKT,QAAQU,SAAS,GAAA,CAAA,CACtCC,YAAW;EAEb,QAAQP,MAAMQ,SAAd;GACI,KAAKf,aAAagB;IACdT,MAAMU,WAAWV,MAAMW;IACvB;GAEJ,KAAKlB,aAAamB
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["IdentityType","JWTError","SessionManager","options","repository","ctx","create","input","ipAddress","userAgent","expiresAt","Date","now","maxAge","toISOString","subKind","CLIENT","clientId","sub","USER","userId","save","ping","session","seenAt","getTime","threshold","refresh","refreshedAt","markMfaVerified","mfaAt","findOneById","id","revoke","removeById","verify","ms","remove","expired"],"sources":["../../../../src/core/authentication/session/module.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 type { Session } from '@authup/core-kit';\nimport { IdentityType } from '@authup/core-kit';\nimport { JWTError } from '@authup/specs';\nimport type {\n ISessionManager, \n ISessionRepository, \n SessionManagerContext, \n SessionManagerOptions,\n} from './types.ts';\n\nexport class SessionManager implements ISessionManager {\n protected options: SessionManagerOptions;\n\n protected repository: ISessionRepository;\n\n // -----------------------------------------------------\n\n constructor(ctx: SessionManagerContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n }\n\n // -----------------------------------------------------\n\n /**\n * Create/Update session\n *\n * @param input\n */\n async create(input: Partial<Session>): Promise<Session> {\n input.ipAddress = input.ipAddress || '127.0.0.1';\n input.userAgent = input.userAgent || 'system';\n input.expiresAt = input.expiresAt || new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n switch (input.subKind) {\n case IdentityType.CLIENT: {\n input.clientId = input.sub;\n break;\n }\n case IdentityType.USER: {\n input.userId = input.sub;\n break;\n }\n }\n\n return this.repository.save(input);\n }\n\n // -----------------------------------------------------\n\n async ping(session: Session): Promise<Session> {\n if (session.seenAt) {\n const seenAt = new Date(session.seenAt).getTime();\n const threshold = seenAt + (5 * 1_000);\n\n if (threshold > Date.now()) {\n return session;\n }\n }\n\n session.seenAt = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async refresh(session: Session): Promise<Session> {\n const now = new Date().toISOString();\n session.refreshedAt = now;\n session.seenAt = now;\n\n session.expiresAt = new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async markMfaVerified(session: Session): Promise<Session> {\n session.mfaAt = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n /**\n * Verify session on token inspection/verification.\n *\n * @param id\n * @throws JWTError\n */\n async findOneById(id: string): Promise<Session | null> {\n return this.repository.findOneById(id);\n }\n\n // -----------------------------------------------------\n\n async revoke(id: string): Promise<void> {\n await this.repository.removeById(id);\n }\n\n // -----------------------------------------------------\n\n async verify(session: Session): Promise<void> {\n const ms = new Date(session.expiresAt).getTime();\n if (Date.now() > ms) {\n await this.repository.remove(session);\n\n // todo: better error\n throw JWTError.expired();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAaE,iBAAb,MAAaA;CACCC;CAEAC;CAIV,YAAYC,KAA4B;EACpC,KAAKF,UAAUE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,MAAM,KAAK5B,WAAW8B,WAAWF,EAAAA;CACrC;CAIA,MAAMG,OAAOZ,SAAiC;EAC1C,MAAMa,KAAK,IAAIzB,KAAKY,QAAQb,SAAS,CAAA,CAAEe,QAAO;EAC9C,IAAId,KAAKC,IAAG,IAAKwB,IAAI;GACjB,MAAM,KAAKhC,WAAWiC,OAAOd,OAAAA;GAG7B,MAAMtB,SAASqC,QAAO;EAC1B;CACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
@@ -4,5 +4,5 @@ import.meta.url;
|
|
|
4
4
|
import { CLIENT_READ_PERMISSIONS } from "./constants.mjs";
|
|
5
5
|
import { clientSchema } from "./schema.mjs";
|
|
6
6
|
import { ClientService } from "./service.mjs";
|
|
7
|
-
import {
|
|
8
|
-
export { CLIENT_READ_PERMISSIONS, ClientService,
|
|
7
|
+
import { SYSTEM_CLIENT_DEFINITIONS, SYSTEM_CLIENT_SCOPE_NAMES, SystemClientProvisioner, buildSystemClientAttributes } from "./system-clients.mjs";
|
|
8
|
+
export { CLIENT_READ_PERMISSIONS, ClientService, SYSTEM_CLIENT_DEFINITIONS, SYSTEM_CLIENT_SCOPE_NAMES, SystemClientProvisioner, buildSystemClientAttributes, clientSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client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,CAAC,MAAM,CAAC,CAAC;IAY5C,MAAM,CACR,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,YAAY,EACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IA6CZ,MAAM,CACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC;IAKZ,MAAM,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC;IAKZ,IAAI,CACN,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO,GACvC,OAAO,CAAC;QACP,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAA;KACnB,CAAC;IA6JI,MAAM,CACR,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC;CAmBrB"}
|
|
@@ -69,7 +69,7 @@ var ClientService = class extends AbstractEntityService {
|
|
|
69
69
|
else where.name = idOrName;
|
|
70
70
|
if (realm) where.realmId = realm.id;
|
|
71
71
|
entity = await this.repository.findOneWithSecret(where);
|
|
72
|
-
if (!entity && options.updateOnly) throw new EntityNotFoundError();
|
|
72
|
+
if (!entity && (options.updateOnly || where.id)) throw new EntityNotFoundError();
|
|
73
73
|
} else if (options.updateOnly) throw new EntityNotFoundError();
|
|
74
74
|
let isSelfEdit = false;
|
|
75
75
|
if (entity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","definePolicyData","ValidatorGroup","isUUID","EntityNotFoundError","ValidationError","CLIENT_RESERVED_NAMES","ClientAuthMethod","ClientValidator","PermissionName","AbstractEntityService","ClientCredentialsService","CLIENT_READ_PERMISSIONS","decodeQuery","clientSchema","ClientService","repository","realmRepository","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","findMany","schema","getOne","idOrName","realmId","isMe","identity","type","data","id","entity","findOne","parameters","secret","secretEncrypted","secretHashed","evaluateOneOf","ATTRIBUTES","resourceRealmMatch","create","save","undefined","update","updateOnly","options","group","realm","resolve","where","findOneWithSecret","isSelfEdit","preEvaluate","CLIENT_UPDATE","e","CLIENT_SELF_MANAGE","UPDATE","CLIENT_CREATE","CREATE","validated","run","includes","builtIn","validateJoinColumns","checkUniqueness","credentialsService","actorRealmId","getActorRealmId","evaluate","merge","authMethod","SECRET","generateSecret","protect","created","delete","CLIENT_DELETE","findOneBy","entityId","remove"],"sources":["../../../../src/core/entities/client/service.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 { BuiltInPolicyType, definePolicyData } from '@authup/access';\nimport { ValidatorGroup, isUUID } from '@authup/kit';\nimport { EntityNotFoundError, ValidationError } from '@authup/errors';\nimport {\n CLIENT_RESERVED_NAMES,\n ClientAuthMethod,\n ClientValidator,\n PermissionName,\n} from '@authup/core-kit';\nimport type { Client } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IRealmRepository } from '../realm/types.ts';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport { ClientCredentialsService } from '../../authentication/credential/entities/client/module.ts';\nimport type { IClientRepository, IClientService } from './types.ts';\nimport { CLIENT_READ_PERMISSIONS } from './constants.ts';\nimport { decodeQuery } from '../../query/index.ts';\nimport { clientSchema } from './schema.ts';\n\nexport type ClientServiceContext = {\n repository: IClientRepository;\n realmRepository: IRealmRepository;\n};\n\nexport class ClientService extends AbstractEntityService implements IClientService {\n protected repository: IClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected validator: ClientValidator;\n\n constructor(ctx: ClientServiceContext) {\n super();\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.validator = new ClientValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<Client>> {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n\n // The per-row `secret` visibility gate lives on the client SCHEMA\n // (`fields.validateMany`, issue #3322), so it also covers the\n // `include=client` paths served by other services; the repository\n // layer redacts unauthorized values without dropping rows.\n return this.repository.findMany(\n await decodeQuery(query, { schema: clientSchema, actor }),\n );\n }\n\n async getOne(\n idOrName: string,\n actor: ActorContext,\n query?: Record<string, any>,\n realmId?: string,\n ): Promise<Client> {\n let isMe = !!actor.identity &&\n actor.identity.type === 'client' &&\n (\n actor.identity.data.id === idOrName ||\n actor.identity.data.name === idOrName\n );\n\n if (!isMe) {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n }\n\n const entity = await this.repository.findOne(\n idOrName,\n await decodeQuery(query, {\n schema: clientSchema, \n parameters: ['fields', 'relations'], \n actor, \n }),\n realmId,\n );\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (isMe && actor.identity!.data.id !== entity.id) {\n isMe = false;\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n }\n\n if (\n !isMe &&\n entity.secret &&\n !entity.secretEncrypted &&\n !entity.secretHashed\n ) {\n await actor.permissionEvaluator.evaluateOneOf({\n name: CLIENT_READ_PERMISSIONS,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Client,\n created: boolean \n }> {\n let group: string;\n\n const realm = typeof data.realmId === 'string' ?\n await this.realmRepository.resolve(data.realmId) :\n undefined;\n\n let entity: Client | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n if (realm) {\n where.realmId = realm.id;\n }\n\n entity = await this.repository.findOneWithSecret(where);\n if (!entity && options.updateOnly) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n let isSelfEdit = false;\n if (entity) {\n try {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_UPDATE });\n } catch (e) {\n if (\n !actor.identity ||\n actor.identity.type !== 'client' ||\n actor.identity.data.id !== entity.id\n ) {\n throw e;\n }\n isSelfEdit = true;\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_SELF_MANAGE });\n }\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n // Reserve the system-provisioned client names (`system`, `web`) so an\n // API caller can't create or rename a client onto them — that would\n // collide on unique(name, realmId) or shadow the builtIn client.\n // Provisioning and runtime hooks bypass this service, so they remain\n // free to manage the reserved clients. builtIn clients are exempt\n // (they ARE the provisioned ones) but API callers can never produce a\n // builtIn client since the validator strips the flag.\n if (\n typeof validated.name === 'string' &&\n CLIENT_RESERVED_NAMES.includes(validated.name) &&\n !(entity && entity.builtIn && entity.name === validated.name)\n ) {\n throw new ValidationError(`The client name '${validated.name}' is reserved.`);\n }\n\n await this.repository.validateJoinColumns(validated);\n await this.repository.checkUniqueness(validated, entity || undefined);\n\n const credentialsService = new ClientCredentialsService();\n\n if (entity) {\n if (\n !isSelfEdit &&\n !validated.realmId &&\n !entity.realmId\n ) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realmId = actorRealmId;\n }\n }\n\n if (isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_SELF_MANAGE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n }\n\n entity = this.repository.merge(entity, validated);\n\n if (!isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_UPDATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n if (entity.authMethod === ClientAuthMethod.SECRET) {\n if (!validated.secret && !entity.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n if (validated.secret) {\n entity.secret = await credentialsService.protect(validated.secret, entity);\n }\n } else {\n entity.secret = null;\n entity.secretHashed = false;\n entity.secretEncrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n if (!validated.realmId) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realmId = actorRealmId;\n }\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_CREATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n\n entity = this.repository.create(validated);\n\n if (entity.authMethod === ClientAuthMethod.SECRET) {\n if (!validated.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n entity.secret = await credentialsService.protect(validated.secret, validated);\n } else {\n entity.secret = null;\n entity.secretHashed = false;\n entity.secretEncrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: true, \n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Client> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_DELETE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,IAAae,gBAAb,cAAmCL,sBAAAA;CACrBM;CAEAC;CAEAC;CAEV,YAAYC,KAA2B;EACnC,MAAK;EACL,KAAKH,aAAaG,IAAIH;EACtB,KAAKC,kBAAkBE,IAAIF;EAC3B,KAAKC,YAAY,IAAIV,gBAAAA;CACzB;CAEA,MAAMY,QACFC,OACAC,OAC+C;EAC/C,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAAEC,MAAMb,wBAAwB,CAAA;EAMjF,OAAO,KAAKI,WAAWU,SACnB,MAAMb,YAAYQ,OAAO;GAAEM,QAAQb;GAAcQ;EAAM,CAAA,CAAA;CAE/D;CAEA,MAAMM,OACFC,UACAP,OACAD,OACAS,SACe;EACf,IAAIC,OAAO,CAAC,CAACT,MAAMU,YACfV,MAAMU,SAASC,SAAS,aAEpBX,MAAMU,SAASE,KAAKC,OAAON,YAC3BP,MAAMU,SAASE,KAAKT,SAASI;EAGrC,IAAI,CAACE,MACD,MAAMT,MAAMC,oBAAoBC,iBAAiB,EAAEC,MAAMb,wBAAwB,CAAA;EAGrF,MAAMwB,SAAS,MAAM,KAAKpB,WAAWqB,QACjCR,UACA,MAAMhB,YAAYQ,OAAO;GACrBM,QAAQb;GACRwB,YAAY,CAAC,UAAU,WAAY;GACnChB;EACJ,CAAA,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AOG,SAAS,MAAM+B,mBAAmBQ,QAAQd,UAAUzB,QAAQyB,SAAAA;EACvE,OAAO;GACH5B,OAAOG,SAAS;GAChBH,OAAOK,eAAe;GACtBL,OAAOI,kBAAkB;EAC7B;EAEA,MAAM,KAAKxB,WAAW8B,KAAKV,MAAAA;EAE3B,OAAO;GACHA;GACA2C,SAAS;EACb;CACJ;CAEA,MAAMC,OACF7C,IACAb,OACe;EACf,MAAMA,MAAMC,oBAAoBkC,YAAY,EAAEhC,MAAMhB,eAAewE,cAAc,CAAA;EAEjF,MAAM7C,SAAS,MAAM,KAAKpB,WAAWkE,UAAU,EAAE/C,GAAG,CAAA;EACpD,IAAI,CAACC,QACD,MAAM,IAAIhC,oBAAAA;EAGd,MAAMkB,MAAMC,oBAAoBkD,SAAS;GACrChD,MAAMhB,eAAewE;GACrB/C,MAAMjC,iBAAiB;KAAGD,kBAAkB2C,aAAaP;IAAQ,GAAG,KAAKQ,mBAAmBR,MAAAA;GAAQ,CAAA;EACxG,CAAA;EAEA,MAAM,EAAED,IAAIgD,aAAa/C;EACzB,MAAM,KAAKpB,WAAWoE,OAAOhD,MAAAA;EAC7BA,OAAOD,KAAKgD;EAEZ,OAAO/C;CACX;AACJ"}
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","definePolicyData","ValidatorGroup","isUUID","EntityNotFoundError","ValidationError","CLIENT_RESERVED_NAMES","ClientAuthMethod","ClientValidator","PermissionName","AbstractEntityService","ClientCredentialsService","CLIENT_READ_PERMISSIONS","decodeQuery","clientSchema","ClientService","repository","realmRepository","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","findMany","schema","getOne","idOrName","realmId","isMe","identity","type","data","id","entity","findOne","parameters","secret","secretEncrypted","secretHashed","evaluateOneOf","ATTRIBUTES","resourceRealmMatch","create","save","undefined","update","updateOnly","options","group","realm","resolve","where","findOneWithSecret","isSelfEdit","preEvaluate","CLIENT_UPDATE","e","CLIENT_SELF_MANAGE","UPDATE","CLIENT_CREATE","CREATE","validated","run","includes","builtIn","validateJoinColumns","checkUniqueness","credentialsService","actorRealmId","getActorRealmId","evaluate","merge","authMethod","SECRET","generateSecret","protect","created","delete","CLIENT_DELETE","findOneBy","entityId","remove"],"sources":["../../../../src/core/entities/client/service.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 { BuiltInPolicyType, definePolicyData } from '@authup/access';\nimport { ValidatorGroup, isUUID } from '@authup/kit';\nimport { EntityNotFoundError, ValidationError } from '@authup/errors';\nimport {\n CLIENT_RESERVED_NAMES,\n ClientAuthMethod,\n ClientValidator,\n PermissionName,\n} from '@authup/core-kit';\nimport type { Client } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IRealmRepository } from '../realm/types.ts';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport { ClientCredentialsService } from '../../authentication/credential/entities/client/module.ts';\nimport type { IClientRepository, IClientService } from './types.ts';\nimport { CLIENT_READ_PERMISSIONS } from './constants.ts';\nimport { decodeQuery } from '../../query/index.ts';\nimport { clientSchema } from './schema.ts';\n\nexport type ClientServiceContext = {\n repository: IClientRepository;\n realmRepository: IRealmRepository;\n};\n\nexport class ClientService extends AbstractEntityService implements IClientService {\n protected repository: IClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected validator: ClientValidator;\n\n constructor(ctx: ClientServiceContext) {\n super();\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.validator = new ClientValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<Client>> {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n\n // The per-row `secret` visibility gate lives on the client SCHEMA\n // (`fields.validateMany`, issue #3322), so it also covers the\n // `include=client` paths served by other services; the repository\n // layer redacts unauthorized values without dropping rows.\n return this.repository.findMany(\n await decodeQuery(query, { schema: clientSchema, actor }),\n );\n }\n\n async getOne(\n idOrName: string,\n actor: ActorContext,\n query?: Record<string, any>,\n realmId?: string,\n ): Promise<Client> {\n let isMe = !!actor.identity &&\n actor.identity.type === 'client' &&\n (\n actor.identity.data.id === idOrName ||\n actor.identity.data.name === idOrName\n );\n\n if (!isMe) {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n }\n\n const entity = await this.repository.findOne(\n idOrName,\n await decodeQuery(query, {\n schema: clientSchema, \n parameters: ['fields', 'relations'], \n actor, \n }),\n realmId,\n );\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (isMe && actor.identity!.data.id !== entity.id) {\n isMe = false;\n await actor.permissionEvaluator.preEvaluateOneOf({ name: CLIENT_READ_PERMISSIONS });\n }\n\n if (\n !isMe &&\n entity.secret &&\n !entity.secretEncrypted &&\n !entity.secretHashed\n ) {\n await actor.permissionEvaluator.evaluateOneOf({\n name: CLIENT_READ_PERMISSIONS,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Client,\n created: boolean \n }> {\n let group: string;\n\n const realm = typeof data.realmId === 'string' ?\n await this.realmRepository.resolve(data.realmId) :\n undefined;\n\n let entity: Client | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n if (realm) {\n where.realmId = realm.id;\n }\n\n entity = await this.repository.findOneWithSecret(where);\n // Only a NAME key may upsert-create. A UUID addresses one specific\n // row, so a miss is a 404 (creating would write a different id).\n if (!entity && (options.updateOnly || where.id)) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n let isSelfEdit = false;\n if (entity) {\n try {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_UPDATE });\n } catch (e) {\n if (\n !actor.identity ||\n actor.identity.type !== 'client' ||\n actor.identity.data.id !== entity.id\n ) {\n throw e;\n }\n isSelfEdit = true;\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_SELF_MANAGE });\n }\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n // Reserve the system-provisioned client names (`system`, the console\n // clients) so an API caller can't create or rename a client onto them — that would\n // collide on unique(name, realmId) or shadow the builtIn client.\n // Provisioning and runtime hooks bypass this service, so they remain\n // free to manage the reserved clients. builtIn clients are exempt\n // (they ARE the provisioned ones) but API callers can never produce a\n // builtIn client since the validator strips the flag.\n if (\n typeof validated.name === 'string' &&\n CLIENT_RESERVED_NAMES.includes(validated.name) &&\n !(entity && entity.builtIn && entity.name === validated.name)\n ) {\n throw new ValidationError(`The client name '${validated.name}' is reserved.`);\n }\n\n await this.repository.validateJoinColumns(validated);\n await this.repository.checkUniqueness(validated, entity || undefined);\n\n const credentialsService = new ClientCredentialsService();\n\n if (entity) {\n if (\n !isSelfEdit &&\n !validated.realmId &&\n !entity.realmId\n ) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realmId = actorRealmId;\n }\n }\n\n if (isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_SELF_MANAGE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n }\n\n entity = this.repository.merge(entity, validated);\n\n if (!isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_UPDATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n if (entity.authMethod === ClientAuthMethod.SECRET) {\n if (!validated.secret && !entity.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n if (validated.secret) {\n entity.secret = await credentialsService.protect(validated.secret, entity);\n }\n } else {\n entity.secret = null;\n entity.secretHashed = false;\n entity.secretEncrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n if (!validated.realmId) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realmId = actorRealmId;\n }\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_CREATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n\n entity = this.repository.create(validated);\n\n if (entity.authMethod === ClientAuthMethod.SECRET) {\n if (!validated.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n entity.secret = await credentialsService.protect(validated.secret, validated);\n } else {\n entity.secret = null;\n entity.secretHashed = false;\n entity.secretEncrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: true, \n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Client> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_DELETE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n ent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KAAKpB,WAAWkE,UAAU,EAAE/C,GAAG,CAAA;EACpD,IAAI,CAACC,QACD,MAAM,IAAIhC,oBAAAA;EAGd,MAAMkB,MAAMC,oBAAoBkD,SAAS;GACrChD,MAAMhB,eAAewE;GACrB/C,MAAMjC,iBAAiB;KAAGD,kBAAkB2C,aAAaP;IAAQ,GAAG,KAAKQ,mBAAmBR,MAAAA;GAAQ,CAAA;EACxG,CAAA;EAEA,MAAM,EAAED,IAAIgD,aAAa/C;EACzB,MAAM,KAAKpB,WAAWoE,OAAOhD,MAAAA;EAC7BA,OAAOD,KAAKgD;EAEZ,OAAO/C;CACX;AACJ"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Client, Realm } from '@authup/core-kit';
|
|
2
|
+
import type { Logger } from '@authup/server-kit';
|
|
3
|
+
import type { IClientScopeRepository } from '../client-scope/types.ts';
|
|
4
|
+
import type { IScopeRepository } from '../scope/types.ts';
|
|
5
|
+
import type { IClientRepository, ISystemClientProvisioner, SystemClientDefinition } from './types.ts';
|
|
6
|
+
export type SystemClientProvisionerContext = {
|
|
7
|
+
clientRepository: IClientRepository;
|
|
8
|
+
scopeRepository: IScopeRepository;
|
|
9
|
+
clientScopeRepository: IClientScopeRepository;
|
|
10
|
+
appOrigins: string[];
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The scopes every system client is granted.
|
|
15
|
+
*
|
|
16
|
+
* `global` lets the issued token drive the management API (parity with the
|
|
17
|
+
* legacy password-grant admin login); `openid` yields the id-token.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SYSTEM_CLIENT_SCOPE_NAMES: string[];
|
|
20
|
+
/**
|
|
21
|
+
* The public (PKCE) clients provisioned for every realm (plan 079):
|
|
22
|
+
*
|
|
23
|
+
* - `admin-console` — authup's own admin console (apps/client-admin-console),
|
|
24
|
+
* - `account-console` — the account self-service surface (plan 080; each
|
|
25
|
+
* definition gets its own `<origin>/**` patterns from
|
|
26
|
+
* `buildSystemClientAttributes`, so an inert row adds no redirect
|
|
27
|
+
* surface).
|
|
28
|
+
*
|
|
29
|
+
* Downstream RPs register their own clients (per realm, or in every realm
|
|
30
|
+
* via a wildcard realm provisioning entry, plan 082) — the former shared
|
|
31
|
+
* `web` client was removed.
|
|
32
|
+
*
|
|
33
|
+
* `displayName` is seeded at CREATE only and never re-asserted by the
|
|
34
|
+
* MERGE, so an admin may relabel a client without the next boot undoing it.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SYSTEM_CLIENT_DEFINITIONS: SystemClientDefinition[];
|
|
37
|
+
/**
|
|
38
|
+
* Build the MERGE-owned attribute set for a realm's system client.
|
|
39
|
+
*
|
|
40
|
+
* `builtIn` makes the client auto-consent in the /authorize flow and
|
|
41
|
+
* protects it from the API reserved-name guard.
|
|
42
|
+
*
|
|
43
|
+
* `grantTypes` is an enforced allowlist (`assertClientGrantAllowed` at the
|
|
44
|
+
* /token grants and the /authorize code-request verifier; null = allow-all),
|
|
45
|
+
* so it must list every flow the client uses. `redirectUri` and
|
|
46
|
+
* `postLogoutRedirectUri` are each one `<origin>/**` wildcard per trusted
|
|
47
|
+
* origin (matched by isSimpleMatch) — deliberately the shared app-origin
|
|
48
|
+
* set for every definition: `redirectUri` is re-asserted on each boot, so a
|
|
49
|
+
* separately-hosted surface (plan 078 "relocatable by choice") registers
|
|
50
|
+
* its origin via TRUSTED_ORIGINS rather than editing the client row.
|
|
51
|
+
*
|
|
52
|
+
* The `scope` column is descriptive only. Scope authorization resolves
|
|
53
|
+
* through the `auth_client_scopes` junction, which
|
|
54
|
+
* `SystemClientProvisioner.ensureForRealm` fills from the definition's
|
|
55
|
+
* `scopeNames`.
|
|
56
|
+
*
|
|
57
|
+
* `accessPolicyId` and `displayName` are deliberately NOT part of this set:
|
|
58
|
+
* the MERGE must neither wipe an admin-bound access policy nor undo a
|
|
59
|
+
* relabel.
|
|
60
|
+
*/
|
|
61
|
+
export declare function buildSystemClientAttributes(definition: SystemClientDefinition, realm: Realm | {
|
|
62
|
+
id: string;
|
|
63
|
+
}, appOrigins: string[]): Partial<Client>;
|
|
64
|
+
export declare class SystemClientProvisioner implements ISystemClientProvisioner {
|
|
65
|
+
protected clientRepository: IClientRepository;
|
|
66
|
+
protected scopeRepository: IScopeRepository;
|
|
67
|
+
protected clientScopeRepository: IClientScopeRepository;
|
|
68
|
+
protected appOrigins: string[];
|
|
69
|
+
protected logger?: Logger;
|
|
70
|
+
constructor(ctx: SystemClientProvisionerContext);
|
|
71
|
+
ensureForRealm(realm: Realm | {
|
|
72
|
+
id: string;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Upsert the client row itself.
|
|
76
|
+
*
|
|
77
|
+
* Every system client name is reserved (`CLIENT_RESERVED_NAMES`), so the
|
|
78
|
+
* row belongs to the system whatever state it is in. A non-built-in one
|
|
79
|
+
* predates the reservation and is taken over rather than left to shadow
|
|
80
|
+
* the realm's system client.
|
|
81
|
+
*/
|
|
82
|
+
protected ensureClient(definition: SystemClientDefinition, realm: Realm | {
|
|
83
|
+
id: string;
|
|
84
|
+
}): Promise<Client>;
|
|
85
|
+
/**
|
|
86
|
+
* Bind the definition's scopes through `auth_client_scopes`. That
|
|
87
|
+
* junction is the only source the /authorize code-request verifier reads
|
|
88
|
+
* scopes from.
|
|
89
|
+
*
|
|
90
|
+
* Additive like the attribute MERGE above: an extra scope an admin bound
|
|
91
|
+
* by hand is left in place.
|
|
92
|
+
*/
|
|
93
|
+
protected ensureScopes(definition: SystemClientDefinition, client: Client): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=system-clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-clients.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/system-clients.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE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