@authup/server-core 1.0.0-beta.51 → 1.0.0-beta.52
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/data-source/options/module.d.ts.map +1 -1
- package/dist/adapters/database/data-source/options/module.mjs +2 -0
- package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
- package/dist/adapters/database/domains/client/entity.d.ts +1 -0
- package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/entity.mjs +5 -0
- package/dist/adapters/database/domains/client/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/index.d.ts +1 -0
- package/dist/adapters/database/domains/index.d.ts.map +1 -1
- package/dist/adapters/database/domains/index.mjs +3 -1
- package/dist/adapters/database/domains/session/entity.mjs +1 -1
- package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/session-token/entity.d.ts +17 -0
- package/dist/adapters/database/domains/session-token/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/session-token/entity.mjs +95 -0
- package/dist/adapters/database/domains/session-token/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/session-token/index.d.ts +2 -0
- package/dist/adapters/database/domains/session-token/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/session-token/index.mjs +5 -0
- package/dist/adapters/database/index.mjs +2 -1
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts +28 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs +85 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.d.ts +28 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs +79 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs.map +1 -0
- package/dist/adapters/database/subscriber/module.d.ts.map +1 -1
- package/dist/adapters/database/subscriber/module.mjs +4 -3
- package/dist/adapters/database/subscriber/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts +2 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +10 -4
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +3 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +5 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts +2 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +12 -5
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts +2 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/guess.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts +9 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs +21 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs.map +1 -0
- package/dist/adapters/http/adapters/oauth2/index.mjs +2 -1
- package/dist/adapters/http/controllers/entities/client/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/client-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/client-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/client-scope/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs +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 +4 -3
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/index.d.ts +1 -0
- package/dist/adapters/http/controllers/entities/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.mjs +3 -1
- package/dist/adapters/http/controllers/entities/permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/permission-policy/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/policy/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs +11 -8
- package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/robot/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/robot-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/robot-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role-attribute/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/scope/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/session/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/session/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/session/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/session/module.d.ts +16 -0
- package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/session/module.mjs +102 -0
- package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/user/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/user-attribute/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/user-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/user-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/index.mjs +3 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +22 -9
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +7 -4
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.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/index.d.ts +3 -0
- package/dist/adapters/http/controllers/workflows/logout/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/logout/module.d.ts +14 -0
- package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/module.mjs +101 -0
- package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/types.d.ts +9 -0
- package/dist/adapters/http/controllers/workflows/logout/types.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/types.mjs +4 -0
- package/dist/adapters/http/controllers/workflows/status/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.mjs +10 -3
- package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/types.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
- package/dist/adapters/http/index.mjs +16 -12
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs +2 -0
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/logger.d.ts +1 -0
- package/dist/adapters/http/middleware/built-in/logger.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/logger.mjs +23 -2
- package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.mjs +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/realm-resolver/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs +3 -8
- package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +2 -2
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -1
- package/dist/adapters/http/middleware/index.mjs +2 -2
- package/dist/adapters/http/request/helpers/index.d.ts +1 -0
- package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
- package/dist/adapters/http/request/helpers/index.mjs +2 -1
- package/dist/adapters/http/request/helpers/session-id.d.ts +9 -0
- package/dist/adapters/http/request/helpers/session-id.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/session-id.mjs +19 -0
- package/dist/adapters/http/request/helpers/session-id.mjs.map +1 -0
- package/dist/adapters/http/request/index.mjs +2 -1
- package/dist/adapters/http/request/permission/module.d.ts.map +1 -1
- package/dist/adapters/http/request/permission/module.mjs +4 -2
- package/dist/adapters/http/request/permission/module.mjs.map +1 -1
- package/dist/adapters/http/ui/index.d.ts +1 -0
- package/dist/adapters/http/ui/index.d.ts.map +1 -1
- package/dist/adapters/http/ui/index.mjs +2 -1
- package/dist/adapters/http/ui/internal-http-client.d.ts +22 -0
- package/dist/adapters/http/ui/internal-http-client.d.ts.map +1 -0
- package/dist/adapters/http/ui/internal-http-client.mjs +52 -0
- package/dist/adapters/http/ui/internal-http-client.mjs.map +1 -0
- package/dist/adapters/http/ui/render.d.ts.map +1 -1
- package/dist/adapters/http/ui/render.mjs +5 -2
- package/dist/adapters/http/ui/render.mjs.map +1 -1
- package/dist/adapters/http/ui/types.d.ts +12 -0
- package/dist/adapters/http/ui/types.d.ts.map +1 -1
- package/dist/app/modules/authentication/repositories/session.d.ts +5 -2
- package/dist/app/modules/authentication/repositories/session.d.ts.map +1 -1
- package/dist/app/modules/authentication/repositories/session.mjs +63 -0
- package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
- package/dist/app/modules/config/constants.d.ts +4 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +4 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +6 -1
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +8 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +31 -2
- 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.d.ts +1 -0
- package/dist/app/modules/database/module.d.ts.map +1 -1
- package/dist/app/modules/database/module.mjs +19 -6
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.mjs +10 -6
- package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/helpers.d.ts +11 -0
- package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/helpers.mjs +12 -1
- package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs +8 -8
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/permission/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/permission/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/policy/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/policy/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/realm/repository.d.ts +1 -0
- package/dist/app/modules/database/repositories/realm/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/realm/repository.mjs +14 -1
- package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/robot/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/robot/repository.mjs +8 -6
- package/dist/app/modules/database/repositories/robot/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/role/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs +2 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/scope/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/scope/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/user/repository.mjs +8 -5
- package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs +2 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/http/constants.d.ts +4 -2
- package/dist/app/modules/http/constants.d.ts.map +1 -1
- package/dist/app/modules/http/constants.mjs +4 -2
- package/dist/app/modules/http/constants.mjs.map +1 -1
- package/dist/app/modules/http/module.d.ts +10 -0
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +30 -0
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +4 -2
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +57 -15
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +1 -1
- package/dist/app/modules/oauth2/constants.d.ts +2 -1
- package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
- package/dist/app/modules/oauth2/constants.mjs +1 -0
- package/dist/app/modules/oauth2/constants.mjs.map +1 -1
- package/dist/app/modules/oauth2/module.d.ts.map +1 -1
- package/dist/app/modules/oauth2/module.mjs +10 -4
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/index.d.ts +1 -0
- package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/index.mjs +3 -1
- package/dist/app/modules/oauth2/repositories/session-token/index.d.ts +2 -0
- package/dist/app/modules/oauth2/repositories/session-token/index.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/session-token/index.mjs +5 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts +17 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.mjs +63 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.mjs.map +1 -0
- package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.mjs +1 -0
- package/dist/app/modules/provisioning/sources/default/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 +2 -1
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/cli/commands/migration.d.ts.map +1 -1
- package/dist/cli/commands/migration.mjs +12 -4
- package/dist/cli/commands/migration.mjs.map +1 -1
- package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
- package/dist/components/oauth2-cleaner/module.mjs +3 -0
- package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
- package/dist/core/authentication/index.mjs +2 -1
- package/dist/core/authentication/session/index.mjs +2 -1
- package/dist/core/authentication/session/module.d.ts +1 -0
- package/dist/core/authentication/session/module.d.ts.map +1 -1
- package/dist/core/authentication/session/module.mjs +3 -0
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/authentication/session/types.d.ts +34 -0
- package/dist/core/authentication/session/types.d.ts.map +1 -1
- package/dist/core/authentication/session/types.mjs +18 -1
- package/dist/core/authentication/session/types.mjs.map +1 -0
- package/dist/core/entities/client/web-client.d.ts +5 -3
- package/dist/core/entities/client/web-client.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.mjs +8 -4
- package/dist/core/entities/client/web-client.mjs.map +1 -1
- package/dist/core/entities/index.d.ts +1 -0
- package/dist/core/entities/index.d.ts.map +1 -1
- package/dist/core/entities/index.mjs +3 -1
- package/dist/core/entities/realm/types.d.ts +9 -0
- package/dist/core/entities/realm/types.d.ts.map +1 -1
- package/dist/core/entities/session/index.d.ts +3 -0
- package/dist/core/entities/session/index.d.ts.map +1 -0
- package/dist/core/entities/session/index.mjs +5 -0
- package/dist/core/entities/session/service.d.ts +27 -0
- package/dist/core/entities/session/service.d.ts.map +1 -0
- package/dist/core/entities/session/service.mjs +151 -0
- package/dist/core/entities/session/service.mjs.map +1 -0
- package/dist/core/entities/session/types.d.ts +48 -0
- package/dist/core/entities/session/types.d.ts.map +1 -0
- package/dist/core/entities/session/types.mjs +4 -0
- package/dist/core/entities/user/service.d.ts +1 -0
- 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/identity/password-recovery/service.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +2 -1
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/types.d.ts +1 -0
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/permission/checker/service.d.ts.map +1 -1
- package/dist/core/identity/permission/checker/service.mjs +6 -5
- package/dist/core/identity/permission/checker/service.mjs.map +1 -1
- package/dist/core/identity/policy/checker/service.d.ts.map +1 -1
- package/dist/core/identity/policy/checker/service.mjs +6 -5
- package/dist/core/identity/policy/checker/service.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/facebook.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/facebook.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/facebook.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/github.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/github.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/github.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/google.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/google.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/google.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/instagram.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/instagram.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/instagram.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/paypal.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/paypal.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/paypal.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +7 -2
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts +2 -0
- package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs +5 -0
- package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs.map +1 -1
- package/dist/core/identity/registration/service.d.ts.map +1 -1
- package/dist/core/identity/registration/service.mjs +9 -6
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +1 -0
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/identity/resolver/module.d.ts +7 -0
- package/dist/core/identity/resolver/module.d.ts.map +1 -1
- package/dist/core/identity/resolver/module.mjs +7 -1
- package/dist/core/identity/resolver/module.mjs.map +1 -1
- package/dist/core/index.mjs +10 -2
- package/dist/core/oauth2/authorization/code/index.mjs +1 -0
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts +0 -1
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/module.mjs +7 -7
- package/dist/core/oauth2/authorization/code/issuer/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts +11 -2
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.mjs +1 -0
- package/dist/core/oauth2/authorization/code/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/types.d.ts +1 -0
- package/dist/core/oauth2/authorization/code/verifier/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.mjs +19 -5
- package/dist/core/oauth2/authorization/code-request/validator.mjs.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 +13 -10
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts +7 -0
- package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.d.ts +2 -1
- package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.mjs +19 -2
- package/dist/core/oauth2/authorization/helpers.mjs.map +1 -1
- package/dist/core/oauth2/authorization/module.d.ts +6 -7
- package/dist/core/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/module.mjs +24 -38
- package/dist/core/oauth2/authorization/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/types.d.ts +15 -7
- package/dist/core/oauth2/authorization/types.d.ts.map +1 -1
- package/dist/core/oauth2/client/grant-type.d.ts +9 -0
- package/dist/core/oauth2/client/grant-type.d.ts.map +1 -0
- package/dist/core/oauth2/client/grant-type.mjs +18 -0
- package/dist/core/oauth2/client/grant-type.mjs.map +1 -0
- package/dist/core/oauth2/client/index.d.ts +1 -0
- package/dist/core/oauth2/client/index.d.ts.map +1 -1
- package/dist/core/oauth2/client/index.mjs +2 -1
- package/dist/core/oauth2/end-session/index.d.ts +4 -0
- package/dist/core/oauth2/end-session/index.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/index.mjs +6 -0
- package/dist/core/oauth2/end-session/service.d.ts +30 -0
- package/dist/core/oauth2/end-session/service.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/service.mjs +117 -0
- package/dist/core/oauth2/end-session/service.mjs.map +1 -0
- package/dist/core/oauth2/end-session/types.d.ts +55 -0
- package/dist/core/oauth2/end-session/types.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/types.mjs +4 -0
- package/dist/core/oauth2/end-session/validator.d.ts +6 -0
- package/dist/core/oauth2/end-session/validator.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/validator.mjs +23 -0
- package/dist/core/oauth2/end-session/validator.mjs.map +1 -0
- package/dist/core/oauth2/grant-types/authorize.d.ts +19 -2
- package/dist/core/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.mjs +53 -10
- package/dist/core/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.d.ts +21 -2
- package/dist/core/oauth2/grant-types/refresh-token.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs +55 -9
- package/dist/core/oauth2/grant-types/refresh-token.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/types.d.ts +22 -2
- package/dist/core/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/core/oauth2/index.d.ts +2 -0
- package/dist/core/oauth2/index.d.ts.map +1 -1
- package/dist/core/oauth2/index.mjs +7 -3
- package/dist/core/oauth2/session-token/index.d.ts +2 -0
- package/dist/core/oauth2/session-token/index.d.ts.map +1 -0
- package/dist/core/oauth2/session-token/index.mjs +4 -0
- package/dist/core/oauth2/session-token/types.d.ts +70 -0
- package/dist/core/oauth2/session-token/types.d.ts.map +1 -0
- package/dist/core/oauth2/session-token/types.mjs +4 -0
- package/dist/core/oauth2/token/issuer/access/module.d.ts +3 -1
- package/dist/core/oauth2/token/issuer/access/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/access/module.mjs +12 -1
- package/dist/core/oauth2/token/issuer/access/module.mjs.map +1 -1
- package/dist/core/oauth2/token/issuer/open-id/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/open-id/module.mjs +1 -1
- package/dist/core/oauth2/token/issuer/open-id/module.mjs.map +1 -1
- package/dist/core/oauth2/token/issuer/refresh/module.d.ts +3 -1
- package/dist/core/oauth2/token/issuer/refresh/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/refresh/module.mjs +12 -1
- package/dist/core/oauth2/token/issuer/refresh/module.mjs.map +1 -1
- package/dist/core/oauth2/token/revoker/module.d.ts +3 -1
- package/dist/core/oauth2/token/revoker/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.mjs +4 -1
- package/dist/core/oauth2/token/revoker/module.mjs.map +1 -1
- package/dist/core/oauth2/token/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/verifier/module.mjs +4 -4
- package/dist/core/oauth2/token/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/token/verifier/types.d.ts +6 -0
- package/dist/core/oauth2/token/verifier/types.d.ts.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.mjs +3 -2
- package/dist/core/provisioning/entities/client/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/index.d.ts +1 -0
- package/dist/core/provisioning/entities/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/index.mjs +5 -1
- package/dist/core/provisioning/entities/permission/index.d.ts +1 -0
- package/dist/core/provisioning/entities/permission/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/permission/index.mjs +2 -1
- package/dist/core/provisioning/entities/permission/relations-validator.d.ts +6 -0
- package/dist/core/provisioning/entities/permission/relations-validator.d.ts.map +1 -0
- package/dist/core/provisioning/entities/permission/relations-validator.mjs +17 -0
- package/dist/core/provisioning/entities/permission/relations-validator.mjs.map +1 -0
- package/dist/core/provisioning/entities/permission/validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/permission/validator.mjs +3 -0
- package/dist/core/provisioning/entities/permission/validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/policy/index.d.ts +1 -0
- package/dist/core/provisioning/entities/policy/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/policy/index.mjs +2 -1
- package/dist/core/provisioning/entities/policy/validator.d.ts +6 -0
- package/dist/core/provisioning/entities/policy/validator.d.ts.map +1 -0
- package/dist/core/provisioning/entities/policy/validator.mjs +26 -0
- package/dist/core/provisioning/entities/policy/validator.mjs.map +1 -0
- package/dist/core/provisioning/entities/realm/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/realm/relations-validator.mjs +9 -52
- package/dist/core/provisioning/entities/realm/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/role/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/role/relations-validator.mjs +4 -0
- package/dist/core/provisioning/entities/role/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/root/validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/root/validator.mjs +11 -26
- package/dist/core/provisioning/entities/root/validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/utils.d.ts +10 -0
- package/dist/core/provisioning/entities/utils.d.ts.map +1 -0
- package/dist/core/provisioning/entities/utils.mjs +29 -0
- package/dist/core/provisioning/entities/utils.mjs.map +1 -0
- package/dist/core/provisioning/index.mjs +4 -1
- package/dist/core/provisioning/synchronizer/base.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/base.mjs.map +1 -1
- package/dist/index.mjs +16 -11
- package/dist/swagger.json +531 -23
- package/dist/ui/client/.vite/ssr-manifest.json +1140 -114
- package/dist/ui/client/assets/{index-Cd3uWit-.js → index-CP9HCHoS.js} +15 -15
- package/dist/ui/client/assets/index-VM4JXBXw.css +2 -0
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/assets/{multipart-parser-Dn2Ly9xU.js → multipart-parser-BCMy8Xwv.js} +11 -1
- package/dist/ui/server/assets/{multipart-parser-DyM9gi59.js → multipart-parser-BVY8pIV2.js} +11 -1
- package/dist/ui/server/server.js +8643 -6992
- package/package.json +15 -15
- package/dist/ui/client/assets/index-DoCTwJ8M.css +0 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/adapters/database/migrations/postgres/1783325495597-Default.ts
|
|
5
|
+
/**
|
|
6
|
+
* Refresh token rotation + replay detection (plan 016).
|
|
7
|
+
*
|
|
8
|
+
* - Widens auth_sessions.ip_address 15 -> 45 (IPv6-sized; the old length was
|
|
9
|
+
* IPv4-only, a latent truncation bug).
|
|
10
|
+
* - Adds auth_session_tokens: one durable row per issued access/refresh token,
|
|
11
|
+
* FK to auth_sessions (ON DELETE CASCADE). The row is the authority for
|
|
12
|
+
* refresh-token validity (consume/replay/revoke); the cache stays the
|
|
13
|
+
* verification fast-path.
|
|
14
|
+
*
|
|
15
|
+
* BREAKING: at deploy the table is empty, so every in-flight refresh token has
|
|
16
|
+
* no row and its first refresh returns invalid_grant — active users
|
|
17
|
+
* re-authenticate once (hard cutover, RT horizon 3 days).
|
|
18
|
+
*
|
|
19
|
+
* down() narrows ip_address back to 15, which fails if any IPv6 value was
|
|
20
|
+
* stored (best-effort, per the 1779300000000 precedent).
|
|
21
|
+
*
|
|
22
|
+
* Also adds auth_clients.post_logout_redirect_uri (plan 042) — a dedicated
|
|
23
|
+
* OIDC RP-Initiated Logout allow-list, no longer conflated with redirect_uri.
|
|
24
|
+
* Folded into this still-unreleased migration rather than a new file.
|
|
25
|
+
*/ var Default1783325495597 = class {
|
|
26
|
+
name = "Default1783325495597";
|
|
27
|
+
async up(queryRunner) {
|
|
28
|
+
await queryRunner.query(`
|
|
29
|
+
ALTER TABLE "auth_sessions" ALTER COLUMN "ip_address" TYPE character varying(45)
|
|
30
|
+
`);
|
|
31
|
+
await queryRunner.query(`
|
|
32
|
+
CREATE TABLE "auth_session_tokens" (
|
|
33
|
+
"id" uuid NOT NULL,
|
|
34
|
+
"session_id" uuid NOT NULL,
|
|
35
|
+
"kind" character varying(16) NOT NULL,
|
|
36
|
+
"parent_id" uuid,
|
|
37
|
+
"refresh_token_id" uuid,
|
|
38
|
+
"ip_address" character varying(45) NOT NULL,
|
|
39
|
+
"user_agent" character varying(512) NOT NULL,
|
|
40
|
+
"consumed_at" character varying(28),
|
|
41
|
+
"revoked_at" character varying(28),
|
|
42
|
+
"expires_at" character varying(28) NOT NULL,
|
|
43
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
44
|
+
CONSTRAINT "PK_auth_session_tokens" PRIMARY KEY ("id")
|
|
45
|
+
)
|
|
46
|
+
`);
|
|
47
|
+
await queryRunner.query("CREATE INDEX \"IDX_auth_session_tokens_session_id\" ON \"auth_session_tokens\" (\"session_id\")");
|
|
48
|
+
await queryRunner.query("CREATE INDEX \"IDX_auth_session_tokens_kind\" ON \"auth_session_tokens\" (\"kind\")");
|
|
49
|
+
await queryRunner.query("CREATE INDEX \"IDX_auth_session_tokens_expires_at\" ON \"auth_session_tokens\" (\"expires_at\")");
|
|
50
|
+
await queryRunner.query(`
|
|
51
|
+
ALTER TABLE "auth_session_tokens"
|
|
52
|
+
ADD CONSTRAINT "FK_auth_session_tokens_session_id" FOREIGN KEY ("session_id") REFERENCES "auth_sessions"("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
|
53
|
+
`);
|
|
54
|
+
await queryRunner.query(`
|
|
55
|
+
ALTER TABLE "auth_clients" ADD "post_logout_redirect_uri" text
|
|
56
|
+
`);
|
|
57
|
+
}
|
|
58
|
+
async down(queryRunner) {
|
|
59
|
+
await queryRunner.query(`
|
|
60
|
+
ALTER TABLE "auth_clients" DROP COLUMN "post_logout_redirect_uri"
|
|
61
|
+
`);
|
|
62
|
+
await queryRunner.query(`
|
|
63
|
+
ALTER TABLE "auth_session_tokens" DROP CONSTRAINT "FK_auth_session_tokens_session_id"
|
|
64
|
+
`);
|
|
65
|
+
await queryRunner.query("DROP INDEX \"public\".\"IDX_auth_session_tokens_expires_at\"");
|
|
66
|
+
await queryRunner.query("DROP INDEX \"public\".\"IDX_auth_session_tokens_kind\"");
|
|
67
|
+
await queryRunner.query("DROP INDEX \"public\".\"IDX_auth_session_tokens_session_id\"");
|
|
68
|
+
await queryRunner.query(`
|
|
69
|
+
DROP TABLE "auth_session_tokens"
|
|
70
|
+
`);
|
|
71
|
+
await queryRunner.query(`
|
|
72
|
+
ALTER TABLE "auth_sessions" ALTER COLUMN "ip_address" TYPE character varying(15)
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { Default1783325495597 };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=1783325495597-Default.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1783325495597-Default.mjs","names":["Default1783325495597","name","up","queryRunner","query","down"],"sources":["../../../../../src/adapters/database/migrations/postgres/1783325495597-Default.ts"],"sourcesContent":["import type { MigrationInterface, QueryRunner } from 'typeorm';\n\n/**\n * Refresh token rotation + replay detection (plan 016).\n *\n * - Widens auth_sessions.ip_address 15 -> 45 (IPv6-sized; the old length was\n * IPv4-only, a latent truncation bug).\n * - Adds auth_session_tokens: one durable row per issued access/refresh token,\n * FK to auth_sessions (ON DELETE CASCADE). The row is the authority for\n * refresh-token validity (consume/replay/revoke); the cache stays the\n * verification fast-path.\n *\n * BREAKING: at deploy the table is empty, so every in-flight refresh token has\n * no row and its first refresh returns invalid_grant — active users\n * re-authenticate once (hard cutover, RT horizon 3 days).\n *\n * down() narrows ip_address back to 15, which fails if any IPv6 value was\n * stored (best-effort, per the 1779300000000 precedent).\n *\n * Also adds auth_clients.post_logout_redirect_uri (plan 042) — a dedicated\n * OIDC RP-Initiated Logout allow-list, no longer conflated with redirect_uri.\n * Folded into this still-unreleased migration rather than a new file.\n */\nexport class Default1783325495597 implements MigrationInterface {\n name = 'Default1783325495597';\n\n public async up(queryRunner: QueryRunner): Promise<void> {\n await queryRunner.query(`\n ALTER TABLE \"auth_sessions\" ALTER COLUMN \"ip_address\" TYPE character varying(45)\n `);\n\n await queryRunner.query(`\n CREATE TABLE \"auth_session_tokens\" (\n \"id\" uuid NOT NULL,\n \"session_id\" uuid NOT NULL,\n \"kind\" character varying(16) NOT NULL,\n \"parent_id\" uuid,\n \"refresh_token_id\" uuid,\n \"ip_address\" character varying(45) NOT NULL,\n \"user_agent\" character varying(512) NOT NULL,\n \"consumed_at\" character varying(28),\n \"revoked_at\" character varying(28),\n \"expires_at\" character varying(28) NOT NULL,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT now(),\n CONSTRAINT \"PK_auth_session_tokens\" PRIMARY KEY (\"id\")\n )\n `);\n await queryRunner.query('CREATE INDEX \"IDX_auth_session_tokens_session_id\" ON \"auth_session_tokens\" (\"session_id\")');\n await queryRunner.query('CREATE INDEX \"IDX_auth_session_tokens_kind\" ON \"auth_session_tokens\" (\"kind\")');\n await queryRunner.query('CREATE INDEX \"IDX_auth_session_tokens_expires_at\" ON \"auth_session_tokens\" (\"expires_at\")');\n\n await queryRunner.query(`\n ALTER TABLE \"auth_session_tokens\"\n ADD CONSTRAINT \"FK_auth_session_tokens_session_id\" FOREIGN KEY (\"session_id\") REFERENCES \"auth_sessions\"(\"id\") ON DELETE CASCADE ON UPDATE NO ACTION\n `);\n\n // Dedicated post-logout redirect allow-list for OIDC RP-Initiated\n // Logout (plan 042) — no longer conflated with the login redirect_uri.\n await queryRunner.query(`\n ALTER TABLE \"auth_clients\" ADD \"post_logout_redirect_uri\" text\n `);\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n await queryRunner.query(`\n ALTER TABLE \"auth_clients\" DROP COLUMN \"post_logout_redirect_uri\"\n `);\n\n await queryRunner.query(`\n ALTER TABLE \"auth_session_tokens\" DROP CONSTRAINT \"FK_auth_session_tokens_session_id\"\n `);\n await queryRunner.query('DROP INDEX \"public\".\"IDX_auth_session_tokens_expires_at\"');\n await queryRunner.query('DROP INDEX \"public\".\"IDX_auth_session_tokens_kind\"');\n await queryRunner.query('DROP INDEX \"public\".\"IDX_auth_session_tokens_session_id\"');\n await queryRunner.query(`\n DROP TABLE \"auth_session_tokens\"\n `);\n\n await queryRunner.query(`\n ALTER TABLE \"auth_sessions\" ALTER COLUMN \"ip_address\" TYPE character varying(15)\n `);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAuBA,IAAaA,uBAAb,MAAaA;CACTC,OAAO;CAEP,MAAaC,GAAGC,aAAyC;EACrD,MAAMA,YAAYC,MAAM;;SAEvB;EAED,MAAMD,YAAYC,MAAM;;;;;;;;;;;;;;;SAevB;EACD,MAAMD,YAAYC,MAAM,iGAAA;EACxB,MAAMD,YAAYC,MAAM,qFAAA;EACxB,MAAMD,YAAYC,MAAM,iGAAA;EAExB,MAAMD,YAAYC,MAAM;;;SAGvB;EAID,MAAMD,YAAYC,MAAM;;SAEvB;CACL;CAEA,MAAaC,KAAKF,aAAyC;EACvD,MAAMA,YAAYC,MAAM;;SAEvB;EAED,MAAMD,YAAYC,MAAM;;SAEvB;EACD,MAAMD,YAAYC,MAAM,8DAAA;EACxB,MAAMD,YAAYC,MAAM,wDAAA;EACxB,MAAMD,YAAYC,MAAM,8DAAA;EACxB,MAAMD,YAAYC,MAAM;;SAEvB;EAED,MAAMD,YAAYC,MAAM;;SAEvB;CACL;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/adapters/database/sub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AO,CAAC,GAAG,CAAC;cActC,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,GAAI,OAAO,CAAC,IAAI,CAAC;cAQ9D,OAAO,CAAC,KAAK,EAAE,GAAG,sBAAsB,EAAE,EAAE,IAAI,EAAE,CAAC,GAAI,OAAO,CAAC,IAAI,CAAC;CAcvF"}
|
|
@@ -44,9 +44,10 @@ var EntitySubscriber = class {
|
|
|
44
44
|
await this.publish(EntityDefaultEventName.UPDATED, event.entity);
|
|
45
45
|
}
|
|
46
46
|
async afterRemove(event) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
await this.
|
|
47
|
+
const entity = event.databaseEntity ?? event.entity;
|
|
48
|
+
if (!entity) return;
|
|
49
|
+
await this.dropCacheKeys(event.connection, entity);
|
|
50
|
+
await this.publish(EntityDefaultEventName.DELETED, entity);
|
|
50
51
|
}
|
|
51
52
|
async dropCacheKeys(connection, data) {
|
|
52
53
|
if (!this.ctx.cache || !connection.queryResultCache) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["EntityDefaultEventName","buildEntityChannelName","buildEntityNamespaceName","buildEntityDestinations","type","realmIds","data","destinations","channel","id","items","seen","Set","realmId","has","add","push","namespace","EntitySubscriber","ctx","publisher","setPublisher","listenTo","target","afterInsert","event","entity","cache","onInsert","dropCacheKeys","connection","publish","CREATED","afterUpdate","UPDATED","afterRemove","DELETED","queryResultCache","remove","keys","safePublish","content"],"sources":["../../../../src/adapters/database/subscriber/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 { EntityType } from '@authup/core-kit';\nimport {\n EntityDefaultEventName,\n buildEntityChannelName,\n buildEntityNamespaceName,\n} from '@authup/core-kit';\nimport type { DomainEventDestinations, IDomainEventPublisher } from '@authup/server-kit';\nimport type {\n DataSource,\n EntitySubscriberInterface,\n InsertEvent,\n ObjectLiteral,\n RemoveEvent,\n UpdateEvent,\n} from 'typeorm';\nimport type { EntitySubscriberContext } from './types.ts';\n\nexport function buildEntityDestinations<T extends ObjectLiteral>(\n type: `${EntityType}`,\n realmIds?: (data: T) => (string | null | undefined)[],\n) : (data: T) => DomainEventDestinations {\n return (data) => {\n const destinations : DomainEventDestinations = [\n { channel: (id) => buildEntityChannelName(type, id) },\n ];\n\n if (realmIds) {\n const items = realmIds(data);\n const seen = new Set<string>();\n for (const realmId of items) {\n if (realmId && !seen.has(realmId)) {\n seen.add(realmId);\n destinations.push({\n channel: (id) => buildEntityChannelName(type, id),\n namespace: buildEntityNamespaceName(realmId),\n });\n }\n }\n }\n\n return destinations;\n };\n}\n\nexport class EntitySubscriber<T extends ObjectLiteral> implements EntitySubscriberInterface<T> {\n protected ctx : EntitySubscriberContext<T>;\n\n protected publisher? : IDomainEventPublisher;\n\n constructor(ctx: EntitySubscriberContext<T>) {\n this.ctx = ctx;\n this.publisher = ctx.publisher;\n }\n\n setPublisher(publisher: IDomainEventPublisher) : void {\n this.publisher = publisher;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n listenTo() : Function | string {\n return this.ctx.target;\n }\n\n async afterInsert(event: InsertEvent<T>): Promise<any> {\n if (!event.entity) {\n return;\n }\n\n if (this.ctx.cache && this.ctx.cache.onInsert) {\n await this.dropCacheKeys(event.connection, event.entity);\n }\n\n await this.publish(EntityDefaultEventName.CREATED, event.entity);\n }\n\n async afterUpdate(event: UpdateEvent<T>): Promise<any> {\n if (!event.entity) {\n return;\n }\n\n await this.dropCacheKeys(event.connection, event.entity as T);\n\n await this.publish(EntityDefaultEventName.UPDATED, event.entity as T);\n }\n\n async afterRemove(event: RemoveEvent<T>): Promise<any> {\n
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["EntityDefaultEventName","buildEntityChannelName","buildEntityNamespaceName","buildEntityDestinations","type","realmIds","data","destinations","channel","id","items","seen","Set","realmId","has","add","push","namespace","EntitySubscriber","ctx","publisher","setPublisher","listenTo","target","afterInsert","event","entity","cache","onInsert","dropCacheKeys","connection","publish","CREATED","afterUpdate","UPDATED","afterRemove","databaseEntity","DELETED","queryResultCache","remove","keys","safePublish","content"],"sources":["../../../../src/adapters/database/subscriber/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 { EntityType } from '@authup/core-kit';\nimport {\n EntityDefaultEventName,\n buildEntityChannelName,\n buildEntityNamespaceName,\n} from '@authup/core-kit';\nimport type { DomainEventDestinations, IDomainEventPublisher } from '@authup/server-kit';\nimport type {\n DataSource,\n EntitySubscriberInterface,\n InsertEvent,\n ObjectLiteral,\n RemoveEvent,\n UpdateEvent,\n} from 'typeorm';\nimport type { EntitySubscriberContext } from './types.ts';\n\nexport function buildEntityDestinations<T extends ObjectLiteral>(\n type: `${EntityType}`,\n realmIds?: (data: T) => (string | null | undefined)[],\n) : (data: T) => DomainEventDestinations {\n return (data) => {\n const destinations : DomainEventDestinations = [\n { channel: (id) => buildEntityChannelName(type, id) },\n ];\n\n if (realmIds) {\n const items = realmIds(data);\n const seen = new Set<string>();\n for (const realmId of items) {\n if (realmId && !seen.has(realmId)) {\n seen.add(realmId);\n destinations.push({\n channel: (id) => buildEntityChannelName(type, id),\n namespace: buildEntityNamespaceName(realmId),\n });\n }\n }\n }\n\n return destinations;\n };\n}\n\nexport class EntitySubscriber<T extends ObjectLiteral> implements EntitySubscriberInterface<T> {\n protected ctx : EntitySubscriberContext<T>;\n\n protected publisher? : IDomainEventPublisher;\n\n constructor(ctx: EntitySubscriberContext<T>) {\n this.ctx = ctx;\n this.publisher = ctx.publisher;\n }\n\n setPublisher(publisher: IDomainEventPublisher) : void {\n this.publisher = publisher;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n listenTo() : Function | string {\n return this.ctx.target;\n }\n\n async afterInsert(event: InsertEvent<T>): Promise<any> {\n if (!event.entity) {\n return;\n }\n\n if (this.ctx.cache && this.ctx.cache.onInsert) {\n await this.dropCacheKeys(event.connection, event.entity);\n }\n\n await this.publish(EntityDefaultEventName.CREATED, event.entity);\n }\n\n async afterUpdate(event: UpdateEvent<T>): Promise<any> {\n if (!event.entity) {\n return;\n }\n\n await this.dropCacheKeys(event.connection, event.entity as T);\n\n await this.publish(EntityDefaultEventName.UPDATED, event.entity as T);\n }\n\n async afterRemove(event: RemoveEvent<T>): Promise<any> {\n // remove() strips the primary key from event.entity before the\n // subscriber runs — databaseEntity is the pre-removal row and keeps\n // the id-keyed cache invalidation (and the DELETED payload) intact.\n const entity = event.databaseEntity ?? event.entity;\n if (!entity) {\n return;\n }\n\n await this.dropCacheKeys(event.connection, entity);\n\n await this.publish(EntityDefaultEventName.DELETED, entity);\n }\n\n protected async dropCacheKeys(connection: DataSource, data: T) : Promise<void> {\n if (!this.ctx.cache || !connection.queryResultCache) {\n return;\n }\n\n await connection.queryResultCache.remove(this.ctx.cache.keys(data));\n }\n\n protected async publish(event: `${EntityDefaultEventName}`, data: T) : Promise<void> {\n if (!this.publisher) {\n return;\n }\n\n await this.publisher.safePublish({\n content: {\n type: this.ctx.type,\n event,\n data,\n },\n destinations: this.ctx.destinations(data),\n });\n }\n}\n"],"mappings":";;;;;AAwBA,SAAgBG,wBACZC,MACAC,UAAqD;CAErD,QAAQC,SAAAA;EACJ,MAAMC,eAAyC,CAC3C,EAAEC,UAAUC,OAAOR,uBAAuBG,MAAMK,EAAAA,EAAI,CAAA;EAGxD,IAAIJ,UAAU;GACV,MAAMK,QAAQL,SAASC,IAAAA;GACvB,MAAMK,uBAAO,IAAIC,IAAAA;GACjB,KAAK,MAAMC,WAAWH,OAClB,IAAIG,WAAW,CAACF,KAAKG,IAAID,OAAAA,GAAU;IAC/BF,KAAKI,IAAIF,OAAAA;IACTN,aAAaS,KAAK;KACdR,UAAUC,OAAOR,uBAAuBG,MAAMK,EAAAA;KAC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M,KAAKe,IAAIf;IACfqB;IACAnB;GACJ;GACAC,cAAc,KAAKY,IAAIZ,aAAaD,IAAAA;EACxC,CAAA;CACJ;AACJ"}
|
|
@@ -4,6 +4,7 @@ import.meta.url;
|
|
|
4
4
|
import { HTTPOAuth2Authorizer } from "./oauth2/authorization/module.mjs";
|
|
5
5
|
import { extractClientCredentialsFromRequest, readStringField } from "./oauth2/grant-types/utils/credentials.mjs";
|
|
6
6
|
import { guessOauth2GrantTypeByRequest } from "./oauth2/grant-types/utils/guess.mjs";
|
|
7
|
+
import { readRealmHint } from "./oauth2/grant-types/utils/realm.mjs";
|
|
7
8
|
import { HTTPOAuth2AuthorizeGrant } from "./oauth2/grant-types/authorize.mjs";
|
|
8
9
|
import { HTTPClientCredentialsGrant } from "./oauth2/grant-types/client-credentials.mjs";
|
|
9
10
|
import { HTTPOAuth2IdentityGrantType } from "./oauth2/grant-types/identity.mjs";
|
|
@@ -11,4 +12,4 @@ import { HTTPPasswordGrant } from "./oauth2/grant-types/password.mjs";
|
|
|
11
12
|
import { HTTPOAuth2RefreshTokenGrant } from "./oauth2/grant-types/refresh_token.mjs";
|
|
12
13
|
import { HTTPRobotCredentialsGrant } from "./oauth2/grant-types/robot-credentials.mjs";
|
|
13
14
|
import "./oauth2/index.mjs";
|
|
14
|
-
export { HTTPClientCredentialsGrant, HTTPOAuth2AuthorizeGrant, HTTPOAuth2Authorizer, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, extractClientCredentialsFromRequest, guessOauth2GrantTypeByRequest, readStringField };
|
|
15
|
+
export { HTTPClientCredentialsGrant, HTTPOAuth2AuthorizeGrant, HTTPOAuth2Authorizer, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, extractClientCredentialsFromRequest, guessOauth2GrantTypeByRequest, readRealmHint, readStringField };
|
|
@@ -6,6 +6,7 @@ import { OAuth2Authorization } from "../../../../../core/oauth2/authorization/mo
|
|
|
6
6
|
import "../../../../../core/index.mjs";
|
|
7
7
|
import { useRequestIdentityOrFail } from "../../../request/helpers/identity.mjs";
|
|
8
8
|
import { readFromLocations } from "../../../request/helpers/locations.mjs";
|
|
9
|
+
import { useRequestSessionId } from "../../../request/helpers/session-id.mjs";
|
|
9
10
|
import "../../../request/index.mjs";
|
|
10
11
|
//#region src/adapters/http/adapters/oauth2/authorization/module.ts
|
|
11
12
|
var HTTPOAuth2Authorizer = class extends OAuth2Authorization {
|
|
@@ -20,7 +21,7 @@ var HTTPOAuth2Authorizer = class extends OAuth2Authorization {
|
|
|
20
21
|
const codeRequestValidated = await this.validateWithRequest(event);
|
|
21
22
|
const { data } = await this.codeRequestVerifier.verify(codeRequestValidated);
|
|
22
23
|
const identity = useRequestIdentityOrFail(event);
|
|
23
|
-
return this.authorize(data, identity.raw);
|
|
24
|
+
return this.authorize(data, identity.raw, { sessionId: useRequestSessionId(event) });
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Validate authorization request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["OAuth2Authorization","OAuth2AuthorizationCodeRequestValidator","readFromLocations","useRequestIdentityOrFail","HTTPOAuth2Authorizer","codeRequestVerifier","requestValidator","ctx","authorizeWithRequest","event","codeRequestValidated","validateWithRequest","data","verify","identity","authorize","raw","run"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/authorization/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 { IAppEvent } from 'routup';\nimport type { OAuth2AuthorizationCodeRequest } from '@authup/core-kit';\nimport type { IOAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationResult } from '../../../../../core/index.ts';\nimport { OAuth2Authorization, OAuth2AuthorizationCodeRequestValidator } from '../../../../../core/index.ts';\nimport { readFromLocations, useRequestIdentityOrFail } from '../../../request/index.ts';\nimport type { HTTPOAuth2AuthorizationManagerContext } from './types.ts';\n\nexport class HTTPOAuth2Authorizer extends OAuth2Authorization {\n protected codeRequestVerifier : IOAuth2AuthorizationCodeRequestVerifier;\n\n protected requestValidator : OAuth2AuthorizationCodeRequestValidator;\n\n constructor(ctx: HTTPOAuth2AuthorizationManagerContext) {\n super(ctx);\n\n this.codeRequestVerifier = ctx.codeRequestVerifier;\n\n this.requestValidator = new OAuth2AuthorizationCodeRequestValidator();\n }\n\n async authorizeWithRequest(event: IAppEvent) : Promise<OAuth2AuthorizationResult> {\n const codeRequestValidated = await this.validateWithRequest(event);\n\n const { data } = await this.codeRequestVerifier.verify(codeRequestValidated);\n\n const identity = useRequestIdentityOrFail(event);\n\n return this.authorize(data, identity.raw);\n }\n\n /**\n * Validate authorization request.\n *\n * @throws OAuth2Error\n */\n async validateWithRequest(\n event: IAppEvent,\n ) : Promise<OAuth2AuthorizationCodeRequest> {\n const data = await readFromLocations(event, ['body', 'query']);\n return this.requestValidator.run(data);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["OAuth2Authorization","OAuth2AuthorizationCodeRequestValidator","readFromLocations","useRequestIdentityOrFail","useRequestSessionId","HTTPOAuth2Authorizer","codeRequestVerifier","requestValidator","ctx","authorizeWithRequest","event","codeRequestValidated","validateWithRequest","data","verify","identity","authorize","raw","sessionId","run"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/authorization/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 { IAppEvent } from 'routup';\nimport type { OAuth2AuthorizationCodeRequest } from '@authup/core-kit';\nimport type { IOAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationResult } from '../../../../../core/index.ts';\nimport { OAuth2Authorization, OAuth2AuthorizationCodeRequestValidator } from '../../../../../core/index.ts';\nimport { readFromLocations, useRequestIdentityOrFail, useRequestSessionId } from '../../../request/index.ts';\nimport type { HTTPOAuth2AuthorizationManagerContext } from './types.ts';\n\nexport class HTTPOAuth2Authorizer extends OAuth2Authorization {\n protected codeRequestVerifier : IOAuth2AuthorizationCodeRequestVerifier;\n\n protected requestValidator : OAuth2AuthorizationCodeRequestValidator;\n\n constructor(ctx: HTTPOAuth2AuthorizationManagerContext) {\n super(ctx);\n\n this.codeRequestVerifier = ctx.codeRequestVerifier;\n\n this.requestValidator = new OAuth2AuthorizationCodeRequestValidator();\n }\n\n async authorizeWithRequest(event: IAppEvent) : Promise<OAuth2AuthorizationResult> {\n const codeRequestValidated = await this.validateWithRequest(event);\n\n const { data } = await this.codeRequestVerifier.verify(codeRequestValidated);\n\n const identity = useRequestIdentityOrFail(event);\n\n return this.authorize(data, identity.raw, { sessionId: useRequestSessionId(event) });\n }\n\n /**\n * Validate authorization request.\n *\n * @throws OAuth2Error\n */\n async validateWithRequest(\n event: IAppEvent,\n ) : Promise<OAuth2AuthorizationCodeRequest> {\n const data = await readFromLocations(event, ['body', 'query']);\n return this.requestValidator.run(data);\n }\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAaK,uBAAb,cAA0CL,oBAAAA;CAC5BM;CAEAC;CAEV,YAAYC,KAA4C;EACpD,MAAMA,GAAAA;EAEN,KAAKF,sBAAsBE,IAAIF;EAE/B,KAAKC,mBAAmB,IAAIN,wCAAAA;CAChC;CAEA,MAAMQ,qBAAqBC,OAAuD;EAC9E,MAAMC,uBAAuB,MAAM,KAAKC,oBAAoBF,KAAAA;EAE5D,MAAM,EAAEG,SAAS,MAAM,KAAKP,oBAAoBQ,OAAOH,oBAAAA;EAEvD,MAAMI,WAAWZ,yBAAyBO,KAAAA;EAE1C,OAAO,KAAKM,UAAUH,MAAME,SAASE,KAAK,EAAEC,WAAWd,oBAAoBM,KAAAA,EAAO,CAAA;CACtF;;;;;IAOA,MAAME,oBACFF,OACwC;EACxC,MAAMG,OAAO,MAAMX,kBAAkBQ,OAAO,CAAC,QAAQ,OAAA,CAAQ;EAC7D,OAAO,KAAKH,iBAAiBY,IAAIN,IAAAA;CACrC;AACJ"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { OAuth2TokenGrantResponse } from '@authup/specs';
|
|
2
2
|
import type { IAppEvent } from 'routup';
|
|
3
3
|
import { OAuth2AuthorizeGrant } from '../../../../../core/index.ts';
|
|
4
|
-
import type { IOAuth2AuthorizationCodeVerifier, OAuth2ClientAuthenticator } from '../../../../../core/index.ts';
|
|
4
|
+
import type { IOAuth2AuthorizationCodeVerifier, IRealmRepository, OAuth2ClientAuthenticator } from '../../../../../core/index.ts';
|
|
5
5
|
import type { HTTPOAuth2AuthorizeGrantContext, IHTTPOAuth2Grant } from './types.ts';
|
|
6
6
|
export declare class HTTPOAuth2AuthorizeGrant extends OAuth2AuthorizeGrant implements IHTTPOAuth2Grant {
|
|
7
7
|
protected codeVerifier: IOAuth2AuthorizationCodeVerifier;
|
|
8
8
|
protected clientAuthenticator: OAuth2ClientAuthenticator;
|
|
9
|
+
protected realmRepository: IRealmRepository;
|
|
9
10
|
constructor(ctx: HTTPOAuth2AuthorizeGrantContext);
|
|
10
11
|
runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse>;
|
|
11
12
|
protected pickStringParam(body: Record<string, any> | undefined, query: Record<string, any> | undefined, key: string): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/authorize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAI9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/authorize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAI9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAA4B,MAAM,8BAA8B,CAAC;AAC9F,OAAO,KAAK,EACR,gCAAgC,EAChC,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGpF,qBAAa,wBAAyB,SAAQ,oBAAqB,YAAW,gBAAgB;IAC1F,SAAS,CAAC,YAAY,EAAG,gCAAgC,CAAC;IAE1D,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;IAE1D,SAAS,CAAC,eAAe,EAAG,gBAAgB,CAAC;gBAEjC,GAAG,EAAE,+BAA+B;IAQ1C,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAgCzE,SAAS,CAAC,eAAe,CACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACtC,GAAG,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS;CAIxB"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { assertClientGrantAllowed } from "../../../../../core/oauth2/client/grant-type.mjs";
|
|
4
5
|
import { OAuth2AuthorizeGrant } from "../../../../../core/oauth2/grant-types/authorize.mjs";
|
|
5
6
|
import "../../../../../core/index.mjs";
|
|
6
7
|
import { extractClientCredentialsFromRequest } from "./utils/credentials.mjs";
|
|
8
|
+
import { readRealmHint } from "./utils/realm.mjs";
|
|
7
9
|
import "./utils/index.mjs";
|
|
8
|
-
import { OAuth2RequestError } from "@authup/specs";
|
|
10
|
+
import { OAuth2RequestError, OAuth2TokenGrant } from "@authup/specs";
|
|
9
11
|
import { getRequestHeader, getRequestIP } from "routup";
|
|
10
12
|
import { readRequestBody } from "@routup/basic/body";
|
|
11
13
|
import { useRequestQuery } from "@routup/basic/query";
|
|
@@ -13,10 +15,12 @@ import { useRequestQuery } from "@routup/basic/query";
|
|
|
13
15
|
var HTTPOAuth2AuthorizeGrant = class extends OAuth2AuthorizeGrant {
|
|
14
16
|
codeVerifier;
|
|
15
17
|
clientAuthenticator;
|
|
18
|
+
realmRepository;
|
|
16
19
|
constructor(ctx) {
|
|
17
20
|
super(ctx);
|
|
18
21
|
this.codeVerifier = ctx.codeVerifier;
|
|
19
22
|
this.clientAuthenticator = ctx.clientAuthenticator;
|
|
23
|
+
this.realmRepository = ctx.realmRepository;
|
|
20
24
|
}
|
|
21
25
|
async runWithRequest(event) {
|
|
22
26
|
const body = await readRequestBody(event);
|
|
@@ -26,13 +30,15 @@ var HTTPOAuth2AuthorizeGrant = class extends OAuth2AuthorizeGrant {
|
|
|
26
30
|
const codeVerifier = this.pickStringParam(body, query, "code_verifier");
|
|
27
31
|
if (!code) throw OAuth2RequestError.malformed();
|
|
28
32
|
const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);
|
|
29
|
-
const
|
|
30
|
-
const client = await this.clientAuthenticator.authenticate(clientId, clientSecret,
|
|
33
|
+
const realm = await this.realmRepository.resolve(readRealmHint(body, query), true);
|
|
34
|
+
const client = await this.clientAuthenticator.authenticate(clientId, clientSecret, realm.id);
|
|
35
|
+
assertClientGrantAllowed(client, OAuth2TokenGrant.AUTHORIZATION_CODE);
|
|
31
36
|
const entity = await this.codeVerifier.verify(code, {
|
|
32
37
|
redirectUri,
|
|
33
38
|
codeVerifier,
|
|
34
39
|
clientId: client.id,
|
|
35
|
-
clientIsPublic: !client.is_confidential
|
|
40
|
+
clientIsPublic: !client.is_confidential,
|
|
41
|
+
realmId: client.realm_id
|
|
36
42
|
});
|
|
37
43
|
return this.runWith(entity, {
|
|
38
44
|
ipAddress: getRequestIP(event, { trustProxy: true }) ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.mjs","names":["OAuth2RequestError","readRequestBody","useRequestQuery","getRequestHeader","getRequestIP","OAuth2AuthorizeGrant","extractClientCredentialsFromRequest","HTTPOAuth2AuthorizeGrant","codeVerifier","clientAuthenticator","ctx","runWithRequest","event","body","query","code","pickStringParam","redirectUri","malformed","clientId","clientSecret","
|
|
1
|
+
{"version":3,"file":"authorize.mjs","names":["OAuth2RequestError","OAuth2TokenGrant","readRequestBody","useRequestQuery","getRequestHeader","getRequestIP","OAuth2AuthorizeGrant","assertClientGrantAllowed","extractClientCredentialsFromRequest","readRealmHint","HTTPOAuth2AuthorizeGrant","codeVerifier","clientAuthenticator","realmRepository","ctx","runWithRequest","event","body","query","code","pickStringParam","redirectUri","malformed","clientId","clientSecret","realm","resolve","client","authenticate","id","AUTHORIZATION_CODE","entity","verify","clientIsPublic","is_confidential","realmId","realm_id","runWith","ipAddress","trustProxy","undefined","userAgent","key","value","length"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/authorize.ts"],"sourcesContent":["/*\n * Copyright (c) 2025-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 { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2RequestError, OAuth2TokenGrant } from '@authup/specs';\nimport { readRequestBody } from '@routup/basic/body';\nimport { useRequestQuery } from '@routup/basic/query';\nimport type { IAppEvent } from 'routup';\nimport { getRequestHeader, getRequestIP } from 'routup';\nimport { OAuth2AuthorizeGrant, assertClientGrantAllowed } from '../../../../../core/index.ts';\nimport type {\n IOAuth2AuthorizationCodeVerifier,\n IRealmRepository,\n OAuth2ClientAuthenticator,\n} from '../../../../../core/index.ts';\nimport type { HTTPOAuth2AuthorizeGrantContext, IHTTPOAuth2Grant } from './types.ts';\nimport { extractClientCredentialsFromRequest, readRealmHint } from './utils/index.ts';\n\nexport class HTTPOAuth2AuthorizeGrant extends OAuth2AuthorizeGrant implements IHTTPOAuth2Grant {\n protected codeVerifier : IOAuth2AuthorizationCodeVerifier;\n\n protected clientAuthenticator : OAuth2ClientAuthenticator;\n\n protected realmRepository : IRealmRepository;\n\n constructor(ctx: HTTPOAuth2AuthorizeGrantContext) {\n super(ctx);\n\n this.codeVerifier = ctx.codeVerifier;\n this.clientAuthenticator = ctx.clientAuthenticator;\n this.realmRepository = ctx.realmRepository;\n }\n\n async runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse> {\n const body = await readRequestBody(event);\n const query = useRequestQuery(event);\n\n const code = this.pickStringParam(body, query, 'code');\n const redirectUri = this.pickStringParam(body, query, 'redirect_uri');\n const codeVerifier = this.pickStringParam(body, query, 'code_verifier');\n if (!code) {\n throw OAuth2RequestError.malformed();\n }\n\n const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);\n const realm = await this.realmRepository.resolve(readRealmHint(body, query), true);\n\n const client = await this.clientAuthenticator.authenticate(clientId, clientSecret, realm.id);\n\n assertClientGrantAllowed(client, OAuth2TokenGrant.AUTHORIZATION_CODE);\n\n const entity = await this.codeVerifier.verify(code, {\n redirectUri,\n codeVerifier,\n clientId: client.id,\n clientIsPublic: !client.is_confidential,\n realmId: client.realm_id,\n });\n\n return this.runWith(entity, {\n ipAddress: getRequestIP(event, { trustProxy: true }) ?? undefined,\n userAgent: getRequestHeader(event, 'user-agent') ?? undefined,\n });\n }\n\n protected pickStringParam(\n body: Record<string, any> | undefined,\n query: Record<string, any> | undefined,\n key: string,\n ): string | undefined {\n const value = body?.[key] ?? query?.[key];\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAaU,2BAAb,cAA8CJ,qBAAAA;CAChCK;CAEAC;CAEAC;CAEV,YAAYC,KAAsC;EAC9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
1
|
-
{"version":3,"file":"client-credentials.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/client-credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"client-credentials.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/client-credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAA4B,MAAM,8BAA8B,CAAC;AAChG,OAAO,KAAK,EAAE,uCAAuC,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG5F,qBAAa,0BAA2B,SAAQ,sBAAuB,YAAW,gBAAgB;IAC9F,SAAS,CAAC,aAAa,EAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;gBAEhD,GAAG,EAAE,uCAAuC;IAMlD,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAkB5E"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { assertClientGrantAllowed } from "../../../../../core/oauth2/client/grant-type.mjs";
|
|
4
5
|
import { ClientCredentialsGrant } from "../../../../../core/oauth2/grant-types/client-credentials.mjs";
|
|
5
6
|
import "../../../../../core/index.mjs";
|
|
6
7
|
import { extractClientCredentialsFromRequest } from "./utils/credentials.mjs";
|
|
7
8
|
import "./utils/index.mjs";
|
|
8
9
|
import { EntityCredentialsInvalidError } from "@authup/errors";
|
|
10
|
+
import { OAuth2TokenGrant } from "@authup/specs";
|
|
9
11
|
import { getRequestHeader, getRequestIP } from "routup";
|
|
10
12
|
import { readRequestBody } from "@routup/basic/body";
|
|
11
13
|
//#region src/adapters/http/adapters/oauth2/grant-types/client-credentials.ts
|
|
@@ -20,6 +22,7 @@ var HTTPClientCredentialsGrant = class extends ClientCredentialsGrant {
|
|
|
20
22
|
const realmId = (await readRequestBody(event))?.realm_id;
|
|
21
23
|
if (!clientId) throw new EntityCredentialsInvalidError({ entity: "client" });
|
|
22
24
|
const client = await this.authenticator.authenticate(clientId, clientSecret ?? "", realmId);
|
|
25
|
+
assertClientGrantAllowed(client, OAuth2TokenGrant.CLIENT_CREDENTIALS);
|
|
23
26
|
return this.runWith(client, {
|
|
24
27
|
ipAddress: getRequestIP(event, { trustProxy: true }) ?? void 0,
|
|
25
28
|
userAgent: getRequestHeader(event, "user-agent") ?? void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-credentials.mjs","names":["readRequestBody","EntityCredentialsInvalidError","getRequestHeader","getRequestIP","ClientCredentialsGrant","extractClientCredentialsFromRequest","HTTPClientCredentialsGrant","authenticator","ctx","runWithRequest","event","clientId","clientSecret","body","realmId","realm_id","entity","client","authenticate","runWith","ipAddress","trustProxy","undefined","userAgent"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/client-credentials.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 { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { readRequestBody } from '@routup/basic/body';\nimport type { Client } from '@authup/core-kit';\nimport { EntityCredentialsInvalidError } from '@authup/errors';\nimport type { IAppEvent } from 'routup';\nimport { getRequestHeader, getRequestIP } from 'routup';\nimport type { ICredentialsAuthenticator } from '../../../../../core/index.ts';\nimport { ClientCredentialsGrant } from '../../../../../core/index.ts';\nimport type { HTTPOAuth2ClientCredentialsGrantContext, IHTTPOAuth2Grant } from './types.ts';\nimport { extractClientCredentialsFromRequest } from './utils/index.ts';\n\nexport class HTTPClientCredentialsGrant extends ClientCredentialsGrant implements IHTTPOAuth2Grant {\n protected authenticator : ICredentialsAuthenticator<Client>;\n\n constructor(ctx: HTTPOAuth2ClientCredentialsGrantContext) {\n super(ctx);\n\n this.authenticator = ctx.authenticator;\n }\n\n async runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse> {\n const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);\n const body = await readRequestBody(event);\n const realmId = body?.realm_id;\n\n if (!clientId) {\n throw new EntityCredentialsInvalidError({ entity: 'client' });\n }\n\n const client = await this.authenticator.authenticate(clientId, clientSecret ?? '', realmId);\n\n return this.runWith(client, {\n ipAddress: getRequestIP(event, { trustProxy: true }) ?? undefined,\n userAgent: getRequestHeader(event, 'user-agent') ?? undefined,\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-credentials.mjs","names":["OAuth2TokenGrant","readRequestBody","EntityCredentialsInvalidError","getRequestHeader","getRequestIP","ClientCredentialsGrant","assertClientGrantAllowed","extractClientCredentialsFromRequest","HTTPClientCredentialsGrant","authenticator","ctx","runWithRequest","event","clientId","clientSecret","body","realmId","realm_id","entity","client","authenticate","CLIENT_CREDENTIALS","runWith","ipAddress","trustProxy","undefined","userAgent"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/client-credentials.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 { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2TokenGrant } from '@authup/specs';\nimport { readRequestBody } from '@routup/basic/body';\nimport type { Client } from '@authup/core-kit';\nimport { EntityCredentialsInvalidError } from '@authup/errors';\nimport type { IAppEvent } from 'routup';\nimport { getRequestHeader, getRequestIP } from 'routup';\nimport type { ICredentialsAuthenticator } from '../../../../../core/index.ts';\nimport { ClientCredentialsGrant, assertClientGrantAllowed } from '../../../../../core/index.ts';\nimport type { HTTPOAuth2ClientCredentialsGrantContext, IHTTPOAuth2Grant } from './types.ts';\nimport { extractClientCredentialsFromRequest } from './utils/index.ts';\n\nexport class HTTPClientCredentialsGrant extends ClientCredentialsGrant implements IHTTPOAuth2Grant {\n protected authenticator : ICredentialsAuthenticator<Client>;\n\n constructor(ctx: HTTPOAuth2ClientCredentialsGrantContext) {\n super(ctx);\n\n this.authenticator = ctx.authenticator;\n }\n\n async runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse> {\n const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);\n const body = await readRequestBody(event);\n const realmId = body?.realm_id;\n\n if (!clientId) {\n throw new EntityCredentialsInvalidError({ entity: 'client' });\n }\n\n const client = await this.authenticator.authenticate(clientId, clientSecret ?? '', realmId);\n\n assertClientGrantAllowed(client, OAuth2TokenGrant.CLIENT_CREDENTIALS);\n\n return this.runWith(client, {\n ipAddress: getRequestIP(event, { trustProxy: true }) ?? undefined,\n userAgent: getRequestHeader(event, 'user-agent') ?? undefined,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,IAAaQ,6BAAb,cAAgDH,uBAAAA;CAClCI;CAEV,YAAYC,KAA8C;EACtD,MAAMA,GAAAA;EAEN,KAAKD,gBAAgBC,IAAID;CAC7B;CAEA,MAAME,eAAeC,OAAqD;EACtE,MAAM,EAAEC,UAAUC,iBAAiB,MAAMP,oCAAoCK,KAAAA;EAE7E,MAAMI,WAAUD,MADGd,gBAAgBW,KAAAA,EAAAA,EACbK;EAEtB,IAAI,CAACJ,UACD,MAAM,IAAIX,8BAA8B,EAAEgB,QAAQ,SAAS,CAAA;EAG/D,MAAMC,SAAS,MAAM,KAAKV,cAAcW,aAAaP,UAAUC,gBAAgB,IAAIE,OAAAA;EAEnFV,yBAAyBa,QAAQnB,iBAAiBqB,kBAAkB;EAEpE,OAAO,KAAKC,QAAQH,QAAQ;GACxBI,WAAWnB,aAAaQ,OAAO,EAAEY,YAAY,KAAK,CAAA,KAAMC,KAAAA;GACxDC,WAAWvB,iBAAiBS,OAAO,YAAA,KAAiBa,KAAAA;EACxD,CAAA;CACJ;AACJ"}
|
|
@@ -3,6 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { extractClientCredentialsFromRequest, readStringField } from "./utils/credentials.mjs";
|
|
5
5
|
import { guessOauth2GrantTypeByRequest } from "./utils/guess.mjs";
|
|
6
|
+
import { readRealmHint } from "./utils/realm.mjs";
|
|
6
7
|
import "./utils/index.mjs";
|
|
7
8
|
import { HTTPOAuth2AuthorizeGrant } from "./authorize.mjs";
|
|
8
9
|
import { HTTPClientCredentialsGrant } from "./client-credentials.mjs";
|
|
@@ -10,4 +11,4 @@ import { HTTPOAuth2IdentityGrantType } from "./identity.mjs";
|
|
|
10
11
|
import { HTTPPasswordGrant } from "./password.mjs";
|
|
11
12
|
import { HTTPOAuth2RefreshTokenGrant } from "./refresh_token.mjs";
|
|
12
13
|
import { HTTPRobotCredentialsGrant } from "./robot-credentials.mjs";
|
|
13
|
-
export { HTTPClientCredentialsGrant, HTTPOAuth2AuthorizeGrant, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, extractClientCredentialsFromRequest, guessOauth2GrantTypeByRequest, readStringField };
|
|
14
|
+
export { HTTPClientCredentialsGrant, HTTPOAuth2AuthorizeGrant, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, extractClientCredentialsFromRequest, guessOauth2GrantTypeByRequest, readRealmHint, readStringField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC3H,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAC3F,OAAO,KAAK,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnF,qBAAa,iBAAkB,SAAQ,iBAAkB,YAAW,gBAAgB;IAChF,SAAS,CAAC,aAAa,EAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAE1D,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;IAE1D,SAAS,CAAC,eAAe,EAAG,gBAAgB,CAAC;gBAEjC,GAAG,EAAE,8BAA8B;IAQzC,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAmC5E"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { assertClientGrantAllowed } from "../../../../../core/oauth2/client/grant-type.mjs";
|
|
4
5
|
import { PasswordGrantType } from "../../../../../core/oauth2/grant-types/password.mjs";
|
|
5
6
|
import "../../../../../core/index.mjs";
|
|
6
7
|
import { extractClientCredentialsFromRequest, readStringField } from "./utils/credentials.mjs";
|
|
8
|
+
import { readRealmHint } from "./utils/realm.mjs";
|
|
7
9
|
import "./utils/index.mjs";
|
|
8
|
-
import { OAuth2RequestError } from "@authup/specs";
|
|
10
|
+
import { OAuth2RequestError, OAuth2TokenGrant } from "@authup/specs";
|
|
9
11
|
import { getRequestHeader, getRequestIP } from "routup";
|
|
10
12
|
import { readRequestBody } from "@routup/basic/body";
|
|
11
13
|
//#region src/adapters/http/adapters/oauth2/grant-types/password.ts
|
|
@@ -25,9 +27,9 @@ var HTTPPasswordGrant = class extends PasswordGrantType {
|
|
|
25
27
|
const password = readStringField(body, "password");
|
|
26
28
|
if (!username || !password) throw OAuth2RequestError.malformed("username and password must be provided.");
|
|
27
29
|
const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);
|
|
28
|
-
const
|
|
29
|
-
const realm = await this.realmRepository.resolve(realmHint, true);
|
|
30
|
+
const realm = await this.realmRepository.resolve(readRealmHint(body), true);
|
|
30
31
|
const client = clientId ? await this.clientAuthenticator.authenticate(clientId, clientSecret, realm.id) : void 0;
|
|
32
|
+
if (client) assertClientGrantAllowed(client, OAuth2TokenGrant.PASSWORD);
|
|
31
33
|
const user = await this.authenticator.authenticate(username, password, realm.id);
|
|
32
34
|
return this.runWith({
|
|
33
35
|
user,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.mjs","names":["OAuth2RequestError","readRequestBody","getRequestHeader","getRequestIP","PasswordGrantType","extractClientCredentialsFromRequest","readStringField","HTTPPasswordGrant","authenticator","clientAuthenticator","realmRepository","ctx","runWithRequest","event","body","username","password","malformed","clientId","clientSecret","
|
|
1
|
+
{"version":3,"file":"password.mjs","names":["OAuth2RequestError","OAuth2TokenGrant","readRequestBody","getRequestHeader","getRequestIP","PasswordGrantType","assertClientGrantAllowed","extractClientCredentialsFromRequest","readRealmHint","readStringField","HTTPPasswordGrant","authenticator","clientAuthenticator","realmRepository","ctx","runWithRequest","event","body","username","password","malformed","clientId","clientSecret","realm","resolve","client","authenticate","id","undefined","PASSWORD","user","runWith","ipAddress","trustProxy","userAgent"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/password.ts"],"sourcesContent":["/*\n * Copyright (c) 2025-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 { User } from '@authup/core-kit';\nimport type { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2RequestError, OAuth2TokenGrant } from '@authup/specs';\nimport { readRequestBody } from '@routup/basic/body';\nimport type { IAppEvent } from 'routup';\nimport { getRequestHeader, getRequestIP } from 'routup';\nimport type { ICredentialsAuthenticator, IRealmRepository, OAuth2ClientAuthenticator } from '../../../../../core/index.ts';\nimport { PasswordGrantType, assertClientGrantAllowed } from '../../../../../core/index.ts';\nimport type { HTTPOAuth2PasswordGrantContext, IHTTPOAuth2Grant } from './types.ts';\nimport { extractClientCredentialsFromRequest, readRealmHint, readStringField } from './utils/index.ts';\n\nexport class HTTPPasswordGrant extends PasswordGrantType implements IHTTPOAuth2Grant {\n protected authenticator : ICredentialsAuthenticator<User>;\n\n protected clientAuthenticator : OAuth2ClientAuthenticator;\n\n protected realmRepository : IRealmRepository;\n\n constructor(ctx: HTTPOAuth2PasswordGrantContext) {\n super(ctx);\n\n this.authenticator = ctx.authenticator;\n this.clientAuthenticator = ctx.clientAuthenticator;\n this.realmRepository = ctx.realmRepository;\n }\n\n async runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse> {\n const body = await readRequestBody(event);\n\n const username = readStringField(body, 'username');\n const password = readStringField(body, 'password');\n if (!username || !password) {\n throw OAuth2RequestError.malformed('username and password must be provided.');\n }\n\n const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);\n\n const realm = await this.realmRepository.resolve(readRealmHint(body), true);\n\n const client = clientId ?\n await this.clientAuthenticator.authenticate(\n clientId,\n clientSecret,\n realm.id,\n ) :\n undefined;\n\n if (client) {\n assertClientGrantAllowed(client, OAuth2TokenGrant.PASSWORD);\n }\n\n const user = await this.authenticator.authenticate(username, password, realm.id);\n\n return this.runWith(\n { user, client },\n {\n ipAddress: getRequestIP(event, { trustProxy: true }) ?? undefined,\n userAgent: getRequestHeader(event, 'user-agent') ?? undefined,\n },\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,IAAaU,oBAAb,cAAuCL,kBAAAA;CACzBM;CAEAC;CAEAC;CAEV,YAAYC,KAAqC;EAC7C,MAAMA,GAAAA;EAEN,KAAKH,gBAAgBG,IAAIH;EACzB,KAAKC,sBAAsBE,IAAIF;EAC/B,KAAKC,kBAAkBC,IAAID;CAC/B;CAEA,MAAME,eAAeC,OAAqD;EACtE,MAAMC,OAAO,MAAMf,gBAAgBc,KAAAA;EAEnC,MAAME,WAAWT,gBAAgBQ,MAAM,UAAA;EACvC,MAAME,WAAWV,gBAAgBQ,MAAM,UAAA;EACvC,IAAI,CAACC,YAAY,CAACC,UACd,MAAMnB,mBAAmBoB,UAAU,yCAAA;EAGvC,MAAM,EAAEC,UAAUC,iBAAiB,MAAMf,oCAAoCS,KAAAA;EAE7E,MAAMO,QAAQ,MAAM,KAAKV,gBAAgBW,QAAQhB,cAAcS,IAAAA,GAAO,IAAA;EAEtE,MAAMQ,SAASJ,WACX,MAAM,KAAKT,oBAAoBc,aAC3BL,UACAC,cACAC,MAAMI,EAAE,IAEZC,KAAAA;EAEJ,IAAIH,QACAnB,yBAAyBmB,QAAQxB,iBAAiB4B,QAAQ;EAG9D,MAAMC,OAAO,MAAM,KAAKnB,cAAce,aAAaR,UAAUC,UAAUI,MAAMI,EAAE;EAE/E,OAAO,KAAKI,QACR;GAAED;GAAML;EAAO,GACf;GACIO,WAAW5B,aAAaY,OAAO,EAAEiB,YAAY,KAAK,CAAA,KAAML,KAAAA;GACxDM,WAAW/B,iBAAiBa,OAAO,YAAA,KAAiBY,KAAAA;EACxD,CAAA;CAER;AACJ"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { OAuth2TokenGrantResponse } from '@authup/specs';
|
|
2
2
|
import type { IAppEvent } from 'routup';
|
|
3
3
|
import { OAuth2RefreshTokenGrant } from '../../../../../core/index.ts';
|
|
4
|
-
import type { IOAuth2TokenVerifier, OAuth2ClientAuthenticator } from '../../../../../core/index.ts';
|
|
4
|
+
import type { IOAuth2TokenVerifier, IRealmRepository, OAuth2ClientAuthenticator } from '../../../../../core/index.ts';
|
|
5
5
|
import type { HTTPOAuth2RefreshTokenGrantContext, IHTTPOAuth2Grant } from './types.ts';
|
|
6
6
|
export declare class HTTPOAuth2RefreshTokenGrant extends OAuth2RefreshTokenGrant implements IHTTPOAuth2Grant {
|
|
7
7
|
protected clientAuthenticator: OAuth2ClientAuthenticator;
|
|
8
8
|
protected refreshTokenVerifier: IOAuth2TokenVerifier;
|
|
9
|
+
protected realmRepository: IRealmRepository;
|
|
9
10
|
constructor(ctx: HTTPOAuth2RefreshTokenGrantContext);
|
|
10
11
|
runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse>;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh_token.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/refresh_token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refresh_token.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/refresh_token.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAA4B,MAAM,8BAA8B,CAAC;AACjG,OAAO,KAAK,EACR,oBAAoB,EACpB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kCAAkC,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGvF,qBAAa,2BAA4B,SAAQ,uBAAwB,YAAW,gBAAgB;IAChG,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;IAE1D,SAAS,CAAC,oBAAoB,EAAG,oBAAoB,CAAC;IAEtD,SAAS,CAAC,eAAe,EAAG,gBAAgB,CAAC;gBAEjC,GAAG,EAAE,kCAAkC;IAQ7C,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC;CA2E5E"}
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { assertClientGrantAllowed } from "../../../../../core/oauth2/client/grant-type.mjs";
|
|
4
5
|
import { OAuth2RefreshTokenGrant } from "../../../../../core/oauth2/grant-types/refresh-token.mjs";
|
|
5
6
|
import "../../../../../core/index.mjs";
|
|
6
7
|
import { extractClientCredentialsFromRequest } from "./utils/credentials.mjs";
|
|
8
|
+
import { readRealmHint } from "./utils/realm.mjs";
|
|
7
9
|
import "./utils/index.mjs";
|
|
8
|
-
import {
|
|
10
|
+
import { OAuth2GrantError, OAuth2RequestError, OAuth2TokenGrant } from "@authup/specs";
|
|
9
11
|
import { getRequestHeader, getRequestIP } from "routup";
|
|
10
12
|
import { readRequestBody } from "@routup/basic/body";
|
|
11
13
|
//#region src/adapters/http/adapters/oauth2/grant-types/refresh_token.ts
|
|
12
14
|
var HTTPOAuth2RefreshTokenGrant = class extends OAuth2RefreshTokenGrant {
|
|
13
15
|
clientAuthenticator;
|
|
14
16
|
refreshTokenVerifier;
|
|
17
|
+
realmRepository;
|
|
15
18
|
constructor(ctx) {
|
|
16
19
|
super(ctx);
|
|
17
20
|
this.clientAuthenticator = ctx.clientAuthenticator;
|
|
18
21
|
this.refreshTokenVerifier = ctx.tokenVerifier;
|
|
22
|
+
this.realmRepository = ctx.realmRepository;
|
|
19
23
|
}
|
|
20
24
|
async runWithRequest(event) {
|
|
21
25
|
const body = await readRequestBody(event);
|
|
22
26
|
const refreshToken = body?.refresh_token;
|
|
23
27
|
if (typeof refreshToken !== "string" || refreshToken.length === 0) throw OAuth2RequestError.malformed();
|
|
24
28
|
const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);
|
|
25
|
-
const
|
|
26
|
-
|
|
29
|
+
const payload = await this.refreshTokenVerifier.verify(refreshToken, { skipActiveCheck: true });
|
|
30
|
+
let client;
|
|
27
31
|
if (clientId) {
|
|
28
|
-
const
|
|
32
|
+
const realm = await this.realmRepository.resolve(readRealmHint(body), true);
|
|
33
|
+
client = await this.clientAuthenticator.authenticate(clientId, clientSecret, realm.id);
|
|
29
34
|
if (payload.client_id && payload.client_id !== client.id) throw OAuth2GrantError.invalid();
|
|
30
|
-
} else if (payload.client_id)
|
|
35
|
+
} else if (payload.client_id) client = await this.clientAuthenticator.authenticate(payload.client_id);
|
|
36
|
+
if (client) assertClientGrantAllowed(client, OAuth2TokenGrant.REFRESH_TOKEN);
|
|
37
|
+
if (client && !client.is_confidential && payload.realm_id && payload.realm_id !== client.realm_id) throw OAuth2GrantError.invalid();
|
|
31
38
|
return this.runWith(payload, {
|
|
32
39
|
ipAddress: getRequestIP(event, { trustProxy: true }) ?? void 0,
|
|
33
40
|
userAgent: getRequestHeader(event, "user-agent") ?? void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh_token.mjs","names":["
|
|
1
|
+
{"version":3,"file":"refresh_token.mjs","names":["OAuth2GrantError","OAuth2RequestError","OAuth2TokenGrant","readRequestBody","getRequestHeader","getRequestIP","OAuth2RefreshTokenGrant","assertClientGrantAllowed","extractClientCredentialsFromRequest","readRealmHint","HTTPOAuth2RefreshTokenGrant","clientAuthenticator","refreshTokenVerifier","realmRepository","ctx","tokenVerifier","runWithRequest","event","body","refreshToken","refresh_token","length","malformed","clientId","clientSecret","payload","verify","skipActiveCheck","client","realm","resolve","authenticate","id","client_id","invalid","REFRESH_TOKEN","is_confidential","realm_id","runWith","ipAddress","trustProxy","undefined","userAgent"],"sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/refresh_token.ts"],"sourcesContent":["/*\n * Copyright (c) 2025-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 { Client } from '@authup/core-kit';\nimport type { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2GrantError, OAuth2RequestError, OAuth2TokenGrant } from '@authup/specs';\nimport { readRequestBody } from '@routup/basic/body';\nimport type { IAppEvent } from 'routup';\nimport { getRequestHeader, getRequestIP } from 'routup';\nimport { OAuth2RefreshTokenGrant, assertClientGrantAllowed } from '../../../../../core/index.ts';\nimport type {\n IOAuth2TokenVerifier,\n IRealmRepository,\n OAuth2ClientAuthenticator,\n} from '../../../../../core/index.ts';\nimport type { HTTPOAuth2RefreshTokenGrantContext, IHTTPOAuth2Grant } from './types.ts';\nimport { extractClientCredentialsFromRequest, readRealmHint } from './utils/index.ts';\n\nexport class HTTPOAuth2RefreshTokenGrant extends OAuth2RefreshTokenGrant implements IHTTPOAuth2Grant {\n protected clientAuthenticator : OAuth2ClientAuthenticator;\n\n protected refreshTokenVerifier : IOAuth2TokenVerifier;\n\n protected realmRepository : IRealmRepository;\n\n constructor(ctx: HTTPOAuth2RefreshTokenGrantContext) {\n super(ctx);\n\n this.clientAuthenticator = ctx.clientAuthenticator;\n this.refreshTokenVerifier = ctx.tokenVerifier;\n this.realmRepository = ctx.realmRepository;\n }\n\n async runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse> {\n const body = await readRequestBody(event);\n const refreshToken = body?.refresh_token;\n if (typeof refreshToken !== 'string' || refreshToken.length === 0) {\n throw OAuth2RequestError.malformed();\n }\n\n const { clientId, clientSecret } = await extractClientCredentialsFromRequest(event);\n\n // RFC 6749 §6: verify the refresh token first to learn its bound\n // client (if any), then enforce binding. Authenticate the requesting\n // client when credentials are present, or when the token requires\n // a client binding.\n //\n // skipActiveCheck: the durable auth_session_tokens row (not the cache\n // blocklist) is the refresh-token authority, so a replayed/consumed\n // token must reach runWith() to trigger family revocation instead of\n // being rejected here with JWT_INACTIVE.\n const payload = await this.refreshTokenVerifier.verify(refreshToken, { skipActiveCheck: true });\n\n let client: Client | undefined;\n\n if (clientId) {\n // A client authenticated itself. Resolve by the presented\n // id/secret (name resolution scoped by the realm hint — resolved\n // lazily so a bare refresh skips the SELECT) and enforce the\n // token↔client binding.\n const realm = await this.realmRepository.resolve(readRealmHint(body), true);\n\n client = await this.clientAuthenticator.authenticate(\n clientId,\n clientSecret,\n realm.id,\n );\n\n if (payload.client_id && payload.client_id !== client.id) {\n throw OAuth2GrantError.invalid();\n }\n } else if (payload.client_id) {\n // No client credentials were presented, but the token is bound to\n // a client. RFC 6749 §10.4: a public client cannot authenticate\n // (no secret) and is not required to — the bound identity is read\n // from the signed token (client_id is server-minted, so trusted)\n // and refresh-token rotation/replay detection is the abuse control.\n // A confidential client MUST still authenticate: authenticate()\n // with no secret throws invalid_client for it, so a confidential-\n // bound token presented without credentials is rejected here.\n client = await this.clientAuthenticator.authenticate(payload.client_id);\n }\n\n if (client) {\n assertClientGrantAllowed(client, OAuth2TokenGrant.REFRESH_TOKEN);\n }\n\n // Realm parity for PUBLIC clients only: a public client may not refresh\n // a token whose realm differs from the (bound) client's own realm.\n // Kills cross-realm refresh tokens minted for a public `web` client\n // before the authorize-side realm gate existed. Confidential clients\n // are exempt — the client secret already proves identity, and the\n // documented cross-realm password grant (UUID-identified user against a\n // master-realm client) depends on that exemption.\n if (\n client &&\n !client.is_confidential &&\n payload.realm_id &&\n payload.realm_id !== client.realm_id\n ) {\n throw OAuth2GrantError.invalid();\n }\n\n return this.runWith(payload, {\n ipAddress: getRequestIP(event, { trustProxy: true }) ?? und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;GACxDC,WAAWtC,iBAAiBa,OAAO,YAAA,KAAiBwB,KAAAA;EACxD,CAAA;CACJ;AACJ"}
|
|
@@ -5,6 +5,7 @@ import type { BaseGrantContext, ICredentialsAuthenticator, IOAuth2AuthorizationC
|
|
|
5
5
|
export type HTTPOAuth2AuthorizeGrantContext = OAuth2AuthorizeGrantContext & {
|
|
6
6
|
codeVerifier: IOAuth2AuthorizationCodeVerifier;
|
|
7
7
|
clientAuthenticator: OAuth2ClientAuthenticator;
|
|
8
|
+
realmRepository: IRealmRepository;
|
|
8
9
|
};
|
|
9
10
|
export interface IHTTPOAuth2Grant {
|
|
10
11
|
runWithRequest(event: IAppEvent): Promise<OAuth2TokenGrantResponse>;
|
|
@@ -16,6 +17,7 @@ export type HTTPOAuth2PasswordGrantContext = OAuth2PasswordGrantContext & {
|
|
|
16
17
|
};
|
|
17
18
|
export type HTTPOAuth2RefreshTokenGrantContext = OAuth2RefreshTokenGrantContext & {
|
|
18
19
|
clientAuthenticator: OAuth2ClientAuthenticator;
|
|
20
|
+
realmRepository: IRealmRepository;
|
|
19
21
|
};
|
|
20
22
|
export type HTTPOAuth2ClientCredentialsGrantContext = BaseGrantContext & {
|
|
21
23
|
authenticator: ICredentialsAuthenticator<Client>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/adapters/http/adapters/oauth2/grant-types/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EACR,gBAAgB,EAChB,yBAAyB,EACzB,gCAAgC,EAChC,gBAAgB,EAChB,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EACjC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,EAAG,yBAAyB,CAAC,MAAM,CAAC,CAAA;CACpD,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG,gBAAgB,GAAG;IACpE,aAAa,EAAG,yBAAyB,CAAC,KAAK,CAAC,CAAA;CACnD,CAAC"}
|
|
@@ -2,8 +2,8 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { OAuth2RequestError } from "@authup/specs";
|
|
5
|
-
import { readRequestBody } from "@routup/basic/body";
|
|
6
5
|
import { AuthorizationHeaderType, parseAuthorizationHeader } from "hapic";
|
|
6
|
+
import { readRequestBody } from "@routup/basic/body";
|
|
7
7
|
//#region src/adapters/http/adapters/oauth2/grant-types/utils/credentials.ts
|
|
8
8
|
/**
|
|
9
9
|
* Extract client credentials from an OAuth2 token endpoint request.
|