@authup/server-core 1.0.0-beta.52 → 1.0.0-beta.53
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 +18 -8
- package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
- package/dist/adapters/database/domains/client/entity.d.ts +5 -2
- package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/entity.mjs +28 -4
- package/dist/adapters/database/domains/client/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/client-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/consent/entity.d.ts +20 -0
- package/dist/adapters/database/domains/consent/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/entity.mjs +110 -0
- package/dist/adapters/database/domains/consent/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/consent/index.d.ts +3 -0
- package/dist/adapters/database/domains/consent/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/index.mjs +6 -0
- package/dist/adapters/database/domains/consent/subscriber.d.ts +6 -0
- package/dist/adapters/database/domains/consent/subscriber.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/subscriber.mjs +45 -0
- package/dist/adapters/database/domains/consent/subscriber.mjs.map +1 -0
- package/dist/adapters/database/domains/constants.d.ts +1 -0
- package/dist/adapters/database/domains/constants.d.ts.map +1 -1
- package/dist/adapters/database/domains/constants.mjs +1 -0
- package/dist/adapters/database/domains/constants.mjs.map +1 -1
- package/dist/adapters/database/domains/event/entity.d.ts +22 -0
- package/dist/adapters/database/domains/event/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/event/entity.mjs +174 -0
- package/dist/adapters/database/domains/event/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/event/index.d.ts +2 -0
- package/dist/adapters/database/domains/event/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/event/index.mjs +5 -0
- package/dist/adapters/database/domains/identity-provider-account/entity.mjs +2 -2
- package/dist/adapters/database/domains/index.d.ts +4 -0
- package/dist/adapters/database/domains/index.d.ts.map +1 -1
- package/dist/adapters/database/domains/index.mjs +24 -15
- package/dist/adapters/database/domains/key/entity.d.ts +7 -3
- package/dist/adapters/database/domains/key/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/key/entity.mjs +35 -10
- package/dist/adapters/database/domains/key/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/permission-policy/entity.mjs +2 -2
- package/dist/adapters/database/domains/policy/repository.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy/repository.mjs +3 -3
- package/dist/adapters/database/domains/policy/repository.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/role/repository.mjs +1 -1
- package/dist/adapters/database/domains/role-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/session/entity.d.ts +3 -1
- package/dist/adapters/database/domains/session/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/session/entity.mjs +12 -0
- package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/trust-anchor/entity.d.ts +13 -0
- package/dist/adapters/database/domains/trust-anchor/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/entity.mjs +55 -0
- package/dist/adapters/database/domains/trust-anchor/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/index.d.ts +2 -0
- package/dist/adapters/database/domains/trust-anchor/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/index.mjs +5 -0
- package/dist/adapters/database/domains/user-authenticator/entity.d.ts +20 -0
- package/dist/adapters/database/domains/user-authenticator/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/entity.mjs +98 -0
- package/dist/adapters/database/domains/user-authenticator/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/index.d.ts +2 -0
- package/dist/adapters/database/domains/user-authenticator/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/index.mjs +5 -0
- package/dist/adapters/database/domains/user-permission/entity.mjs +1 -1
- package/dist/adapters/database/errors/driver.d.ts +14 -0
- package/dist/adapters/database/errors/driver.d.ts.map +1 -0
- package/dist/adapters/database/errors/driver.mjs +32 -0
- package/dist/adapters/database/errors/driver.mjs.map +1 -0
- package/dist/adapters/database/errors/index.d.ts +1 -0
- package/dist/adapters/database/errors/index.d.ts.map +1 -1
- package/dist/adapters/database/errors/index.mjs +2 -1
- package/dist/adapters/database/index.mjs +17 -11
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts +50 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs +320 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts +50 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs +310 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs.map +1 -0
- package/dist/adapters/database/subscriber/module.d.ts +1 -1
- 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.d.ts +4 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs +27 -2
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts +9 -1
- package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts +4 -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 +23 -3
- 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 +4 -3
- 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 +13 -6
- 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 +38 -2
- package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +119 -6
- 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 -0
- 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 +16 -3
- 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 +14 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts +5 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs +18 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs.map +1 -0
- 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/index.mjs +2 -1
- package/dist/adapters/http/controllers/entities/consent/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/consent/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/consent/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/consent/module.d.ts +15 -0
- package/dist/adapters/http/controllers/entities/consent/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/consent/module.mjs +82 -0
- package/dist/adapters/http/controllers/entities/consent/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/event/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/event/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/event/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/event/module.d.ts +14 -0
- package/dist/adapters/http/controllers/entities/event/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/event/module.mjs +68 -0
- package/dist/adapters/http/controllers/entities/event/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +4 -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 +38 -10
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts +3 -1
- package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.d.ts +5 -0
- package/dist/adapters/http/controllers/entities/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.mjs +11 -1
- package/dist/adapters/http/controllers/entities/key/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/key/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/key/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/key/module.d.ts +17 -0
- package/dist/adapters/http/controllers/entities/key/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/key/module.mjs +122 -0
- package/dist/adapters/http/controllers/entities/key/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/policy/utils/validation.mjs +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs +16 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts +17 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs +120 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts +21 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +154 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/index.mjs +7 -1
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts +46 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs +132 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +34 -6
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +17 -1
- 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/jwks/handlers/read.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs +28 -14
- package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/module.mjs +28 -14
- package/dist/adapters/http/controllers/workflows/jwks/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.d.ts +2 -1
- package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.mjs +28 -8
- package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/types.d.ts +11 -4
- package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
- package/dist/adapters/http/index.mjs +13 -3
- package/dist/adapters/http/middleware/built-in/assets.mjs +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +13 -0
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs +52 -2
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/types.d.ts +2 -0
- package/dist/adapters/http/middleware/built-in/authorization/types.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts +12 -1
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.mjs +75 -6
- package/dist/adapters/http/middleware/built-in/prometheus.mjs.map +1 -1
- package/dist/adapters/http/middleware/index.mjs +2 -2
- package/dist/adapters/http/request/client-certificate.d.ts +5 -0
- package/dist/adapters/http/request/client-certificate.d.ts.map +1 -0
- package/dist/adapters/http/request/client-certificate.mjs +88 -0
- package/dist/adapters/http/request/client-certificate.mjs.map +1 -0
- package/dist/adapters/http/request/constants.d.ts +1 -0
- package/dist/adapters/http/request/constants.d.ts.map +1 -1
- package/dist/adapters/http/request/constants.mjs +6 -1
- package/dist/adapters/http/request/constants.mjs.map +1 -1
- package/dist/adapters/http/request/event-context.d.ts +19 -0
- package/dist/adapters/http/request/event-context.d.ts.map +1 -0
- package/dist/adapters/http/request/event-context.mjs +37 -0
- package/dist/adapters/http/request/event-context.mjs.map +1 -0
- 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/mfa-login-ticket.d.ts +16 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs +15 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs.map +1 -0
- package/dist/adapters/http/request/index.d.ts +3 -0
- package/dist/adapters/http/request/index.d.ts.map +1 -1
- package/dist/adapters/http/request/index.mjs +5 -2
- package/dist/adapters/http/request/types.d.ts +3 -0
- package/dist/adapters/http/request/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/render.mjs +2 -2
- package/dist/app/index.mjs +11 -5
- package/dist/app/modules/components/module.d.ts.map +1 -1
- package/dist/app/modules/components/module.mjs +22 -2
- package/dist/app/modules/components/module.mjs.map +1 -1
- package/dist/app/modules/config/constants.d.ts +14 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +14 -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 +30 -2
- 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 +57 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +101 -0
- 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 +16 -0
- package/dist/app/modules/config/validator.mjs.map +1 -1
- package/dist/app/modules/database/constants.d.ts +3 -0
- package/dist/app/modules/database/constants.d.ts.map +1 -1
- package/dist/app/modules/database/constants.mjs +3 -1
- package/dist/app/modules/database/constants.mjs.map +1 -1
- package/dist/app/modules/database/index.mjs +7 -3
- 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 +32 -1
- 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 +8 -4
- package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/event/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/event/index.mjs +5 -0
- package/dist/app/modules/database/repositories/event/repository.d.ts +15 -0
- package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/event/repository.mjs +113 -0
- package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/helpers.d.ts +4 -2
- package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/helpers.mjs +7 -3
- package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
- package/dist/app/modules/database/repositories/index.d.ts +4 -0
- package/dist/app/modules/database/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/index.mjs +9 -1
- package/dist/app/modules/database/repositories/key/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/key/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/key/index.mjs +5 -0
- package/dist/app/modules/database/repositories/key/repository.d.ts +50 -0
- package/dist/app/modules/database/repositories/key/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/key/repository.mjs +273 -0
- package/dist/app/modules/database/repositories/key/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/permission-provider/module.mjs +1 -1
- package/dist/app/modules/database/repositories/trust-anchor/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/trust-anchor/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/trust-anchor/index.mjs +5 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts +24 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +113 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.mjs +5 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts +19 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs +92 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs.map +1 -0
- package/dist/app/modules/http/module.d.ts +8 -0
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +19 -1
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +16 -3
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +186 -15
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.d.ts +1 -0
- package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +10 -4
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +2 -2
- package/dist/app/modules/index.d.ts +1 -0
- package/dist/app/modules/index.d.ts.map +1 -1
- package/dist/app/modules/index.mjs +13 -6
- package/dist/app/modules/mail/module.d.ts.map +1 -1
- package/dist/app/modules/mail/module.mjs +2 -1
- package/dist/app/modules/mail/module.mjs.map +1 -1
- package/dist/app/modules/metrics/constants.d.ts +4 -0
- package/dist/app/modules/metrics/constants.d.ts.map +1 -0
- package/dist/app/modules/metrics/constants.mjs +10 -0
- package/dist/app/modules/metrics/constants.mjs.map +1 -0
- package/dist/app/modules/metrics/index.d.ts +3 -0
- package/dist/app/modules/metrics/index.d.ts.map +1 -0
- package/dist/app/modules/metrics/index.mjs +6 -0
- package/dist/app/modules/metrics/prom.d.ts +15 -0
- package/dist/app/modules/metrics/prom.d.ts.map +1 -0
- package/dist/app/modules/metrics/prom.mjs +42 -0
- package/dist/app/modules/metrics/prom.mjs.map +1 -0
- package/dist/app/modules/oauth2/constants.d.ts +9 -2
- package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
- package/dist/app/modules/oauth2/constants.mjs +7 -1
- 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 +23 -4
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/consent/index.d.ts +2 -0
- package/dist/app/modules/oauth2/repositories/consent/index.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/consent/index.mjs +5 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.d.ts +20 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs +116 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -0
- package/dist/app/modules/oauth2/repositories/index.d.ts +1 -1
- package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/index.mjs +3 -3
- package/dist/app/modules/oauth2/repositories/token/repository.d.ts +1 -0
- package/dist/app/modules/oauth2/repositories/token/repository.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs +8 -0
- package/dist/app/modules/oauth2/repositories/token/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +16 -5
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.mjs +22 -7
- 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 +12 -2
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/components/event-cleaner/index.d.ts +2 -0
- package/dist/components/event-cleaner/index.d.ts.map +1 -0
- package/dist/components/event-cleaner/index.mjs +5 -0
- package/dist/components/event-cleaner/module.d.ts +5 -0
- package/dist/components/event-cleaner/module.d.ts.map +1 -0
- package/dist/components/event-cleaner/module.mjs +30 -0
- package/dist/components/event-cleaner/module.mjs.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/components/oauth2-cleaner/module.d.ts +2 -1
- package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
- package/dist/components/oauth2-cleaner/module.mjs +9 -4
- package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
- package/dist/core/authentication/credential/entities/client/module.d.ts +1 -1
- package/dist/core/authentication/credential/entities/client/module.d.ts.map +1 -1
- package/dist/core/authentication/credential/entities/client/module.mjs +2 -1
- package/dist/core/authentication/credential/entities/client/module.mjs.map +1 -1
- package/dist/core/authentication/entities/client/module.mjs +2 -2
- package/dist/core/authentication/entities/client/module.mjs.map +1 -1
- package/dist/core/authentication/index.d.ts +1 -0
- package/dist/core/authentication/index.d.ts.map +1 -1
- package/dist/core/authentication/index.mjs +3 -1
- package/dist/core/authentication/login-throttle/index.d.ts +3 -0
- package/dist/core/authentication/login-throttle/index.d.ts.map +1 -0
- package/dist/core/authentication/login-throttle/index.mjs +5 -0
- package/dist/core/authentication/login-throttle/service.d.ts +13 -0
- package/dist/core/authentication/login-throttle/service.d.ts.map +1 -0
- package/dist/core/authentication/login-throttle/service.mjs +33 -0
- package/dist/core/authentication/login-throttle/service.mjs.map +1 -0
- package/dist/core/authentication/login-throttle/types.d.ts +34 -0
- package/dist/core/authentication/login-throttle/types.d.ts.map +1 -0
- 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 +4 -0
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/authentication/session/types.d.ts +6 -0
- package/dist/core/authentication/session/types.d.ts.map +1 -1
- package/dist/core/authentication/session/types.mjs.map +1 -1
- package/dist/core/client-certificate/index.d.ts +3 -0
- package/dist/core/client-certificate/index.d.ts.map +1 -0
- package/dist/core/client-certificate/index.mjs +5 -0
- package/dist/core/client-certificate/module.d.ts +18 -0
- package/dist/core/client-certificate/module.d.ts.map +1 -0
- package/dist/core/client-certificate/module.mjs +195 -0
- package/dist/core/client-certificate/module.mjs.map +1 -0
- package/dist/core/client-certificate/types.d.ts +22 -0
- package/dist/core/client-certificate/types.d.ts.map +1 -0
- package/dist/core/client-certificate/types.mjs +4 -0
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +15 -7
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/web-client.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.mjs +3 -2
- package/dist/core/entities/client/web-client.mjs.map +1 -1
- package/dist/core/entities/consent/index.d.ts +3 -0
- package/dist/core/entities/consent/index.d.ts.map +1 -0
- package/dist/core/entities/consent/index.mjs +6 -0
- package/dist/core/entities/consent/service.d.ts +19 -0
- package/dist/core/entities/consent/service.d.ts.map +1 -0
- package/dist/core/entities/consent/service.mjs +122 -0
- package/dist/core/entities/consent/service.mjs.map +1 -0
- package/dist/core/entities/consent/types.d.ts +97 -0
- package/dist/core/entities/consent/types.d.ts.map +1 -0
- package/dist/core/entities/consent/types.mjs +25 -0
- package/dist/core/entities/consent/types.mjs.map +1 -0
- package/dist/core/entities/event/constants.d.ts +7 -0
- package/dist/core/entities/event/constants.d.ts.map +1 -0
- package/dist/core/entities/event/constants.mjs +13 -0
- package/dist/core/entities/event/constants.mjs.map +1 -0
- package/dist/core/entities/event/diff.d.ts +20 -0
- package/dist/core/entities/event/diff.d.ts.map +1 -0
- package/dist/core/entities/event/diff.mjs +45 -0
- package/dist/core/entities/event/diff.mjs.map +1 -0
- package/dist/core/entities/event/entity-event-handler.d.ts +19 -0
- package/dist/core/entities/event/entity-event-handler.d.ts.map +1 -0
- package/dist/core/entities/event/entity-event-handler.mjs +100 -0
- package/dist/core/entities/event/entity-event-handler.mjs.map +1 -0
- package/dist/core/entities/event/index.d.ts +7 -0
- package/dist/core/entities/event/index.d.ts.map +1 -0
- package/dist/core/entities/event/index.mjs +9 -0
- package/dist/core/entities/event/sanitize.d.ts +2 -0
- package/dist/core/entities/event/sanitize.d.ts.map +1 -0
- package/dist/core/entities/event/sanitize.mjs +83 -0
- package/dist/core/entities/event/sanitize.mjs.map +1 -0
- package/dist/core/entities/event/service.d.ts +22 -0
- package/dist/core/entities/event/service.d.ts.map +1 -0
- package/dist/core/entities/event/service.mjs +169 -0
- package/dist/core/entities/event/service.mjs.map +1 -0
- package/dist/core/entities/event/types.d.ts +124 -0
- package/dist/core/entities/event/types.d.ts.map +1 -0
- package/dist/core/entities/event/types.mjs +4 -0
- package/dist/core/entities/identity-provider-role-mapping/service.mjs +2 -2
- package/dist/core/entities/identity-provider-role-mapping/service.mjs.map +1 -1
- package/dist/core/entities/index.d.ts +5 -0
- package/dist/core/entities/index.d.ts.map +1 -1
- package/dist/core/entities/index.mjs +20 -1
- package/dist/core/entities/key/index.d.ts +3 -0
- package/dist/core/entities/key/index.d.ts.map +1 -0
- package/dist/core/entities/key/index.mjs +5 -0
- package/dist/core/entities/key/service.d.ts +55 -0
- package/dist/core/entities/key/service.d.ts.map +1 -0
- package/dist/core/entities/key/service.mjs +301 -0
- package/dist/core/entities/key/service.mjs.map +1 -0
- package/dist/core/entities/key/types.d.ts +33 -0
- package/dist/core/entities/key/types.d.ts.map +1 -0
- package/dist/core/entities/key/types.mjs +4 -0
- package/dist/core/entities/permission/service.mjs +3 -3
- package/dist/core/entities/permission/service.mjs.map +1 -1
- package/dist/core/entities/policy/service.mjs +4 -4
- package/dist/core/entities/policy/service.mjs.map +1 -1
- package/dist/core/entities/realm/service.d.ts +3 -0
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +6 -3
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/entities/role/service.mjs +2 -2
- package/dist/core/entities/role/service.mjs.map +1 -1
- package/dist/core/entities/role-attribute/service.mjs +3 -3
- package/dist/core/entities/role-attribute/service.mjs.map +1 -1
- package/dist/core/entities/session/service.mjs +5 -2
- package/dist/core/entities/session/service.mjs.map +1 -1
- package/dist/core/entities/trust-anchor/index.d.ts +3 -0
- package/dist/core/entities/trust-anchor/index.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/index.mjs +5 -0
- package/dist/core/entities/trust-anchor/service.d.ts +33 -0
- package/dist/core/entities/trust-anchor/service.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/service.mjs +175 -0
- package/dist/core/entities/trust-anchor/service.mjs.map +1 -0
- package/dist/core/entities/trust-anchor/types.d.ts +14 -0
- package/dist/core/entities/trust-anchor/types.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/types.mjs +4 -0
- package/dist/core/entities/user/service.mjs +2 -2
- package/dist/core/entities/user/service.mjs.map +1 -1
- package/dist/core/entities/user-attribute/service.mjs +4 -4
- package/dist/core/entities/user-attribute/service.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/constants.d.ts +26 -0
- package/dist/core/entities/user-authenticator/constants.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/constants.mjs +32 -0
- package/dist/core/entities/user-authenticator/constants.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/helpers.d.ts +10 -0
- package/dist/core/entities/user-authenticator/helpers.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/helpers.mjs +35 -0
- package/dist/core/entities/user-authenticator/helpers.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/index.d.ts +6 -0
- package/dist/core/entities/user-authenticator/index.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/index.mjs +9 -0
- package/dist/core/entities/user-authenticator/service.d.ts +89 -0
- package/dist/core/entities/user-authenticator/service.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/service.mjs +709 -0
- package/dist/core/entities/user-authenticator/service.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/types.d.ts +221 -0
- package/dist/core/entities/user-authenticator/types.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/types.mjs +15 -0
- package/dist/core/entities/user-authenticator/types.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/webauthn.d.ts +28 -0
- package/dist/core/entities/user-authenticator/webauthn.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/webauthn.mjs +88 -0
- package/dist/core/entities/user-authenticator/webauthn.mjs.map +1 -0
- package/dist/core/identity/index.mjs +2 -1
- package/dist/core/identity/password-recovery/disabled.d.ts +2 -2
- package/dist/core/identity/password-recovery/disabled.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/disabled.mjs +2 -2
- package/dist/core/identity/password-recovery/disabled.mjs.map +1 -1
- package/dist/core/identity/password-recovery/email-verification-required.d.ts +2 -2
- package/dist/core/identity/password-recovery/email-verification-required.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/email-verification-required.mjs +2 -2
- package/dist/core/identity/password-recovery/email-verification-required.mjs.map +1 -1
- package/dist/core/identity/password-recovery/service.d.ts +2 -1
- package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +26 -4
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/token-expired.d.ts +2 -2
- package/dist/core/identity/password-recovery/token-expired.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/token-expired.mjs +2 -2
- package/dist/core/identity/password-recovery/token-expired.mjs.map +1 -1
- package/dist/core/identity/password-recovery/types.d.ts +2 -1
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/permission/index.d.ts +1 -0
- package/dist/core/identity/permission/index.d.ts.map +1 -1
- package/dist/core/identity/permission/index.mjs +2 -1
- package/dist/core/identity/policy/checker/service.mjs +1 -1
- package/dist/core/identity/policy/checker/service.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +2 -2
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
- package/dist/core/identity/registration/error.d.ts +2 -2
- package/dist/core/identity/registration/error.d.ts.map +1 -1
- package/dist/core/identity/registration/error.mjs +2 -2
- package/dist/core/identity/registration/error.mjs.map +1 -1
- package/dist/core/identity/registration/service.d.ts +2 -1
- package/dist/core/identity/registration/service.d.ts.map +1 -1
- package/dist/core/identity/registration/service.mjs +26 -4
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +2 -1
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.mjs +39 -8
- package/dist/core/key/certificate-error.d.ts +10 -0
- package/dist/core/key/certificate-error.d.ts.map +1 -0
- package/dist/core/key/certificate-error.mjs +19 -0
- package/dist/core/key/certificate-error.mjs.map +1 -0
- package/dist/core/key/certificate.d.ts +15 -0
- package/dist/core/key/certificate.d.ts.map +1 -0
- package/dist/core/key/certificate.mjs +72 -0
- package/dist/core/key/certificate.mjs.map +1 -0
- package/dist/core/key/check.d.ts +3 -0
- package/dist/core/key/check.d.ts.map +1 -0
- package/dist/core/key/check.mjs +13 -0
- package/dist/core/key/check.mjs.map +1 -0
- package/dist/core/key/constants.d.ts +10 -0
- package/dist/core/key/constants.d.ts.map +1 -0
- package/dist/core/key/constants.mjs +15 -0
- package/dist/core/key/constants.mjs.map +1 -0
- package/dist/core/key/error.d.ts +14 -0
- package/dist/core/key/error.d.ts.map +1 -0
- package/dist/core/key/error.mjs +23 -0
- package/dist/core/key/error.mjs.map +1 -0
- package/dist/core/key/index.d.ts +10 -0
- package/dist/core/key/index.d.ts.map +1 -0
- package/dist/core/key/index.mjs +12 -0
- package/dist/core/key/provisioner.d.ts +22 -0
- package/dist/core/key/provisioner.d.ts.map +1 -0
- package/dist/core/key/provisioner.mjs +30 -0
- package/dist/core/key/provisioner.mjs.map +1 -0
- package/dist/core/key/realm-cipher.d.ts +20 -0
- package/dist/core/key/realm-cipher.d.ts.map +1 -0
- package/dist/core/key/realm-cipher.mjs +60 -0
- package/dist/core/key/realm-cipher.mjs.map +1 -0
- package/dist/core/key/types.d.ts +59 -0
- package/dist/core/key/types.d.ts.map +1 -0
- package/dist/core/key/types.mjs +4 -0
- package/dist/core/key/wrap.d.ts +5 -0
- package/dist/core/key/wrap.d.ts.map +1 -0
- package/dist/core/key/wrap.mjs +21 -0
- package/dist/core/key/wrap.mjs.map +1 -0
- package/dist/core/mail/template/registry.d.ts.map +1 -1
- package/dist/core/mail/template/registry.mjs +3 -1
- package/dist/core/mail/template/registry.mjs.map +1 -1
- package/dist/core/mail/template/templates/mfa-email-otp.d.ts +3 -0
- package/dist/core/mail/template/templates/mfa-email-otp.d.ts.map +1 -0
- package/dist/core/mail/template/templates/mfa-email-otp.mjs +34 -0
- package/dist/core/mail/template/templates/mfa-email-otp.mjs.map +1 -0
- package/dist/core/mail/template/types.d.ts +6 -1
- package/dist/core/mail/template/types.d.ts.map +1 -1
- package/dist/core/mail/template/types.mjs +1 -0
- package/dist/core/mail/template/types.mjs.map +1 -1
- package/dist/core/metrics/index.d.ts +3 -0
- package/dist/core/metrics/index.d.ts.map +1 -0
- package/dist/core/metrics/index.mjs +5 -0
- package/dist/core/metrics/noop.d.ts +8 -0
- package/dist/core/metrics/noop.d.ts.map +1 -0
- package/dist/core/metrics/noop.mjs +14 -0
- package/dist/core/metrics/noop.mjs.map +1 -0
- package/dist/core/metrics/types.d.ts +19 -0
- package/dist/core/metrics/types.d.ts.map +1 -0
- package/dist/core/metrics/types.mjs +4 -0
- package/dist/core/oauth2/access-policy/index.d.ts +3 -0
- package/dist/core/oauth2/access-policy/index.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/index.mjs +5 -0
- package/dist/core/oauth2/access-policy/module.d.ts +12 -0
- package/dist/core/oauth2/access-policy/module.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/module.mjs +32 -0
- package/dist/core/oauth2/access-policy/module.mjs.map +1 -0
- package/dist/core/oauth2/access-policy/types.d.ts +19 -0
- package/dist/core/oauth2/access-policy/types.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/types.mjs +4 -0
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/module.mjs +2 -0
- package/dist/core/oauth2/authorization/code/issuer/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts +6 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.mjs.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 +1 -0
- package/dist/core/oauth2/authorization/code-request/validator.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +3 -3
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/helpers.d.ts +10 -1
- package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.mjs +28 -2
- package/dist/core/oauth2/authorization/helpers.mjs.map +1 -1
- package/dist/core/oauth2/authorization/index.mjs +2 -2
- package/dist/core/oauth2/authorization/module.d.ts +9 -0
- package/dist/core/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/module.mjs +80 -3
- package/dist/core/oauth2/authorization/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/types.d.ts +36 -0
- package/dist/core/oauth2/authorization/types.d.ts.map +1 -1
- package/dist/core/oauth2/client/authenticator.d.ts +16 -7
- package/dist/core/oauth2/client/authenticator.d.ts.map +1 -1
- package/dist/core/oauth2/client/authenticator.mjs +49 -12
- package/dist/core/oauth2/client/authenticator.mjs.map +1 -1
- package/dist/core/oauth2/end-session/service.d.ts +2 -1
- package/dist/core/oauth2/end-session/service.d.ts.map +1 -1
- package/dist/core/oauth2/end-session/service.mjs +13 -0
- package/dist/core/oauth2/end-session/service.mjs.map +1 -1
- package/dist/core/oauth2/end-session/types.d.ts +2 -1
- package/dist/core/oauth2/end-session/types.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.d.ts +2 -2
- package/dist/core/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.mjs +12 -8
- package/dist/core/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/client-credentials.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/client-credentials.mjs +5 -3
- package/dist/core/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/identity.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/identity.mjs +10 -3
- package/dist/core/oauth2/grant-types/identity.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/password.d.ts +9 -0
- package/dist/core/oauth2/grant-types/password.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/password.mjs +32 -4
- package/dist/core/oauth2/grant-types/password.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.d.ts +4 -0
- package/dist/core/oauth2/grant-types/refresh-token.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs +17 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/robot-credentials.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/robot-credentials.mjs +3 -2
- package/dist/core/oauth2/grant-types/robot-credentials.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/types.d.ts +10 -3
- package/dist/core/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/core/oauth2/index.d.ts +2 -1
- package/dist/core/oauth2/index.d.ts.map +1 -1
- package/dist/core/oauth2/index.mjs +7 -2
- package/dist/core/oauth2/mfa-login/index.d.ts +3 -0
- package/dist/core/oauth2/mfa-login/index.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/index.mjs +5 -0
- package/dist/core/oauth2/mfa-login/module.d.ts +19 -0
- package/dist/core/oauth2/mfa-login/module.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/module.mjs +109 -0
- package/dist/core/oauth2/mfa-login/module.mjs.map +1 -0
- package/dist/core/oauth2/mfa-login/types.d.ts +64 -0
- package/dist/core/oauth2/mfa-login/types.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/types.mjs +4 -0
- package/dist/core/oauth2/token/index.mjs +2 -1
- package/dist/core/oauth2/token/issuer/index.d.ts +1 -0
- package/dist/core/oauth2/token/issuer/index.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/index.mjs +3 -1
- package/dist/core/oauth2/token/issuer/mfa/index.d.ts +2 -0
- package/dist/core/oauth2/token/issuer/mfa/index.d.ts.map +1 -0
- package/dist/core/oauth2/token/issuer/mfa/index.mjs +5 -0
- package/dist/core/oauth2/token/issuer/mfa/module.d.ts +18 -0
- package/dist/core/oauth2/token/issuer/mfa/module.d.ts.map +1 -0
- package/dist/core/oauth2/token/issuer/mfa/module.mjs +36 -0
- package/dist/core/oauth2/token/issuer/mfa/module.mjs.map +1 -0
- package/dist/core/oauth2/token/repository/types.d.ts +10 -0
- package/dist/core/oauth2/token/repository/types.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.mjs +1 -0
- package/dist/core/oauth2/token/revoker/module.mjs.map +1 -1
- package/dist/core/oauth2/token/signer/module.d.ts +3 -3
- package/dist/core/oauth2/token/signer/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/signer/module.mjs +5 -6
- package/dist/core/oauth2/token/signer/module.mjs.map +1 -1
- package/dist/core/oauth2/token/verifier/module.d.ts +3 -3
- package/dist/core/oauth2/token/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/verifier/module.mjs +8 -5
- package/dist/core/oauth2/token/verifier/module.mjs.map +1 -1
- package/dist/index.mjs +52 -30
- package/dist/swagger.json +5431 -2952
- package/dist/ui/client/.vite/ssr-manifest.json +3888 -864
- package/dist/ui/client/assets/index-BmWsoQro.css +2 -0
- package/dist/ui/client/assets/{index-CP9HCHoS.js → index-CT0Nq5pA.js} +18 -17
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/server.js +19470 -18436
- package/package.json +22 -16
- package/dist/app/modules/oauth2/repositories/key/index.d.ts.map +0 -1
- package/dist/app/modules/oauth2/repositories/key/index.mjs +0 -5
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts +0 -14
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts.map +0 -1
- package/dist/app/modules/oauth2/repositories/key/repository.mjs +0 -51
- package/dist/app/modules/oauth2/repositories/key/repository.mjs.map +0 -1
- package/dist/core/oauth2/key/index.d.ts +0 -2
- package/dist/core/oauth2/key/index.d.ts.map +0 -1
- package/dist/core/oauth2/key/types.d.ts +0 -16
- package/dist/core/oauth2/key/types.d.ts.map +0 -1
- package/dist/ui/client/assets/index-VM4JXBXw.css +0 -2
- /package/dist/{core/oauth2/key → adapters/http/request}/types.mjs +0 -0
- /package/dist/app/modules/{oauth2/repositories/key → database/repositories/event}/index.d.ts +0 -0
- /package/dist/core/{oauth2/key/index.mjs → authentication/login-throttle/types.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["cron","LessThan","SessionEntity","SessionTokenEntity","createOAuth2CleanerComponent","dataSource","start","sessionRepository","getRepository","sessionTokenRepository","execute","isoDate","Date","toISOString","delete","expires_at","schedule"],"sources":["../../../src/components/oauth2-cleaner/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2022.\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 cron from 'node-cron';\nimport type { DataSource } from 'typeorm';\nimport { LessThan } from 'typeorm';\nimport { SessionEntity, SessionTokenEntity } from '../../adapters/database/domains/index.ts';\nimport type { Component } from '../types.ts';\n\nexport function createOAuth2CleanerComponent(dataSource: DataSource) : Component {\n return {\n async start() {\n const sessionRepository = dataSource.getRepository(SessionEntity);\n const sessionTokenRepository = dataSource.getRepository(SessionTokenEntity);\n\n const execute = async () => {\n const isoDate = new Date().toISOString();\n\n
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["cron","LessThan","SessionEntity","SessionTokenEntity","createOAuth2CleanerComponent","dataSource","logger","start","sessionRepository","getRepository","sessionTokenRepository","execute","isoDate","Date","toISOString","delete","expires_at","e","warn","schedule"],"sources":["../../../src/components/oauth2-cleaner/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2022.\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 cron from 'node-cron';\nimport type { Logger } from '@authup/server-kit';\nimport type { DataSource } from 'typeorm';\nimport { LessThan } from 'typeorm';\nimport { SessionEntity, SessionTokenEntity } from '../../adapters/database/domains/index.ts';\nimport type { Component } from '../types.ts';\n\nexport function createOAuth2CleanerComponent(\n dataSource: DataSource,\n logger?: Logger,\n) : Component {\n return {\n async start() {\n const sessionRepository = dataSource.getRepository(SessionEntity);\n const sessionTokenRepository = dataSource.getRepository(SessionTokenEntity);\n\n // A failed sweep must never take the process down (start() is\n // fire-and-forget → an uncaught rejection is fatal on modern\n // node); the next tick simply retries.\n const execute = async () => {\n try {\n const isoDate = new Date().toISOString();\n\n // Sweep expired session-token rows first: the auth_session_tokens\n // volume dominates (one row per access token, ~15min TTL) and a\n // deleted session cascade-drops its remaining rows anyway.\n await sessionTokenRepository\n .delete({ expires_at: LessThan(isoDate) });\n\n await sessionRepository\n .delete({ expires_at: LessThan(isoDate) });\n } catch (e) {\n logger?.warn('Sweeping expired sessions failed.');\n logger?.warn(e);\n }\n };\n\n await execute();\n\n cron.schedule('* * * * *', async () => {\n await execute();\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgBI,6BACZC,YACAC,QAAe;CAEf,OAAO,EACH,MAAMC,QAAAA;EACF,MAAMC,oBAAoBH,WAAWI,cAAcP,aAAAA;EACnD,MAAMQ,yBAAyBL,WAAWI,cAAcN,kBAAAA;EAKxD,MAAMQ,UAAU,YAAA;GACZ,IAAI;IACA,MAAMC,2BAAU,IAAIC,KAAAA,EAAAA,CAAOC,YAAW;IAKtC,MAAMJ,uBACDK,OAAO,EAAEC,YAAYf,SAASW,OAAAA,EAAS,CAAA;IAE5C,MAAMJ,kBACDO,OAAO,EAAEC,YAAYf,SAASW,OAAAA,EAAS,CAAA;GAChD,SAASK,GAAG;IACRX,QAAQY,KAAK,mCAAA;IACbZ,QAAQY,KAAKD,CAAAA;GACjB;EACJ;EAEA,MAAMN,QAAAA;EAENX,KAAKmB,SAAS,aAAa,YAAA;GACvB,MAAMR,QAAAA;EACV,CAAA;CACJ,EACJ;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Client } from '@authup/core-kit';
|
|
2
2
|
import type { ICredentialService } from '../../types.ts';
|
|
3
3
|
export declare class ClientCredentialsService implements ICredentialService<Client> {
|
|
4
4
|
verify(input: string, entity: Client): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/authentication/credential/entities/client/module.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/authentication/credential/entities/client/module.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAoB,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,qBAAa,wBAAyB,YAAW,kBAAkB,CAAC,MAAM,CAAC;IACjE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAcvD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAYpF,cAAc;CAGjB"}
|
|
@@ -2,11 +2,12 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { createNanoID, isBCryptHash } from "@authup/kit";
|
|
5
|
+
import { ClientAuthMethod } from "@authup/core-kit";
|
|
5
6
|
import { compare, hash } from "@authup/server-kit";
|
|
6
7
|
//#region src/core/authentication/credential/entities/client/module.ts
|
|
7
8
|
var ClientCredentialsService = class {
|
|
8
9
|
async verify(input, entity) {
|
|
9
|
-
if (!entity.secret ||
|
|
10
|
+
if (!entity.secret || entity.auth_method !== ClientAuthMethod.SECRET) return false;
|
|
10
11
|
if (entity.secret_hashed) return compare(input, entity.secret);
|
|
11
12
|
return input === entity.secret;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["createNanoID","isBCryptHash","compare","hash","ClientCredentialsService","verify","input","entity","secret","
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["createNanoID","isBCryptHash","compare","hash","ClientAuthMethod","ClientCredentialsService","verify","input","entity","secret","auth_method","SECRET","secret_hashed","protect","generateSecret"],"sources":["../../../../../../src/core/authentication/credential/entities/client/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 { createNanoID, isBCryptHash } from '@authup/kit';\nimport { compare, hash } from '@authup/server-kit';\nimport { type Client, ClientAuthMethod } from '@authup/core-kit';\nimport type { ICredentialService } from '../../types.ts';\n\nexport class ClientCredentialsService implements ICredentialService<Client> {\n async verify(input: string, entity: Client): Promise<boolean> {\n if (!entity.secret || entity.auth_method !== ClientAuthMethod.SECRET) {\n return false;\n }\n\n if (entity.secret_hashed) {\n return compare(input, entity.secret);\n }\n\n // todo: secret encrypted missing (decrypt)\n\n return input === entity.secret;\n }\n\n async protect(input: string, entity: Pick<Client, 'secret_hashed'>): Promise<string> {\n if (entity.secret_hashed) {\n return isBCryptHash(input) ?\n input :\n hash(input);\n }\n\n // todo: secret encrypted missing (encrypt)\n\n return input;\n }\n\n generateSecret() {\n return createNanoID(64);\n }\n}\n"],"mappings":";;;;;;;AAYA,IAAaK,2BAAb,MAAaA;CACT,MAAMC,OAAOC,OAAeC,QAAkC;EAC1D,IAAI,CAACA,OAAOC,UAAUD,OAAOE,gBAAgBN,iBAAiBO,QAC1D,OAAO;EAGX,IAAIH,OAAOI,eACP,OAAOV,QAAQK,OAAOC,OAAOC,MAAM;EAKvC,OAAOF,UAAUC,OAAOC;CAC5B;CAEA,MAAMI,QAAQN,OAAeC,QAAwD;EACjF,IAAIA,OAAOI,eACP,OAAOX,aAAaM,KAAAA,IAChBA,QACAJ,KAAKI,KAAAA;EAKb,OAAOA;CACX;CAEAO,iBAAiB;EACb,OAAOd,aAAa,EAAA;CACxB;AACJ"}
|
|
@@ -4,7 +4,7 @@ import.meta.url;
|
|
|
4
4
|
import { ClientCredentialsService } from "../../credential/entities/client/module.mjs";
|
|
5
5
|
import "../../credential/index.mjs";
|
|
6
6
|
import { BaseCredentialsAuthenticator } from "../../base.mjs";
|
|
7
|
-
import { IdentityType } from "@authup/core-kit";
|
|
7
|
+
import { ClientAuthMethod, IdentityType } from "@authup/core-kit";
|
|
8
8
|
import { EntityCredentialsInvalidError, EntityInactiveError } from "@authup/errors";
|
|
9
9
|
import { OAuth2ClientError } from "@authup/specs";
|
|
10
10
|
//#region src/core/authentication/entities/client/module.ts
|
|
@@ -20,7 +20,7 @@ var ClientAuthenticator = class extends BaseCredentialsAuthenticator {
|
|
|
20
20
|
const identity = await this.identityResolver.resolve(IdentityType.CLIENT, key, realmId);
|
|
21
21
|
if (!identity || identity.type !== IdentityType.CLIENT) throw new EntityCredentialsInvalidError({ entity: "client" });
|
|
22
22
|
if (!identity.data.active) throw new EntityInactiveError({ entity: "client" });
|
|
23
|
-
if (identity.data.
|
|
23
|
+
if (identity.data.auth_method === ClientAuthMethod.SECRET) {
|
|
24
24
|
if (!await this.credentialsService.verify(secret, identity.data)) throw new EntityCredentialsInvalidError({ entity: "client" });
|
|
25
25
|
} else throw OAuth2ClientError.invalid();
|
|
26
26
|
return identity.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["IdentityType","EntityCredentialsInvalidError","EntityInactiveError","OAuth2ClientError","ClientCredentialsService","BaseCredentialsAuthenticator","ClientAuthenticator","identityResolver","credentialsService","authenticate","key","secret","realmId","identity","resolve","CLIENT","type","entity","data","active","
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["ClientAuthMethod","IdentityType","EntityCredentialsInvalidError","EntityInactiveError","OAuth2ClientError","ClientCredentialsService","BaseCredentialsAuthenticator","ClientAuthenticator","identityResolver","credentialsService","authenticate","key","secret","realmId","identity","resolve","CLIENT","type","entity","data","active","auth_method","SECRET","verified","verify","invalid"],"sources":["../../../../../src/core/authentication/entities/client/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 { Client } from '@authup/core-kit';\nimport { ClientAuthMethod, IdentityType } from '@authup/core-kit';\nimport { EntityCredentialsInvalidError, EntityInactiveError } from '@authup/errors';\nimport { OAuth2ClientError } from '@authup/specs';\nimport type { IIdentityResolver } from '../../../identity/index.ts';\nimport { ClientCredentialsService } from '../../credential/index.ts';\nimport { BaseCredentialsAuthenticator } from '../../base.ts';\n\nexport class ClientAuthenticator extends BaseCredentialsAuthenticator<Client> {\n protected identityResolver : IIdentityResolver;\n\n protected credentialsService : ClientCredentialsService;\n\n constructor(identityResolver: IIdentityResolver) {\n super();\n\n this.identityResolver = identityResolver;\n this.credentialsService = new ClientCredentialsService();\n }\n\n async authenticate(key: string, secret: string, realmId?: string): Promise<Client> {\n const identity = await this.identityResolver.resolve(IdentityType.CLIENT, key, realmId);\n if (!identity || identity.type !== IdentityType.CLIENT) {\n throw new EntityCredentialsInvalidError({ entity: 'client' });\n }\n\n if (!identity.data.active) {\n throw new EntityInactiveError({ entity: 'client' });\n }\n\n if (identity.data.auth_method === ClientAuthMethod.SECRET) {\n const verified = await this.credentialsService.verify(secret, identity.data);\n if (!verified) {\n throw new EntityCredentialsInvalidError({ entity: 'client' });\n }\n } else {\n throw OAuth2ClientError.invalid();\n }\n\n return identity.data;\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAaO,sBAAb,cAAyCD,6BAAAA;CAC3BE;CAEAC;CAEV,YAAYD,kBAAqC;EAC7C,MAAK;EAEL,KAAKA,mBAAmBA;EACxB,KAAKC,qBAAqB,IAAIJ,yBAAAA;CAClC;CAEA,MAAMK,aAAaC,KAAaC,QAAgBC,SAAmC;EAC/E,MAAMC,WAAW,MAAM,KAAKN,iBAAiBO,QAAQd,aAAae,QAAQL,KAAKE,OAAAA;EAC/E,IAAI,CAACC,YAAYA,SAASG,SAAShB,aAAae,QAC5C,MAAM,IAAId,8BAA8B,EAAEgB,QAAQ,SAAS,CAAA;EAG/D,IAAI,CAACJ,SAASK,KAAKC,QACf,MAAM,IAAIjB,oBAAoB,EAAEe,QAAQ,SAAS,CAAA;EAGrD,IAAIJ,SAASK,KAAKE,gBAAgBrB,iBAAiBsB;OAE3C,CAACC,MADkB,KAAKd,mBAAmBe,OAAOZ,QAAQE,SAASK,IAAI,GAEvE,MAAM,IAAIjB,8BAA8B,EAAEgB,QAAQ,SAAS,CAAA;EAAA,OAG/D,MAAMd,kBAAkBqB,QAAO;EAGnC,OAAOX,SAASK;CACpB;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/authentication/index.ts"],"names":[],"mappings":"AAOA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/authentication/index.ts"],"names":[],"mappings":"AAOA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
|
@@ -10,8 +10,10 @@ import { ClientAuthenticator } from "./entities/client/module.mjs";
|
|
|
10
10
|
import { RobotAuthenticator } from "./entities/robot/module.mjs";
|
|
11
11
|
import { UserAuthenticator } from "./entities/user/module.mjs";
|
|
12
12
|
import "./entities/index.mjs";
|
|
13
|
+
import { LoginThrottleService } from "./login-throttle/service.mjs";
|
|
14
|
+
import "./login-throttle/index.mjs";
|
|
13
15
|
import { CredentialsAuthenticator } from "./module.mjs";
|
|
14
16
|
import { SessionManager } from "./session/module.mjs";
|
|
15
17
|
import { SESSION_FILTER_KEYS } from "./session/types.mjs";
|
|
16
18
|
import "./session/index.mjs";
|
|
17
|
-
export { BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsService, CredentialsAuthenticator, RobotAuthenticator, RobotCredentialsService, SESSION_FILTER_KEYS, SessionManager, UserAuthenticator, UserCredentialsService };
|
|
19
|
+
export { BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsService, CredentialsAuthenticator, LoginThrottleService, RobotAuthenticator, RobotCredentialsService, SESSION_FILTER_KEYS, SessionManager, UserAuthenticator, UserCredentialsService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/login-throttle/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IEventRepository } from '../../entities/index.ts';
|
|
2
|
+
import type { ILoginThrottleService, LoginThrottleServiceContext, LoginThrottleServiceOptions } from './types.ts';
|
|
3
|
+
export declare class LoginThrottleService implements ILoginThrottleService {
|
|
4
|
+
protected repository: IEventRepository;
|
|
5
|
+
protected options: LoginThrottleServiceOptions;
|
|
6
|
+
constructor(ctx: LoginThrottleServiceContext);
|
|
7
|
+
assertNotThrottled(ctx: {
|
|
8
|
+
identifier: string;
|
|
9
|
+
ipAddress?: string;
|
|
10
|
+
realmId?: string | null;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/login-throttle/service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAKlH,qBAAa,oBAAqB,YAAW,qBAAqB;IAC9D,SAAS,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAEvC,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC;gBAEnC,GAAG,EAAE,2BAA2B;IAKtC,kBAAkB,CACpB,GAAG,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAC1B,GACF,OAAO,CAAC,IAAI,CAAC;CA4BnB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { EventName } from "@authup/core-kit";
|
|
5
|
+
import { LoginThrottledError } from "@authup/errors";
|
|
6
|
+
//#region src/core/authentication/login-throttle/service.ts
|
|
7
|
+
const DEFAULT_THRESHOLD = 5;
|
|
8
|
+
const DEFAULT_WINDOW_SECONDS = 900;
|
|
9
|
+
var LoginThrottleService = class {
|
|
10
|
+
repository;
|
|
11
|
+
options;
|
|
12
|
+
constructor(ctx) {
|
|
13
|
+
this.repository = ctx.repository;
|
|
14
|
+
this.options = ctx.options ?? {};
|
|
15
|
+
}
|
|
16
|
+
async assertNotThrottled(ctx) {
|
|
17
|
+
if (!this.options.enabled) return;
|
|
18
|
+
if (!ctx.ipAddress) return;
|
|
19
|
+
const threshold = this.options.threshold ?? DEFAULT_THRESHOLD;
|
|
20
|
+
const windowSeconds = this.options.windowSeconds ?? DEFAULT_WINDOW_SECONDS;
|
|
21
|
+
if (await this.repository.countRecent({
|
|
22
|
+
name: EventName.LOGIN_FAILED,
|
|
23
|
+
actorName: ctx.identifier,
|
|
24
|
+
requestIpAddress: ctx.ipAddress,
|
|
25
|
+
realmId: ctx.realmId,
|
|
26
|
+
since: (/* @__PURE__ */ new Date(Date.now() - windowSeconds * 1e3)).toISOString()
|
|
27
|
+
}) >= threshold) throw new LoginThrottledError({ retryAfter: windowSeconds });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { LoginThrottleService };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["EventName","LoginThrottledError","DEFAULT_THRESHOLD","DEFAULT_WINDOW_SECONDS","LoginThrottleService","repository","options","ctx","assertNotThrottled","enabled","ipAddress","threshold","windowSeconds","count","countRecent","name","LOGIN_FAILED","actorName","identifier","requestIpAddress","realmId","since","Date","now","toISOString","retryAfter"],"sources":["../../../../src/core/authentication/login-throttle/service.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 { EventName } from '@authup/core-kit';\nimport { LoginThrottledError } from '@authup/errors';\nimport type { IEventRepository } from '../../entities/index.ts';\nimport type { ILoginThrottleService, LoginThrottleServiceContext, LoginThrottleServiceOptions } from './types.ts';\n\nconst DEFAULT_THRESHOLD = 5;\nconst DEFAULT_WINDOW_SECONDS = 900;\n\nexport class LoginThrottleService implements ILoginThrottleService {\n protected repository: IEventRepository;\n\n protected options: LoginThrottleServiceOptions;\n\n constructor(ctx: LoginThrottleServiceContext) {\n this.repository = ctx.repository;\n this.options = ctx.options ?? {};\n }\n\n async assertNotThrottled(\n ctx: {\n identifier: string, \n ipAddress?: string, \n realmId?: string | null \n },\n ): Promise<void> {\n if (!this.options.enabled) {\n return;\n }\n\n // The (identifier, ip) pair is the account-lockout-DoS mitigation: an\n // attacker on one IP can never lock the victim's other IPs. Without a\n // derivable IP the pair does not exist, so the throttle fails open\n // instead of degrading to a lockable per-identifier key.\n if (!ctx.ipAddress) {\n return;\n }\n\n const threshold = this.options.threshold ?? DEFAULT_THRESHOLD;\n const windowSeconds = this.options.windowSeconds ?? DEFAULT_WINDOW_SECONDS;\n\n const count = await this.repository.countRecent({\n name: EventName.LOGIN_FAILED,\n actorName: ctx.identifier,\n requestIpAddress: ctx.ipAddress,\n realmId: ctx.realmId,\n since: new Date(Date.now() - (windowSeconds * 1_000)).toISOString(),\n });\n\n if (count >= threshold) {\n throw new LoginThrottledError({ retryAfter: windowSeconds });\n }\n }\n}\n"],"mappings":";;;;;;AAYA,MAAME,oBAAoB;AAC1B,MAAMC,yBAAyB;AAE/B,IAAaC,uBAAb,MAAaA;CACCC;CAEAC;CAEV,YAAYC,KAAkC;EAC1C,KAAKF,aAAaE,IAAIF;EACtB,KAAKC,UAAUC,IAAID,WAAW,CAAC;CACnC;CAEA,MAAME,mBACFD,KAKa;EACb,IAAI,CAAC,KAAKD,QAAQG,SACd;EAOJ,IAAI,CAACF,IAAIG,WACL;EAGJ,MAAMC,YAAY,KAAKL,QAAQK,aAAaT;EAC5C,MAAMU,gBAAgB,KAAKN,QAAQM,iBAAiBT;EAUpD,IAAIU,MARgB,KAAKR,WAAWS,YAAY;GAC5CC,MAAMf,UAAUgB;GAChBC,WAAWV,IAAIW;GACfC,kBAAkBZ,IAAIG;GACtBU,SAASb,IAAIa;GACbC,wBAAO,IAAIC,KAAKA,KAAKC,IAAG,IAAMX,gBAAgB,GAAA,EAAA,CAAQY,YAAW;EACrE,CAAA,KAEab,WACT,MAAM,IAAIV,oBAAoB,EAAEwB,YAAYb,cAAc,CAAA;CAElE;AACJ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IEventRepository } from '../../entities/index.ts';
|
|
2
|
+
export type LoginThrottleServiceOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* config.loginAttemptThrottleEnabled — default off.
|
|
5
|
+
*/
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* config.loginAttemptThreshold — failed attempts per (identifier, ip) pair
|
|
9
|
+
* before the throttle trips. Default 5.
|
|
10
|
+
*/
|
|
11
|
+
threshold?: number;
|
|
12
|
+
/**
|
|
13
|
+
* config.loginAttemptWindow — sliding window (seconds) the attempts are
|
|
14
|
+
* counted over. The window is also the lock: a success simply stops adding
|
|
15
|
+
* rows and the window slides past. Default 900.
|
|
16
|
+
*/
|
|
17
|
+
windowSeconds?: number;
|
|
18
|
+
};
|
|
19
|
+
export type LoginThrottleServiceContext = {
|
|
20
|
+
repository: IEventRepository;
|
|
21
|
+
options?: LoginThrottleServiceOptions;
|
|
22
|
+
};
|
|
23
|
+
export interface ILoginThrottleService {
|
|
24
|
+
/**
|
|
25
|
+
* Throw LoginThrottledError when recent LOGIN_FAILED audit events for the
|
|
26
|
+
* (identifier, ip) pair hit the threshold.
|
|
27
|
+
*/
|
|
28
|
+
assertNotThrottled(ctx: {
|
|
29
|
+
identifier: string;
|
|
30
|
+
ipAddress?: string;
|
|
31
|
+
realmId?: string | null;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/login-throttle/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,2BAA2B,GAAG;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACtC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB"}
|
|
@@ -12,6 +12,7 @@ export declare class SessionManager implements ISessionManager {
|
|
|
12
12
|
create(input: Partial<Session>): Promise<Session>;
|
|
13
13
|
ping(session: Session): Promise<Session>;
|
|
14
14
|
refresh(session: Session): Promise<Session>;
|
|
15
|
+
markMfaVerified(session: Session): Promise<Session>;
|
|
15
16
|
/**
|
|
16
17
|
* Verify session on token inspection/verification.
|
|
17
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/session/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,KAAK,EACR,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACxB,MAAM,YAAY,CAAC;AAEpB,qBAAa,cAAe,YAAW,eAAe;IAClD,SAAS,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAEzC,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAC;gBAI7B,GAAG,EAAE,qBAAqB;IAOtC;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BjD,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBxC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/session/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,KAAK,EACR,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACxB,MAAM,YAAY,CAAC;AAEpB,qBAAa,cAAe,YAAW,eAAe;IAClD,SAAS,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAEzC,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAC;gBAI7B,GAAG,EAAE,qBAAqB;IAOtC;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BjD,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBxC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAc3C,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAQzD;;;;;OAKG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAMhD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAShD"}
|
|
@@ -46,6 +46,10 @@ var SessionManager = class {
|
|
|
46
46
|
session.expires_at = new Date(Date.now() + this.options.maxAge * 1e3).toISOString();
|
|
47
47
|
return this.repository.save(session);
|
|
48
48
|
}
|
|
49
|
+
async markMfaVerified(session) {
|
|
50
|
+
session.mfa_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
51
|
+
return this.repository.save(session);
|
|
52
|
+
}
|
|
49
53
|
/**
|
|
50
54
|
* Verify session on token inspection/verification.
|
|
51
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["IdentityType","JWTError","SessionManager","options","repository","ctx","create","input","ip_address","user_agent","expires_at","Date","now","maxAge","toISOString","sub_kind","CLIENT","client_id","sub","ROBOT","robot_id","USER","user_id","save","ping","session","seen_at","seenAt","getTime","threshold","refresh","refreshed_at","findOneById","id","revoke","removeById","verify","ms","remove","expired"],"sources":["../../../../src/core/authentication/session/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Session } from '@authup/core-kit';\nimport { IdentityType } from '@authup/core-kit';\nimport { JWTError } from '@authup/specs';\nimport type {\n ISessionManager, \n ISessionRepository, \n SessionManagerContext, \n SessionManagerOptions,\n} from './types.ts';\n\nexport class SessionManager implements ISessionManager {\n protected options: SessionManagerOptions;\n\n protected repository: ISessionRepository;\n\n // -----------------------------------------------------\n\n constructor(ctx: SessionManagerContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n }\n\n // -----------------------------------------------------\n\n /**\n * Create/Update session\n *\n * @param input\n */\n async create(input: Partial<Session>): Promise<Session> {\n input.ip_address = input.ip_address || '127.0.0.1';\n input.user_agent = input.user_agent || 'system';\n input.expires_at = input.expires_at || new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n switch (input.sub_kind) {\n case IdentityType.CLIENT: {\n input.client_id = input.sub;\n break;\n }\n case IdentityType.ROBOT: {\n input.robot_id = input.sub;\n break;\n }\n case IdentityType.USER: {\n input.user_id = input.sub;\n break;\n }\n }\n\n return this.repository.save(input);\n }\n\n // -----------------------------------------------------\n\n async ping(session: Session): Promise<Session> {\n if (session.seen_at) {\n const seenAt = new Date(session.seen_at).getTime();\n const threshold = seenAt + (5 * 1_000);\n\n if (threshold > Date.now()) {\n return session;\n }\n }\n\n session.seen_at = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async refresh(session: Session): Promise<Session> {\n const now = new Date().toISOString();\n session.refreshed_at = now;\n session.seen_at = now;\n\n session.expires_at = new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n /**\n * Verify session on token inspection/verification.\n *\n * @param id\n * @throws JWTError\n */\n async findOneById(id: string): Promise<Session | null> {\n return this.repository.findOneById(id);\n }\n\n // -----------------------------------------------------\n\n async revoke(id: string): Promise<void> {\n await this.repository.removeById(id);\n }\n\n // -----------------------------------------------------\n\n async verify(session: Session): Promise<void> {\n const ms = new Date(session.expires_at).getTime();\n if (Date.now() > ms) {\n await this.repository.remove(session);\n\n // todo: better error\n throw JWTError.expired();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAaE,iBAAb,MAAaA;CACCC;CAEAC;CAIV,YAAYC,KAA4B;EACpC,KAAKF,UAAUE,IAAIF;EACnB,KAAKC,aAAaC,IAAID;CAC1B;;;;;IASA,MAAME,OAAOC,OAA2C;EACpDA,MAAMC,aAAaD,MAAMC,cAAc;EACvCD,MAAME,aAAaF,MAAME,cAAc;EACvCF,MAAMG,aAAaH,MAAMG,cAAc,IAAIC,KACvCA,KAAKC,IAAG,IAAM,KAAKT,QAAQU,SAAS,GAAA,CAAA,CACtCC,YAAW;EAEb,QAAQP,MAAMQ,UAAd;GACI,KAAKf,aAAagB;IACdT,MAAMU,YAAYV,MAAMW;IACxB;GAEJ,KAAKlB,aAAamB;IACdZ,MAAMa,WAAWb,MAAMW;IACvB;GAEJ,KAAKlB,aAAaqB;IACdd,MAAMe,UAAUf,MAAMW;IACtB;EAER;EAEA,OAAO,KAAKd,WAAWmB,KAAKhB,KAAAA;CAChC;CAIA,MAAMiB,KAAKC,SAAoC;EAC3C,IAAIA,QAAQC;OACO,IAAIf,KAAKc,QAAQC,OAAO,CAAA,CAAEE,QACvBD,IAAU,IAAI,MAEhBhB,KAAKC,IAAG,GACpB,OAAOa;EAAAA;EAIfA,QAAQC,2BAAU,IAAIf,KAAAA,EAAAA,CAAOG,YAAW;EAExC,OAAO,KAAKV,WAAWmB,KAAKE,OAAAA;CAChC;CAIA,MAAMK,QAAQL,SAAoC;EAC9C,MAAMb,uBAAM,IAAID,KAAAA,EAAAA,CAAOG,YAAW;EAClCW,QAAQM,eAAenB;EACvBa,QAAQC,UAAUd;EAElBa,QAAQf,aAAa,IAAIC,KACrBA,KAAKC,IAAG,IAAM,KAAKT,QAAQU,SAAS,GAAA,CAAA,CACtCC,YAAW;EAEb,OAAO,KAAKV,WAAWmB,KAAKE,OAAAA;CAChC;;;;;;IAUA,
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["IdentityType","JWTError","SessionManager","options","repository","ctx","create","input","ip_address","user_agent","expires_at","Date","now","maxAge","toISOString","sub_kind","CLIENT","client_id","sub","ROBOT","robot_id","USER","user_id","save","ping","session","seen_at","seenAt","getTime","threshold","refresh","refreshed_at","markMfaVerified","mfa_at","findOneById","id","revoke","removeById","verify","ms","remove","expired"],"sources":["../../../../src/core/authentication/session/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Session } from '@authup/core-kit';\nimport { IdentityType } from '@authup/core-kit';\nimport { JWTError } from '@authup/specs';\nimport type {\n ISessionManager, \n ISessionRepository, \n SessionManagerContext, \n SessionManagerOptions,\n} from './types.ts';\n\nexport class SessionManager implements ISessionManager {\n protected options: SessionManagerOptions;\n\n protected repository: ISessionRepository;\n\n // -----------------------------------------------------\n\n constructor(ctx: SessionManagerContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n }\n\n // -----------------------------------------------------\n\n /**\n * Create/Update session\n *\n * @param input\n */\n async create(input: Partial<Session>): Promise<Session> {\n input.ip_address = input.ip_address || '127.0.0.1';\n input.user_agent = input.user_agent || 'system';\n input.expires_at = input.expires_at || new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n switch (input.sub_kind) {\n case IdentityType.CLIENT: {\n input.client_id = input.sub;\n break;\n }\n case IdentityType.ROBOT: {\n input.robot_id = input.sub;\n break;\n }\n case IdentityType.USER: {\n input.user_id = input.sub;\n break;\n }\n }\n\n return this.repository.save(input);\n }\n\n // -----------------------------------------------------\n\n async ping(session: Session): Promise<Session> {\n if (session.seen_at) {\n const seenAt = new Date(session.seen_at).getTime();\n const threshold = seenAt + (5 * 1_000);\n\n if (threshold > Date.now()) {\n return session;\n }\n }\n\n session.seen_at = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async refresh(session: Session): Promise<Session> {\n const now = new Date().toISOString();\n session.refreshed_at = now;\n session.seen_at = now;\n\n session.expires_at = new Date(\n Date.now() + (this.options.maxAge * 1_000),\n ).toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n async markMfaVerified(session: Session): Promise<Session> {\n session.mfa_at = new Date().toISOString();\n\n return this.repository.save(session);\n }\n\n // -----------------------------------------------------\n\n /**\n * Verify session on token inspection/verification.\n *\n * @param id\n * @throws JWTError\n */\n async findOneById(id: string): Promise<Session | null> {\n return this.repository.findOneById(id);\n }\n\n // -----------------------------------------------------\n\n async revoke(id: string): Promise<void> {\n await this.repository.removeById(id);\n }\n\n // -----------------------------------------------------\n\n async verify(session: Session): Promise<void> {\n const ms = new Date(session.expires_at).getTime();\n if (Date.now() > ms) {\n await this.repository.remove(session);\n\n // todo: better error\n throw JWTError.expired();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAaE,iBAAb,MAAaA;CACCC;CAEAC;CAIV,YAAYC,KAA4B;EACpC,KAAKF,UAAUE,IAAIF;EACnB,KAAKC,aAAaC,IAAID;CAC1B;;;;;IASA,MAAME,OAAOC,OAA2C;EACpDA,MAAMC,aAAaD,MAAMC,cAAc;EACvCD,MAAME,aAAaF,MAAME,cAAc;EACvCF,MAAMG,aAAaH,MAAMG,cAAc,IAAIC,KACvCA,KAAKC,IAAG,IAAM,KAAKT,QAAQU,SAAS,GAAA,CAAA,CACtCC,YAAW;EAEb,QAAQP,MAAMQ,UAAd;GACI,KAAKf,aAAagB;IACdT,MAAMU,YAAYV,MAAMW;IACxB;GAEJ,KAAKlB,aAAamB;IACdZ,MAAMa,WAAWb,MAAMW;IACvB;GAEJ,KAAKlB,aAAaqB;IACdd,MAAMe,UAAUf,MAAMW;IACtB;EAER;EAEA,OAAO,KAAKd,WAAWmB,KAAKhB,KAAAA;CAChC;CAIA,MAAMiB,KAAKC,SAAoC;EAC3C,IAAIA,QAAQC;OACO,IAAIf,KAAKc,QAAQC,OAAO,CAAA,CAAEE,QACvBD,IAAU,IAAI,MAEhBhB,KAAKC,IAAG,GACpB,OAAOa;EAAAA;EAIfA,QAAQC,2BAAU,IAAIf,KAAAA,EAAAA,CAAOG,YAAW;EAExC,OAAO,KAAKV,WAAWmB,KAAKE,OAAAA;CAChC;CAIA,MAAMK,QAAQL,SAAoC;EAC9C,MAAMb,uBAAM,IAAID,KAAAA,EAAAA,CAAOG,YAAW;EAClCW,QAAQM,eAAenB;EACvBa,QAAQC,UAAUd;EAElBa,QAAQf,aAAa,IAAIC,KACrBA,KAAKC,IAAG,IAAM,KAAKT,QAAQU,SAAS,GAAA,CAAA,CACtCC,YAAW;EAEb,OAAO,KAAKV,WAAWmB,KAAKE,OAAAA;CAChC;CAIA,MAAMO,gBAAgBP,SAAoC;EACtDA,QAAQQ,0BAAS,IAAItB,KAAAA,EAAAA,CAAOG,YAAW;EAEvC,OAAO,KAAKV,WAAWmB,KAAKE,OAAAA;CAChC;;;;;;IAUA,MAAMS,YAAYC,IAAqC;EACnD,OAAO,KAAK/B,WAAW8B,YAAYC,EAAAA;CACvC;CAIA,MAAMC,OAAOD,IAA2B;EACpC,MAAM,KAAK/B,WAAWiC,WAAWF,EAAAA;CACrC;CAIA,MAAMG,OAAOb,SAAiC;EAC1C,MAAMc,KAAK,IAAI5B,KAAKc,QAAQf,UAAU,CAAA,CAAEkB,QAAO;EAC/C,IAAIjB,KAAKC,IAAG,IAAK2B,IAAI;GACjB,MAAM,KAAKnC,WAAWoC,OAAOf,OAAAA;GAG7B,MAAMxB,SAASwC,QAAO;EAC1B;CACJ;AACJ"}
|
|
@@ -61,6 +61,12 @@ export interface ISessionManager {
|
|
|
61
61
|
* @param session
|
|
62
62
|
*/
|
|
63
63
|
refresh(session: Session): Promise<Session>;
|
|
64
|
+
/**
|
|
65
|
+
* Stamp a successful second-factor challenge (mfa_at) onto the session.
|
|
66
|
+
*
|
|
67
|
+
* @param session
|
|
68
|
+
*/
|
|
69
|
+
markMfaVerified(session: Session): Promise<Session>;
|
|
64
70
|
/**
|
|
65
71
|
* Check if session exists and is valid.
|
|
66
72
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/session/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oFAQtB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAExD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzH,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAExD;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAE/D,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAElD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,UAAU,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/authentication/session/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oFAQtB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAExD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzH,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAExD;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAE/D,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAElD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,UAAU,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":["SESSION_FILTER_KEYS"],"sources":["../../../../src/core/authentication/session/types.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Session } from '@authup/core-kit';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\n\nexport type SessionOwner = {\n sub: string,\n subKind: string,\n};\n\n/**\n * Filter keys a session query (list + bulk revoke) may target. Shared by the\n * repository's rapiq `filters.allowed` and the service's \"is this a targeted\n * bulk revoke?\" discriminator, so the two can never drift.\n */\nexport const SESSION_FILTER_KEYS = [\n 'id',\n 'sub',\n 'sub_kind',\n 'user_id',\n 'client_id',\n 'robot_id',\n 'realm_id',\n] as const;\n\nexport type SessionFindManyOptions = {\n /**\n * Force the result to a single subject (self-service). Applied as a\n * mandatory WHERE that a rapiq query filter cannot override.\n */\n owner?: SessionOwner,\n};\n\nexport interface ISessionRepository {\n findOneById(id: string): Promise<Session | null> | null;\n\n findMany(query: Record<string, any>, options?: SessionFindManyOptions): Promise<EntityRepositoryFindManyResult<Session>>;\n\n findAllByOwner(owner: SessionOwner): Promise<Session[]>;\n\n /**\n * Load EVERY session matching a rapiq query filter — **unbounded** (no\n * pagination cap), because a bulk revoke must reach every match. Used by\n * the admin \"force-logout\" path; per-session authorization is enforced by\n * the caller (`SessionService`).\n */\n findAllByQuery(query: Record<string, any>): Promise<Session[]>;\n\n save(session: Partial<Session>): Promise<Session>;\n\n removeById(id: string): Promise<void>;\n\n remove(session: Session) : Promise<void>;\n}\n\nexport type SessionManagerOptions = {\n /**\n * Max age in seconds (sec).\n */\n maxAge: number\n};\n\nexport type SessionManagerContext = {\n options: SessionManagerOptions,\n repository: ISessionRepository,\n};\n\nexport interface ISessionManager {\n /**\n * Create new session.\n *\n * @param session\n */\n create(session: Partial<Session>): Promise<Session>;\n\n /**\n * Updates seen_at with current time.\n *\n * @param session\n */\n ping(session: Session) : Promise<Session>;\n\n /**\n * Updates refreshed_at, seen_at with current time.\n *\n * @param session\n */\n refresh(session: Session) : Promise<Session>;\n\n /**\n * Check if session exists and is valid.\n *\n * @throws JWTError\n * @param session\n */\n verify(session: Session): Promise<void>;\n\n /**\n * Find session by id.\n *\n * @param id\n */\n findOneById(id: string): Promise<Session | null>;\n\n /**\n * Revoke (delete) a session by id, forcing re-authentication. Idempotent —\n * a no-op when the session does not exist.\n *\n * @param id\n */\n revoke(id: string): Promise<void>;\n}\n"],"mappings":";;;;;;;;GAoBA,MAAaA,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA"}
|
|
1
|
+
{"version":3,"file":"types.mjs","names":["SESSION_FILTER_KEYS"],"sources":["../../../../src/core/authentication/session/types.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Session } from '@authup/core-kit';\nimport type { EntityRepositoryFindManyResult } from '@authup/server-kit';\n\nexport type SessionOwner = {\n sub: string,\n subKind: string,\n};\n\n/**\n * Filter keys a session query (list + bulk revoke) may target. Shared by the\n * repository's rapiq `filters.allowed` and the service's \"is this a targeted\n * bulk revoke?\" discriminator, so the two can never drift.\n */\nexport const SESSION_FILTER_KEYS = [\n 'id',\n 'sub',\n 'sub_kind',\n 'user_id',\n 'client_id',\n 'robot_id',\n 'realm_id',\n] as const;\n\nexport type SessionFindManyOptions = {\n /**\n * Force the result to a single subject (self-service). Applied as a\n * mandatory WHERE that a rapiq query filter cannot override.\n */\n owner?: SessionOwner,\n};\n\nexport interface ISessionRepository {\n findOneById(id: string): Promise<Session | null> | null;\n\n findMany(query: Record<string, any>, options?: SessionFindManyOptions): Promise<EntityRepositoryFindManyResult<Session>>;\n\n findAllByOwner(owner: SessionOwner): Promise<Session[]>;\n\n /**\n * Load EVERY session matching a rapiq query filter — **unbounded** (no\n * pagination cap), because a bulk revoke must reach every match. Used by\n * the admin \"force-logout\" path; per-session authorization is enforced by\n * the caller (`SessionService`).\n */\n findAllByQuery(query: Record<string, any>): Promise<Session[]>;\n\n save(session: Partial<Session>): Promise<Session>;\n\n removeById(id: string): Promise<void>;\n\n remove(session: Session) : Promise<void>;\n}\n\nexport type SessionManagerOptions = {\n /**\n * Max age in seconds (sec).\n */\n maxAge: number\n};\n\nexport type SessionManagerContext = {\n options: SessionManagerOptions,\n repository: ISessionRepository,\n};\n\nexport interface ISessionManager {\n /**\n * Create new session.\n *\n * @param session\n */\n create(session: Partial<Session>): Promise<Session>;\n\n /**\n * Updates seen_at with current time.\n *\n * @param session\n */\n ping(session: Session) : Promise<Session>;\n\n /**\n * Updates refreshed_at, seen_at with current time.\n *\n * @param session\n */\n refresh(session: Session) : Promise<Session>;\n\n /**\n * Stamp a successful second-factor challenge (mfa_at) onto the session.\n *\n * @param session\n */\n markMfaVerified(session: Session) : Promise<Session>;\n\n /**\n * Check if session exists and is valid.\n *\n * @throws JWTError\n * @param session\n */\n verify(session: Session): Promise<void>;\n\n /**\n * Find session by id.\n *\n * @param id\n */\n findOneById(id: string): Promise<Session | null>;\n\n /**\n * Revoke (delete) a session by id, forcing re-authentication. Idempotent —\n * a no-op when the session does not exist.\n *\n * @param id\n */\n revoke(id: string): Promise<void>;\n}\n"],"mappings":";;;;;;;;GAoBA,MAAaA,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/client-certificate/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { ClientCertificateValidator, assertClientCertificateEvidenceValidForBinding, buildClientCertificateThumbprint, parseClientCertificateChain } from "./module.mjs";
|
|
5
|
+
export { ClientCertificateValidator, assertClientCertificateEvidenceValidForBinding, buildClientCertificateThumbprint, parseClientCertificateChain };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { X509Certificate } from '@peculiar/x509';
|
|
2
|
+
import type { Client } from '@authup/core-kit';
|
|
3
|
+
import type { ClientCertificateEvidence, ClientCertificateValidatorContext, IClientCertificateValidator } from './types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Validates client certificates without performing network I/O. AIA, CRL,
|
|
6
|
+
* and OCSP retrieval are deliberately outside the external-PKI first slice.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ClientCertificateValidator implements IClientCertificateValidator {
|
|
9
|
+
protected trustAnchorRepository: ClientCertificateValidatorContext['trustAnchorRepository'];
|
|
10
|
+
protected crypto?: Crypto;
|
|
11
|
+
constructor(ctx: ClientCertificateValidatorContext);
|
|
12
|
+
validateForBinding(evidence: ClientCertificateEvidence): void;
|
|
13
|
+
validateForAuthentication(client: Pick<Client, 'id' | 'realm_id'>, evidence: ClientCertificateEvidence): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function assertClientCertificateEvidenceValidForBinding(evidence: ClientCertificateEvidence): void;
|
|
16
|
+
export declare function parseClientCertificateChain(pem: string): X509Certificate[];
|
|
17
|
+
export declare function buildClientCertificateThumbprint(certificate: X509Certificate, crypto?: Crypto): Promise<string>;
|
|
18
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/core/client-certificate/module.ts"],"names":[],"mappings":"AAOA,OAAO,EAUH,eAAe,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAO5D,OAAO,KAAK,EACR,yBAAyB,EACzB,iCAAiC,EACjC,2BAA2B,EAC9B,MAAM,YAAY,CAAC;AAuCpB;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,2BAA2B;IAC1E,SAAS,CAAC,qBAAqB,EAAE,iCAAiC,CAAC,uBAAuB,CAAC,CAAC;IAE5F,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEd,GAAG,EAAE,iCAAiC;IAKlD,kBAAkB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAIvD,yBAAyB,CAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,UAAU,CAAC,EACvC,QAAQ,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC;CA0CnB;AAED,wBAAgB,8CAA8C,CAC1D,QAAQ,EAAE,yBAAyB,GACpC,IAAI,CAON;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAW1E;AAED,wBAAsB,gCAAgC,CAClD,WAAW,EAAE,eAAe,EAC5B,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { base64URLEncode } from "@authup/kit";
|
|
5
|
+
import { CLIENT_CERTIFICATE_URI_PREFIX, buildClientCertificateURI } from "@authup/core-kit";
|
|
6
|
+
import { ValidationError } from "@authup/errors";
|
|
7
|
+
import { AuthorityKeyIdentifierExtension, BasicConstraintsExtension, ExtendedKeyUsage, ExtendedKeyUsageExtension, KeyUsageFlags, KeyUsagesExtension, SubjectAlternativeNameExtension, SubjectKeyIdentifierExtension, URL, X509Certificate } from "@peculiar/x509";
|
|
8
|
+
//#region src/core/client-certificate/module.ts
|
|
9
|
+
const MAX_CHAIN_DEPTH = 10;
|
|
10
|
+
const CERTIFICATE_BLOCK_PATTERN = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
|
|
11
|
+
/**
|
|
12
|
+
* Hard ceiling on signature verifications performed while building a single
|
|
13
|
+
* certification path. A legitimate chain of the maximum accepted length only
|
|
14
|
+
* needs O(depth²) verifications; the ceiling exists purely to defuse the
|
|
15
|
+
* factorial backtracking blow-up an attacker can induce with certificates
|
|
16
|
+
* that mutually "issue" one another (shared key, identical subject/issuer
|
|
17
|
+
* DNs). Reaching the ceiling is treated as "no path found" (fail closed).
|
|
18
|
+
*/ const MAX_PATH_SIGNATURE_VERIFICATIONS = 64;
|
|
19
|
+
/**
|
|
20
|
+
* OIDs of the certificate extensions this validator actually processes. A
|
|
21
|
+
* certificate carrying a *critical* extension outside this set is rejected
|
|
22
|
+
* (RFC 5280 §4.2): an unprocessed critical constraint must never be silently
|
|
23
|
+
* ignored. Because RFC 5280 requires the NameConstraints extension to be
|
|
24
|
+
* marked critical, this also fails a name-constrained CA closed rather than
|
|
25
|
+
* trusting a chain whose name constraints we do not evaluate.
|
|
26
|
+
*/ const HANDLED_CRITICAL_EXTENSION_OIDS = /* @__PURE__ */ new Set([
|
|
27
|
+
"2.5.29.19",
|
|
28
|
+
"2.5.29.15",
|
|
29
|
+
"2.5.29.37",
|
|
30
|
+
"2.5.29.17",
|
|
31
|
+
"2.5.29.35",
|
|
32
|
+
"2.5.29.14"
|
|
33
|
+
]);
|
|
34
|
+
const WEAK_SIGNATURE_HASHES = /* @__PURE__ */ new Set([
|
|
35
|
+
"SHA-1",
|
|
36
|
+
"MD5",
|
|
37
|
+
"MD2",
|
|
38
|
+
"MD4"
|
|
39
|
+
]);
|
|
40
|
+
const ANY_EXTENDED_KEY_USAGE_OID = "2.5.29.37.0";
|
|
41
|
+
/**
|
|
42
|
+
* Validates client certificates without performing network I/O. AIA, CRL,
|
|
43
|
+
* and OCSP retrieval are deliberately outside the external-PKI first slice.
|
|
44
|
+
*/ var ClientCertificateValidator = class {
|
|
45
|
+
trustAnchorRepository;
|
|
46
|
+
crypto;
|
|
47
|
+
constructor(ctx) {
|
|
48
|
+
this.trustAnchorRepository = ctx.trustAnchorRepository;
|
|
49
|
+
this.crypto = ctx.crypto;
|
|
50
|
+
}
|
|
51
|
+
validateForBinding(evidence) {
|
|
52
|
+
assertClientCertificateEvidenceValidForBinding(evidence);
|
|
53
|
+
}
|
|
54
|
+
async validateForAuthentication(client, evidence) {
|
|
55
|
+
this.validateForBinding(evidence);
|
|
56
|
+
assertClientCertificatePurpose(evidence.certificate);
|
|
57
|
+
assertClientCertificateIdentity(evidence.certificate, client.id);
|
|
58
|
+
assertCertificateExtensionsUnderstood(evidence.certificate);
|
|
59
|
+
assertStrongSignature(evidence.certificate);
|
|
60
|
+
const anchors = await this.trustAnchorRepository.findManyBy({
|
|
61
|
+
realm_id: client.realm_id,
|
|
62
|
+
enabled: true
|
|
63
|
+
});
|
|
64
|
+
for (const anchor of anchors) {
|
|
65
|
+
const anchorCertificate = parseAnchorCertificate(anchor);
|
|
66
|
+
if (!anchorCertificate) continue;
|
|
67
|
+
const budget = { remaining: MAX_PATH_SIGNATURE_VERIFICATIONS };
|
|
68
|
+
const path = await buildPath(evidence.certificate, evidence.chain, anchorCertificate, budget, this.crypto);
|
|
69
|
+
if (!path) continue;
|
|
70
|
+
try {
|
|
71
|
+
assertCertificationPath(path);
|
|
72
|
+
return;
|
|
73
|
+
} catch {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
throw new ValidationError("The client certificate is not trusted in this realm.");
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
function assertClientCertificateEvidenceValidForBinding(evidence) {
|
|
81
|
+
assertCertificateCurrent(evidence.certificate);
|
|
82
|
+
if (evidence.certificate.getExtension(BasicConstraintsExtension)?.ca) throw new ValidationError("A CA certificate cannot be used as a client certificate.");
|
|
83
|
+
}
|
|
84
|
+
function parseClientCertificateChain(pem) {
|
|
85
|
+
const blocks = pem.match(CERTIFICATE_BLOCK_PATTERN);
|
|
86
|
+
if (!blocks || blocks.length === 0) throw new ValidationError("The certificate chain could not be parsed.");
|
|
87
|
+
try {
|
|
88
|
+
return blocks.map((block) => new X509Certificate(block));
|
|
89
|
+
} catch {
|
|
90
|
+
throw new ValidationError("The certificate chain could not be parsed.");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function buildClientCertificateThumbprint(certificate, crypto) {
|
|
94
|
+
const digest = await certificate.getThumbprint("SHA-256", crypto);
|
|
95
|
+
return base64URLEncode(String.fromCharCode(...new Uint8Array(digest)));
|
|
96
|
+
}
|
|
97
|
+
function parseAnchorCertificate(anchor) {
|
|
98
|
+
try {
|
|
99
|
+
return parseClientCertificateChain(anchor.certificate)[0];
|
|
100
|
+
} catch {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function buildPath(leaf, intermediates, anchor, budget, crypto) {
|
|
105
|
+
return continuePath(leaf, intermediates, anchor, [leaf], budget, crypto);
|
|
106
|
+
}
|
|
107
|
+
async function continuePath(current, available, anchor, path, budget, crypto) {
|
|
108
|
+
if (path.length > MAX_CHAIN_DEPTH) return;
|
|
109
|
+
if (sameCertificate(current, anchor)) return path;
|
|
110
|
+
if (await isIssuedBy(current, anchor, budget, crypto)) return [...path, anchor];
|
|
111
|
+
for (let index = 0; index < available.length; index += 1) {
|
|
112
|
+
const candidate = available[index];
|
|
113
|
+
if (!candidate || sameCertificate(current, candidate) || !await isIssuedBy(current, candidate, budget, crypto)) continue;
|
|
114
|
+
const next = await continuePath(candidate, available.filter((_item, candidateIndex) => candidateIndex !== index), anchor, [...path, candidate], budget, crypto);
|
|
115
|
+
if (next) return next;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function isIssuedBy(certificate, issuer, budget, crypto) {
|
|
119
|
+
if (certificate.issuer !== issuer.subject) return false;
|
|
120
|
+
const authorityKeyIdentifier = certificate.getExtension(AuthorityKeyIdentifierExtension);
|
|
121
|
+
if (authorityKeyIdentifier?.keyId) {
|
|
122
|
+
const subjectKeyIdentifier = issuer.getExtension(SubjectKeyIdentifierExtension);
|
|
123
|
+
if (subjectKeyIdentifier && subjectKeyIdentifier.keyId !== authorityKeyIdentifier.keyId) return false;
|
|
124
|
+
}
|
|
125
|
+
if (budget.remaining <= 0) return false;
|
|
126
|
+
budget.remaining -= 1;
|
|
127
|
+
try {
|
|
128
|
+
return await certificate.verify({
|
|
129
|
+
publicKey: issuer,
|
|
130
|
+
signatureOnly: true
|
|
131
|
+
}, crypto);
|
|
132
|
+
} catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function sameCertificate(left, right) {
|
|
137
|
+
const leftRaw = new Uint8Array(left.rawData);
|
|
138
|
+
const rightRaw = new Uint8Array(right.rawData);
|
|
139
|
+
return leftRaw.length === rightRaw.length && leftRaw.every((value, index) => value === rightRaw[index]);
|
|
140
|
+
}
|
|
141
|
+
function assertCertificationPath(path) {
|
|
142
|
+
if (path.length < 2) throw new ValidationError("The client certificate chain is invalid.");
|
|
143
|
+
for (let index = 1; index < path.length; index += 1) {
|
|
144
|
+
const certificate = path[index];
|
|
145
|
+
if (!certificate) throw new ValidationError("The client certificate chain is invalid.");
|
|
146
|
+
if (!(index === path.length - 1)) {
|
|
147
|
+
assertCertificateExtensionsUnderstood(certificate);
|
|
148
|
+
assertStrongSignature(certificate);
|
|
149
|
+
assertIssuerExtendedKeyUsage(certificate);
|
|
150
|
+
}
|
|
151
|
+
assertCertificateCurrent(certificate);
|
|
152
|
+
const constraints = certificate.getExtension(BasicConstraintsExtension);
|
|
153
|
+
if (!constraints?.ca) throw new ValidationError("The client certificate chain contains a non-CA issuer.");
|
|
154
|
+
const keyUsage = certificate.getExtension(KeyUsagesExtension);
|
|
155
|
+
if (keyUsage && (keyUsage.usages & KeyUsageFlags.keyCertSign) === 0) throw new ValidationError("A client certificate issuer cannot sign certificates.");
|
|
156
|
+
if (typeof constraints.pathLength === "number" && index - 1 > constraints.pathLength) throw new ValidationError("The client certificate chain exceeds a CA path-length constraint.");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function assertClientCertificatePurpose(certificate) {
|
|
160
|
+
const extendedKeyUsage = certificate.getExtension(ExtendedKeyUsageExtension);
|
|
161
|
+
if (extendedKeyUsage && !extendedKeyUsage.usages.includes(ExtendedKeyUsage.clientAuth)) throw new ValidationError("The certificate is not valid for TLS client authentication.");
|
|
162
|
+
const keyUsage = certificate.getExtension(KeyUsagesExtension);
|
|
163
|
+
if (keyUsage && (keyUsage.usages & KeyUsageFlags.digitalSignature) === 0) throw new ValidationError("The certificate cannot prove possession of its private key.");
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* EKU chaining (RFC 5280 §4.2.1.12): a CA whose Extended Key Usage is present
|
|
167
|
+
* but omits both `clientAuth` and `anyExtendedKeyUsage` is not permitted to
|
|
168
|
+
* issue TLS-client-authentication certificates, so a leaf beneath it must be
|
|
169
|
+
* rejected. (A CA's EKU may be non-critical, so the critical-extension check
|
|
170
|
+
* does not cover this.) A CA with no EKU extension is unconstrained.
|
|
171
|
+
*/ function assertIssuerExtendedKeyUsage(certificate) {
|
|
172
|
+
const extendedKeyUsage = certificate.getExtension(ExtendedKeyUsageExtension);
|
|
173
|
+
if (extendedKeyUsage && !extendedKeyUsage.usages.includes(ExtendedKeyUsage.clientAuth) && !extendedKeyUsage.usages.includes(ANY_EXTENDED_KEY_USAGE_OID)) throw new ValidationError("A client certificate issuer is not permitted to issue TLS client-authentication certificates.");
|
|
174
|
+
}
|
|
175
|
+
function assertClientCertificateIdentity(certificate, clientId) {
|
|
176
|
+
const subjectAlternativeName = certificate.getExtension(SubjectAlternativeNameExtension);
|
|
177
|
+
const authupUris = subjectAlternativeName ? subjectAlternativeName.names.items.filter((name) => name.type === URL).map((name) => name.value).filter((value) => value.startsWith(CLIENT_CERTIFICATE_URI_PREFIX)) : [];
|
|
178
|
+
const expected = buildClientCertificateURI(clientId);
|
|
179
|
+
if (authupUris.length !== 1 || authupUris[0] !== expected) throw new ValidationError(`The certificate must contain exactly one Authup client URI SAN: ${expected}.`);
|
|
180
|
+
}
|
|
181
|
+
function assertCertificateCurrent(certificate) {
|
|
182
|
+
const now = Date.now();
|
|
183
|
+
if (certificate.notBefore.getTime() > now || certificate.notAfter.getTime() < now) throw new ValidationError("The client certificate is not currently valid.");
|
|
184
|
+
}
|
|
185
|
+
function assertCertificateExtensionsUnderstood(certificate) {
|
|
186
|
+
for (const extension of certificate.extensions) if (extension.critical && !HANDLED_CRITICAL_EXTENSION_OIDS.has(extension.type)) throw new ValidationError(`The certificate carries an unsupported critical extension (${extension.type}).`);
|
|
187
|
+
}
|
|
188
|
+
function assertStrongSignature(certificate) {
|
|
189
|
+
const hash = certificate.signatureAlgorithm?.hash?.name;
|
|
190
|
+
if (typeof hash === "string" && WEAK_SIGNATURE_HASHES.has(hash.toUpperCase())) throw new ValidationError(`The certificate is signed with a weak algorithm (${hash}).`);
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { ClientCertificateValidator, assertClientCertificateEvidenceValidForBinding, buildClientCertificateThumbprint, parseClientCertificateChain };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=module.mjs.map
|