@authup/server-core 1.0.0-beta.51 → 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 +20 -8
- package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
- package/dist/adapters/database/domains/client/entity.d.ts +6 -2
- package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/entity.mjs +33 -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 +5 -0
- package/dist/adapters/database/domains/index.d.ts.map +1 -1
- package/dist/adapters/database/domains/index.mjs +26 -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 +13 -1
- package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/session-token/entity.d.ts +17 -0
- package/dist/adapters/database/domains/session-token/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/session-token/entity.mjs +95 -0
- package/dist/adapters/database/domains/session-token/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/session-token/index.d.ts +2 -0
- package/dist/adapters/database/domains/session-token/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/session-token/index.mjs +5 -0
- package/dist/adapters/database/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 +18 -11
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts +28 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs +85 -0
- package/dist/adapters/database/migrations/mysql/1783325495597-Default.mjs.map +1 -0
- package/dist/adapters/database/migrations/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/1783325495597-Default.d.ts +28 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs +79 -0
- package/dist/adapters/database/migrations/postgres/1783325495597-Default.mjs.map +1 -0
- package/dist/adapters/database/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 +8 -6
- package/dist/adapters/database/subscriber/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/index.mjs +3 -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 +28 -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 +5 -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 +30 -4
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts +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 +15 -5
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/index.mjs +3 -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 +123 -8
- 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 +4 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +25 -5
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts +16 -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/index.d.ts +2 -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 +3 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts +9 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.d.ts.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs +21 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/realm.mjs.map +1 -0
- package/dist/adapters/http/adapters/oauth2/index.mjs +3 -1
- package/dist/adapters/http/controllers/entities/client/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/client-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/client-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/client-scope/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/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-provide-role/module.mjs +1 -1
- 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 +40 -11
- 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 +6 -0
- package/dist/adapters/http/controllers/entities/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.mjs +13 -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/permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/permission-policy/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/policy/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/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 +26 -8
- package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/robot/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/robot-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/robot-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role-attribute/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/role-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/scope/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/session/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/session/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/session/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/session/module.d.ts +16 -0
- package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/session/module.mjs +102 -0
- package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/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/module.mjs +2 -2
- package/dist/adapters/http/controllers/entities/user-attribute/module.mjs +1 -1
- 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/entities/user-permission/module.mjs +1 -1
- package/dist/adapters/http/controllers/entities/user-role/module.mjs +1 -1
- package/dist/adapters/http/controllers/index.mjs +9 -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 +55 -14
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +23 -4
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.mjs +5 -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/logout/index.d.ts +3 -0
- package/dist/adapters/http/controllers/workflows/logout/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/logout/module.d.ts +14 -0
- package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/module.mjs +101 -0
- package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/workflows/logout/types.d.ts +9 -0
- package/dist/adapters/http/controllers/workflows/logout/types.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/status/module.mjs +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 +35 -8
- package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/types.d.ts +17 -3
- package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
- package/dist/adapters/http/index.mjs +28 -14
- 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 +54 -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 +3 -3
- package/dist/adapters/http/middleware/built-in/logger.d.ts +1 -0
- package/dist/adapters/http/middleware/built-in/logger.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/logger.mjs +23 -2
- package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts +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/built-in/realm-resolver/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs +3 -8
- package/dist/adapters/http/middleware/built-in/realm-resolver/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +2 -2
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -1
- package/dist/adapters/http/middleware/index.mjs +3 -3
- 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 +2 -0
- package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
- package/dist/adapters/http/request/helpers/index.mjs +3 -1
- package/dist/adapters/http/request/helpers/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/helpers/session-id.d.ts +9 -0
- package/dist/adapters/http/request/helpers/session-id.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/session-id.mjs +19 -0
- package/dist/adapters/http/request/helpers/session-id.mjs.map +1 -0
- package/dist/adapters/http/request/index.d.ts +3 -0
- package/dist/adapters/http/request/index.d.ts.map +1 -1
- package/dist/adapters/http/request/index.mjs +6 -2
- package/dist/adapters/http/request/permission/module.d.ts.map +1 -1
- package/dist/adapters/http/request/permission/module.mjs +4 -2
- package/dist/adapters/http/request/permission/module.mjs.map +1 -1
- package/dist/adapters/http/request/types.d.ts +3 -0
- package/dist/adapters/http/request/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/index.d.ts +1 -0
- package/dist/adapters/http/ui/index.d.ts.map +1 -1
- package/dist/adapters/http/ui/index.mjs +2 -1
- package/dist/adapters/http/ui/internal-http-client.d.ts +22 -0
- package/dist/adapters/http/ui/internal-http-client.d.ts.map +1 -0
- package/dist/adapters/http/ui/internal-http-client.mjs +52 -0
- package/dist/adapters/http/ui/internal-http-client.mjs.map +1 -0
- package/dist/adapters/http/ui/render.d.ts.map +1 -1
- package/dist/adapters/http/ui/render.mjs +5 -2
- package/dist/adapters/http/ui/render.mjs.map +1 -1
- package/dist/adapters/http/ui/types.d.ts +12 -0
- package/dist/adapters/http/ui/types.d.ts.map +1 -1
- package/dist/app/index.mjs +11 -5
- package/dist/app/modules/authentication/repositories/session.d.ts +5 -2
- package/dist/app/modules/authentication/repositories/session.d.ts.map +1 -1
- package/dist/app/modules/authentication/repositories/session.mjs +63 -0
- package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
- package/dist/app/modules/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 +18 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +18 -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 +36 -3
- 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 +65 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +132 -2
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/config/validator.d.ts.map +1 -1
- package/dist/app/modules/config/validator.mjs +21 -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 +2 -0
- package/dist/app/modules/database/module.d.ts.map +1 -1
- package/dist/app/modules/database/module.mjs +51 -7
- 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 +18 -10
- 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 +13 -0
- package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/helpers.mjs +16 -1
- package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs +8 -8
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/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/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/permission/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/permission-provider/module.mjs +1 -1
- package/dist/app/modules/database/repositories/policy/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/policy/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/realm/repository.d.ts +1 -0
- package/dist/app/modules/database/repositories/realm/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/realm/repository.mjs +14 -1
- package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/robot/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/robot/repository.mjs +8 -6
- package/dist/app/modules/database/repositories/robot/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/role/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs +2 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/scope/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/scope/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/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/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/user/repository.mjs +8 -5
- package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs +2 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/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/constants.d.ts +4 -2
- package/dist/app/modules/http/constants.d.ts.map +1 -1
- package/dist/app/modules/http/constants.mjs +4 -2
- package/dist/app/modules/http/constants.mjs.map +1 -1
- package/dist/app/modules/http/module.d.ts +18 -0
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +48 -0
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +18 -3
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +236 -23
- 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 +11 -5
- 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 +10 -2
- package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
- package/dist/app/modules/oauth2/constants.mjs +8 -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 +33 -8
- 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 +2 -1
- package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/index.mjs +5 -3
- package/dist/app/modules/oauth2/repositories/session-token/index.d.ts +2 -0
- package/dist/app/modules/oauth2/repositories/session-token/index.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/session-token/index.mjs +5 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts +17 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.mjs +63 -0
- package/dist/app/modules/oauth2/repositories/session-token/repository.mjs.map +1 -0
- package/dist/app/modules/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 +23 -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 -1
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/cli/commands/migration.d.ts.map +1 -1
- package/dist/cli/commands/migration.mjs +12 -4
- package/dist/cli/commands/migration.mjs.map +1 -1
- package/dist/components/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 +11 -3
- 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 +4 -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/login-throttle/types.mjs +4 -0
- package/dist/core/authentication/session/index.mjs +2 -1
- package/dist/core/authentication/session/module.d.ts +2 -0
- package/dist/core/authentication/session/module.d.ts.map +1 -1
- package/dist/core/authentication/session/module.mjs +7 -0
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/authentication/session/types.d.ts +40 -0
- package/dist/core/authentication/session/types.d.ts.map +1 -1
- package/dist/core/authentication/session/types.mjs +18 -1
- package/dist/core/authentication/session/types.mjs.map +1 -0
- package/dist/core/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 +5 -3
- package/dist/core/entities/client/web-client.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.mjs +11 -6
- 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 +6 -0
- package/dist/core/entities/index.d.ts.map +1 -1
- package/dist/core/entities/index.mjs +22 -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/realm/types.d.ts +9 -0
- package/dist/core/entities/realm/types.d.ts.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/index.d.ts +3 -0
- package/dist/core/entities/session/index.d.ts.map +1 -0
- package/dist/core/entities/session/index.mjs +5 -0
- package/dist/core/entities/session/service.d.ts +27 -0
- package/dist/core/entities/session/service.d.ts.map +1 -0
- package/dist/core/entities/session/service.mjs +154 -0
- package/dist/core/entities/session/service.mjs.map +1 -0
- package/dist/core/entities/session/types.d.ts +48 -0
- package/dist/core/entities/session/types.d.ts.map +1 -0
- package/dist/core/entities/session/types.mjs +4 -0
- package/dist/core/entities/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.d.ts +1 -0
- package/dist/core/entities/user/service.d.ts.map +1 -1
- package/dist/core/entities/user/service.mjs +3 -3
- 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 +27 -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 +3 -1
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/permission/checker/service.d.ts.map +1 -1
- package/dist/core/identity/permission/checker/service.mjs +6 -5
- package/dist/core/identity/permission/checker/service.mjs.map +1 -1
- package/dist/core/identity/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.d.ts.map +1 -1
- package/dist/core/identity/policy/checker/service.mjs +7 -6
- package/dist/core/identity/policy/checker/service.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/facebook.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/facebook.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/facebook.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/github.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/github.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/github.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/google.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/google.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/google.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/instagram.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/instagram.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/instagram.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/presets/paypal.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/presets/paypal.mjs +2 -1
- package/dist/core/identity/provider/authentication/presets/paypal.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +7 -2
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts +2 -0
- package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs +5 -0
- package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs.map +1 -1
- package/dist/core/identity/registration/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 +35 -10
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +3 -1
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/identity/resolver/module.d.ts +7 -0
- package/dist/core/identity/resolver/module.d.ts.map +1 -1
- package/dist/core/identity/resolver/module.mjs +7 -1
- package/dist/core/identity/resolver/module.mjs.map +1 -1
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.mjs +48 -9
- 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/index.mjs +1 -0
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts +0 -1
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/module.mjs +9 -7
- package/dist/core/oauth2/authorization/code/issuer/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts +17 -3
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.mjs +1 -0
- package/dist/core/oauth2/authorization/code/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/types.d.ts +1 -0
- package/dist/core/oauth2/authorization/code/verifier/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.mjs +20 -5
- package/dist/core/oauth2/authorization/code-request/validator.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +14 -11
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts +7 -0
- package/dist/core/oauth2/authorization/code-request/verifier/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.d.ts +11 -1
- package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.mjs +46 -3
- 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 +15 -7
- package/dist/core/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/module.mjs +100 -37
- package/dist/core/oauth2/authorization/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/types.d.ts +51 -7
- 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/client/grant-type.d.ts +9 -0
- package/dist/core/oauth2/client/grant-type.d.ts.map +1 -0
- package/dist/core/oauth2/client/grant-type.mjs +18 -0
- package/dist/core/oauth2/client/grant-type.mjs.map +1 -0
- package/dist/core/oauth2/client/index.d.ts +1 -0
- package/dist/core/oauth2/client/index.d.ts.map +1 -1
- package/dist/core/oauth2/client/index.mjs +2 -1
- package/dist/core/oauth2/end-session/index.d.ts +4 -0
- package/dist/core/oauth2/end-session/index.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/index.mjs +6 -0
- package/dist/core/oauth2/end-session/service.d.ts +31 -0
- package/dist/core/oauth2/end-session/service.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/service.mjs +130 -0
- package/dist/core/oauth2/end-session/service.mjs.map +1 -0
- package/dist/core/oauth2/end-session/types.d.ts +56 -0
- package/dist/core/oauth2/end-session/types.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/types.mjs +4 -0
- package/dist/core/oauth2/end-session/validator.d.ts +6 -0
- package/dist/core/oauth2/end-session/validator.d.ts.map +1 -0
- package/dist/core/oauth2/end-session/validator.mjs +23 -0
- package/dist/core/oauth2/end-session/validator.mjs.map +1 -0
- package/dist/core/oauth2/grant-types/authorize.d.ts +19 -2
- package/dist/core/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.mjs +58 -11
- 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 +25 -2
- package/dist/core/oauth2/grant-types/refresh-token.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs +71 -9
- 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 +30 -3
- package/dist/core/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/core/oauth2/index.d.ts +4 -1
- package/dist/core/oauth2/index.d.ts.map +1 -1
- package/dist/core/oauth2/index.mjs +13 -4
- 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/session-token/index.d.ts.map +1 -0
- package/dist/core/oauth2/session-token/index.mjs +4 -0
- package/dist/core/oauth2/session-token/types.d.ts +70 -0
- package/dist/core/oauth2/session-token/types.d.ts.map +1 -0
- package/dist/core/oauth2/session-token/types.mjs +4 -0
- package/dist/core/oauth2/token/index.mjs +2 -1
- package/dist/core/oauth2/token/issuer/access/module.d.ts +3 -1
- package/dist/core/oauth2/token/issuer/access/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/access/module.mjs +12 -1
- package/dist/core/oauth2/token/issuer/access/module.mjs.map +1 -1
- package/dist/core/oauth2/token/issuer/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/issuer/open-id/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/open-id/module.mjs +1 -1
- package/dist/core/oauth2/token/issuer/open-id/module.mjs.map +1 -1
- package/dist/core/oauth2/token/issuer/refresh/module.d.ts +3 -1
- package/dist/core/oauth2/token/issuer/refresh/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/refresh/module.mjs +12 -1
- package/dist/core/oauth2/token/issuer/refresh/module.mjs.map +1 -1
- package/dist/core/oauth2/token/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 +3 -1
- package/dist/core/oauth2/token/revoker/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.mjs +5 -1
- 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 +12 -9
- package/dist/core/oauth2/token/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/token/verifier/types.d.ts +6 -0
- package/dist/core/oauth2/token/verifier/types.d.ts.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.mjs +3 -2
- package/dist/core/provisioning/entities/client/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/index.d.ts +1 -0
- package/dist/core/provisioning/entities/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/index.mjs +5 -1
- package/dist/core/provisioning/entities/permission/index.d.ts +1 -0
- package/dist/core/provisioning/entities/permission/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/permission/index.mjs +2 -1
- package/dist/core/provisioning/entities/permission/relations-validator.d.ts +6 -0
- package/dist/core/provisioning/entities/permission/relations-validator.d.ts.map +1 -0
- package/dist/core/provisioning/entities/permission/relations-validator.mjs +17 -0
- package/dist/core/provisioning/entities/permission/relations-validator.mjs.map +1 -0
- package/dist/core/provisioning/entities/permission/validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/permission/validator.mjs +3 -0
- package/dist/core/provisioning/entities/permission/validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/policy/index.d.ts +1 -0
- package/dist/core/provisioning/entities/policy/index.d.ts.map +1 -1
- package/dist/core/provisioning/entities/policy/index.mjs +2 -1
- package/dist/core/provisioning/entities/policy/validator.d.ts +6 -0
- package/dist/core/provisioning/entities/policy/validator.d.ts.map +1 -0
- package/dist/core/provisioning/entities/policy/validator.mjs +26 -0
- package/dist/core/provisioning/entities/policy/validator.mjs.map +1 -0
- package/dist/core/provisioning/entities/realm/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/realm/relations-validator.mjs +9 -52
- package/dist/core/provisioning/entities/realm/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/role/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/role/relations-validator.mjs +4 -0
- package/dist/core/provisioning/entities/role/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/root/validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/root/validator.mjs +11 -26
- package/dist/core/provisioning/entities/root/validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/utils.d.ts +10 -0
- package/dist/core/provisioning/entities/utils.d.ts.map +1 -0
- package/dist/core/provisioning/entities/utils.mjs +29 -0
- package/dist/core/provisioning/entities/utils.mjs.map +1 -0
- package/dist/core/provisioning/index.mjs +4 -1
- package/dist/core/provisioning/synchronizer/base.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/base.mjs.map +1 -1
- package/dist/index.mjs +66 -39
- package/dist/swagger.json +6721 -3734
- package/dist/ui/client/.vite/ssr-manifest.json +5283 -1233
- package/dist/ui/client/assets/index-BmWsoQro.css +2 -0
- package/dist/ui/client/assets/{index-Cd3uWit-.js → index-CT0Nq5pA.js} +18 -17
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/assets/{multipart-parser-Dn2Ly9xU.js → multipart-parser-BCMy8Xwv.js} +11 -1
- package/dist/ui/server/assets/{multipart-parser-DyM9gi59.js → multipart-parser-BVY8pIV2.js} +11 -1
- package/dist/ui/server/server.js +21817 -19132
- package/package.json +24 -18
- 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.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-DoCTwJ8M.css +0 -2
- /package/dist/{core/oauth2/key → adapters/http/controllers/workflows/logout}/types.mjs +0 -0
- /package/dist/{core/oauth2/key/index.mjs → 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 → session-token}/index.d.ts +0 -0
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import type { Session } from '@authup/core-kit';
|
|
2
|
+
import type { EntityRepositoryFindManyResult } from '@authup/server-kit';
|
|
3
|
+
export type SessionOwner = {
|
|
4
|
+
sub: string;
|
|
5
|
+
subKind: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Filter keys a session query (list + bulk revoke) may target. Shared by the
|
|
9
|
+
* repository's rapiq `filters.allowed` and the service's "is this a targeted
|
|
10
|
+
* bulk revoke?" discriminator, so the two can never drift.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SESSION_FILTER_KEYS: readonly ["id", "sub", "sub_kind", "user_id", "client_id", "robot_id", "realm_id"];
|
|
13
|
+
export type SessionFindManyOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Force the result to a single subject (self-service). Applied as a
|
|
16
|
+
* mandatory WHERE that a rapiq query filter cannot override.
|
|
17
|
+
*/
|
|
18
|
+
owner?: SessionOwner;
|
|
19
|
+
};
|
|
2
20
|
export interface ISessionRepository {
|
|
3
21
|
findOneById(id: string): Promise<Session | null> | null;
|
|
22
|
+
findMany(query: Record<string, any>, options?: SessionFindManyOptions): Promise<EntityRepositoryFindManyResult<Session>>;
|
|
23
|
+
findAllByOwner(owner: SessionOwner): Promise<Session[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Load EVERY session matching a rapiq query filter — **unbounded** (no
|
|
26
|
+
* pagination cap), because a bulk revoke must reach every match. Used by
|
|
27
|
+
* the admin "force-logout" path; per-session authorization is enforced by
|
|
28
|
+
* the caller (`SessionService`).
|
|
29
|
+
*/
|
|
30
|
+
findAllByQuery(query: Record<string, any>): Promise<Session[]>;
|
|
4
31
|
save(session: Partial<Session>): Promise<Session>;
|
|
5
32
|
removeById(id: string): Promise<void>;
|
|
6
33
|
remove(session: Session): Promise<void>;
|
|
@@ -34,6 +61,12 @@ export interface ISessionManager {
|
|
|
34
61
|
* @param session
|
|
35
62
|
*/
|
|
36
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>;
|
|
37
70
|
/**
|
|
38
71
|
* Check if session exists and is valid.
|
|
39
72
|
*
|
|
@@ -47,5 +80,12 @@ export interface ISessionManager {
|
|
|
47
80
|
* @param id
|
|
48
81
|
*/
|
|
49
82
|
findOneById(id: string): Promise<Session | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Revoke (delete) a session by id, forcing re-authentication. Idempotent —
|
|
85
|
+
* a no-op when the session does not exist.
|
|
86
|
+
*
|
|
87
|
+
* @param id
|
|
88
|
+
*/
|
|
89
|
+
revoke(id: string): Promise<void>;
|
|
50
90
|
}
|
|
51
91
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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;
|
|
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,CA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,CAAC;IAEjD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
|
|
4
|
+
//#region src/core/authentication/session/types.ts
|
|
5
|
+
/**
|
|
6
|
+
* Filter keys a session query (list + bulk revoke) may target. Shared by the
|
|
7
|
+
* repository's rapiq `filters.allowed` and the service's "is this a targeted
|
|
8
|
+
* bulk revoke?" discriminator, so the two can never drift.
|
|
9
|
+
*/ const SESSION_FILTER_KEYS = [
|
|
10
|
+
"id",
|
|
11
|
+
"sub",
|
|
12
|
+
"sub_kind",
|
|
13
|
+
"user_id",
|
|
14
|
+
"client_id",
|
|
15
|
+
"robot_id",
|
|
16
|
+
"realm_id"
|
|
17
|
+
];
|
|
18
|
+
//#endregion
|
|
19
|
+
export { SESSION_FILTER_KEYS };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +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 * 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["AuthorityKeyIdentifierExtension","BasicConstraintsExtension","ExtendedKeyUsage","ExtendedKeyUsageExtension","URL","GENERAL_NAME_URL","KeyUsageFlags","KeyUsagesExtension","SubjectAlternativeNameExtension","SubjectKeyIdentifierExtension","X509Certificate","CLIENT_CERTIFICATE_URI_PREFIX","buildClientCertificateURI","ValidationError","base64URLEncode","MAX_CHAIN_DEPTH","CERTIFICATE_BLOCK_PATTERN","MAX_PATH_SIGNATURE_VERIFICATIONS","HANDLED_CRITICAL_EXTENSION_OIDS","Set","WEAK_SIGNATURE_HASHES","ANY_EXTENDED_KEY_USAGE_OID","ClientCertificateValidator","trustAnchorRepository","crypto","ctx","validateForBinding","evidence","assertClientCertificateEvidenceValidForBinding","validateForAuthentication","client","assertClientCertificatePurpose","certificate","assertClientCertificateIdentity","id","assertCertificateExtensionsUnderstood","assertStrongSignature","anchors","findManyBy","realm_id","enabled","anchor","anchorCertificate","parseAnchorCertificate","budget","remaining","path","buildPath","chain","assertCertificationPath","assertCertificateCurrent","constraints","getExtension","ca","parseClientCertificateChain","pem","blocks","match","length","map","block","buildClientCertificateThumbprint","digest","getThumbprint","String","fromCharCode","Uint8Array","undefined","leaf","intermediates","continuePath","current","available","sameCertificate","isIssuedBy","index","candidate","next","filter","_item","candidateIndex","issuer","subject","authorityKeyIdentifier","keyId","subjectKeyIdentifier","verify","publicKey","signatureOnly","left","right","leftRaw","rawData","rightRaw","every","value","isAnchor","assertIssuerExtendedKeyUsage","keyUsage","usages","keyCertSign","pathLength","extendedKeyUsage","includes","clientAuth","digitalSignature","clientId","subjectAlternativeName","authupUris","names","items","name","type","startsWith","expected","now","Date","notBefore","getTime","notAfter","extension","extensions","critical","has","hash","signatureAlgorithm","toUpperCase"],"sources":["../../../src/core/client-certificate/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n AuthorityKeyIdentifierExtension,\n BasicConstraintsExtension,\n ExtendedKeyUsage,\n ExtendedKeyUsageExtension,\n URL as GENERAL_NAME_URL,\n KeyUsageFlags,\n KeyUsagesExtension,\n SubjectAlternativeNameExtension,\n SubjectKeyIdentifierExtension,\n X509Certificate,\n} from '@peculiar/x509';\nimport type { Client, TrustAnchor } from '@authup/core-kit';\nimport {\n CLIENT_CERTIFICATE_URI_PREFIX,\n buildClientCertificateURI,\n} from '@authup/core-kit';\nimport { ValidationError } from '@authup/errors';\nimport { base64URLEncode } from '@authup/kit';\nimport type {\n ClientCertificateEvidence,\n ClientCertificateValidatorContext,\n IClientCertificateValidator,\n} from './types.ts';\n\nconst MAX_CHAIN_DEPTH = 10;\nconst CERTIFICATE_BLOCK_PATTERN = /-----BEGIN CERTIFICATE-----[\\s\\S]*?-----END CERTIFICATE-----/g;\n\n/**\n * Hard ceiling on signature verifications performed while building a single\n * certification path. A legitimate chain of the maximum accepted length only\n * needs O(depth²) verifications; the ceiling exists purely to defuse the\n * factorial backtracking blow-up an attacker can induce with certificates\n * that mutually \"issue\" one another (shared key, identical subject/issuer\n * DNs). Reaching the ceiling is treated as \"no path found\" (fail closed).\n */\nconst MAX_PATH_SIGNATURE_VERIFICATIONS = 64;\n\n/**\n * OIDs of the certificate extensions this validator actually processes. A\n * certificate carrying a *critical* extension outside this set is rejected\n * (RFC 5280 §4.2): an unprocessed critical constraint must never be silently\n * ignored. Because RFC 5280 requires the NameConstraints extension to be\n * marked critical, this also fails a name-constrained CA closed rather than\n * trusting a chain whose name constraints we do not evaluate.\n */\nconst HANDLED_CRITICAL_EXTENSION_OIDS = new Set<string>([\n '2.5.29.19', // basicConstraints\n '2.5.29.15', // keyUsage\n '2.5.29.37', // extKeyUsage\n '2.5.29.17', // subjectAltName\n '2.5.29.35', // authorityKeyIdentifier\n '2.5.29.14', // subjectKeyIdentifier\n]);\n\nconst WEAK_SIGNATURE_HASHES = new Set<string>(['SHA-1', 'MD5', 'MD2', 'MD4']);\n\n// anyExtendedKeyUsage (RFC 5280 §4.2.1.12) — a CA carrying it is unconstrained.\nconst ANY_EXTENDED_KEY_USAGE_OID = '2.5.29.37.0';\n\ntype SignatureVerificationBudget = { remaining: number };\n\n/**\n * Validates client certificates without performing network I/O. AIA, CRL,\n * and OCSP retrieval are deliberately outside the external-PKI first slice.\n */\nexport class ClientCertificateValidator implements IClientCertificateValidator {\n protected trustAnchorRepository: ClientCertificateValidatorContext['trustAnchorRepository'];\n\n protected crypto?: Crypto;\n\n constructor(ctx: ClientCertificateValidatorContext) {\n this.trustAnchorRepository = ctx.trustAnchorRepository;\n this.crypto = ctx.crypto;\n }\n\n validateForBinding(evidence: ClientCertificateEvidence): void {\n assertClientCertificateEvidenceValidForBinding(evidence);\n }\n\n async validateForAuthentication(\n client: Pick<Client, 'id' | 'realm_id'>,\n evidence: ClientCertificateEvidence,\n ): Promise<void> {\n this.validateForBinding(evidence);\n assertClientCertificatePurpose(evidence.certificate);\n assertClientCertificateIdentity(evidence.certificate, client.id);\n assertCertificateExtensionsUnderstood(evidence.certificate);\n assertStrongSignature(evidence.certificate);\n\n const anchors = await this.trustAnchorRepository.findManyBy({\n realm_id: client.realm_id,\n enabled: true,\n });\n\n for (const anchor of anchors) {\n const anchorCertificate = parseAnchorCertificate(anchor);\n if (!anchorCertificate) {\n continue;\n }\n\n const budget: SignatureVerificationBudget = { remaining: MAX_PATH_SIGNATURE_VERIFICATIONS };\n const path = await buildPath(\n evidence.certificate,\n evidence.chain,\n anchorCertificate,\n budget,\n this.crypto,\n );\n if (!path) {\n continue;\n }\n\n try {\n assertCertificationPath(path);\n return;\n } catch {\n // A chain reaching this anchor failed its CA constraints;\n // another enabled anchor may still yield a valid path.\n continue;\n }\n }\n\n throw new ValidationError('The client certificate is not trusted in this realm.');\n }\n}\n\nexport function assertClientCertificateEvidenceValidForBinding(\n evidence: ClientCertificateEvidence,\n): void {\n assertCertificateCurrent(evidence.certificate);\n\n const constraints = evidence.certificate.getExtension(BasicConstraintsExtension);\n if (constraints?.ca) {\n throw new ValidationError('A CA certificate cannot be used as a client certificate.');\n }\n}\n\nexport function parseClientCertificateChain(pem: string): X509Certificate[] {\n const blocks = pem.match(CERTIFICATE_BLOCK_PATTERN);\n if (!blocks || blocks.length === 0) {\n throw new ValidationError('The certificate chain could not be parsed.');\n }\n\n try {\n return blocks.map((block) => new X509Certificate(block));\n } catch {\n throw new ValidationError('The certificate chain could not be parsed.');\n }\n}\n\nexport async function buildClientCertificateThumbprint(\n certificate: X509Certificate,\n crypto?: Crypto,\n): Promise<string> {\n const digest = await certificate.getThumbprint('SHA-256', crypto);\n\n return base64URLEncode(\n String.fromCharCode(...new Uint8Array(digest)),\n );\n}\n\nfunction parseAnchorCertificate(anchor: TrustAnchor): X509Certificate | undefined {\n try {\n return parseClientCertificateChain(anchor.certificate)[0];\n } catch {\n // Rows are validated on create. Treat a corrupt legacy/database row as\n // unusable trust material instead of turning client authentication into\n // a 500 or accidentally trusting another certificate in its PEM chain.\n return undefined;\n }\n}\n\nasync function buildPath(\n leaf: X509Certificate,\n intermediates: X509Certificate[],\n anchor: X509Certificate,\n budget: SignatureVerificationBudget,\n crypto?: Crypto,\n): Promise<X509Certificate[] | undefined> {\n return continuePath(leaf, intermediates, anchor, [leaf], budget, crypto);\n}\n\nasync function continuePath(\n current: X509Certificate,\n available: X509Certificate[],\n anchor: X509Certificate,\n path: X509Certificate[],\n budget: SignatureVerificationBudget,\n crypto?: Crypto,\n): Promise<X509Certificate[] | undefined> {\n if (path.length > MAX_CHAIN_DEPTH) {\n return undefined;\n }\n\n if (sameCertificate(current, anchor)) {\n return path;\n }\n\n if (await isIssuedBy(current, anchor, budget, crypto)) {\n return [...path, anchor];\n }\n\n for (let index = 0; index < available.length; index += 1) {\n const candidate = available[index];\n if (\n !candidate ||\n sameCertificate(current, candidate) ||\n !await isIssuedBy(current, candidate, budget, crypto)\n ) {\n continue;\n }\n\n const next = await continuePath(\n candidate,\n available.filter((_item, candidateIndex) => candidateIndex !== index),\n anchor,\n [...path, candidate],\n budget,\n crypto,\n );\n if (next) {\n return next;\n }\n }\n\n return undefined;\n}\n\nasync function isIssuedBy(\n certificate: X509Certificate,\n issuer: X509Certificate,\n budget: SignatureVerificationBudget,\n crypto?: Crypto,\n): Promise<boolean> {\n if (certificate.issuer !== issuer.subject) {\n return false;\n }\n\n const authorityKeyIdentifier = certificate.getExtension(AuthorityKeyIdentifierExtension);\n if (authorityKeyIdentifier?.keyId) {\n const subjectKeyIdentifier = issuer.getExtension(SubjectKeyIdentifierExtension);\n if (subjectKeyIdentifier && subjectKeyIdentifier.keyId !== authorityKeyIdentifier.keyId) {\n return false;\n }\n }\n\n // Spend from the shared verification budget only for the expensive\n // cryptographic check (the DN / key-id pre-filters above are cheap). Once\n // exhausted, treat every further edge as unverified so a maliciously\n // crafted mutually-issuing certificate set cannot force factorial work.\n if (budget.remaining <= 0) {\n return false;\n }\n budget.remaining -= 1;\n\n try {\n return await certificate.verify({\n publicKey: issuer,\n signatureOnly: true,\n }, crypto);\n } catch {\n return false;\n }\n}\n\nfunction sameCertificate(left: X509Certificate, right: X509Certificate): boolean {\n const leftRaw = new Uint8Array(left.rawData);\n const rightRaw = new Uint8Array(right.rawData);\n\n return leftRaw.length === rightRaw.length &&\n leftRaw.every((value, index) => value === rightRaw[index]);\n}\n\nfunction assertCertificationPath(path: X509Certificate[]): void {\n if (path.length < 2) {\n throw new ValidationError('The client certificate chain is invalid.');\n }\n\n for (let index = 1; index < path.length; index += 1) {\n const certificate = path[index];\n if (!certificate) {\n throw new ValidationError('The client certificate chain is invalid.');\n }\n\n // The last path element is the configured trust anchor, trusted a\n // priori — its self-signature algorithm and any critical extensions\n // it carries are the operator's responsibility, so the RFC 5280\n // conformance checks below apply only to the issued intermediates.\n const isAnchor = index === path.length - 1;\n if (!isAnchor) {\n assertCertificateExtensionsUnderstood(certificate);\n assertStrongSignature(certificate);\n assertIssuerExtendedKeyUsage(certificate);\n }\n\n assertCertificateCurrent(certificate);\n const constraints = certificate.getExtension(BasicConstraintsExtension);\n if (!constraints?.ca) {\n throw new ValidationError('The client certificate chain contains a non-CA issuer.');\n }\n\n const keyUsage = certificate.getExtension(KeyUsagesExtension);\n if (keyUsage && (keyUsage.usages & KeyUsageFlags.keyCertSign) === 0) {\n throw new ValidationError('A client certificate issuer cannot sign certificates.');\n }\n\n // `index - 1` is the number of non-leaf CA certificates below this\n // issuer in the selected path. A pathLenConstraint of zero therefore\n // permits a directly-issued client leaf and no subordinate CA.\n if (\n typeof constraints.pathLength === 'number' &&\n (index - 1) > constraints.pathLength\n ) {\n throw new ValidationError('The client certificate chain exceeds a CA path-length constraint.');\n }\n }\n}\n\nfunction assertClientCertificatePurpose(certificate: X509Certificate): void {\n const extendedKeyUsage = certificate.getExtension(ExtendedKeyUsageExtension);\n if (\n extendedKeyUsage &&\n !extendedKeyUsage.usages.includes(ExtendedKeyUsage.clientAuth)\n ) {\n throw new ValidationError('The certificate is not valid for TLS client authentication.');\n }\n\n const keyUsage = certificate.getExtension(KeyUsagesExtension);\n if (keyUsage && (keyUsage.usages & KeyUsageFlags.digitalSignature) === 0) {\n throw new ValidationError('The certificate cannot prove possession of its private key.');\n }\n}\n\n/**\n * EKU chaining (RFC 5280 §4.2.1.12): a CA whose Extended Key Usage is present\n * but omits both `clientAuth` and `anyExtendedKeyUsage` is not permitted to\n * issue TLS-client-authentication certificates, so a leaf beneath it must be\n * rejected. (A CA's EKU may be non-critical, so the critical-extension check\n * does not cover this.) A CA with no EKU extension is unconstrained.\n */\nfunction assertIssuerExtendedKeyUsage(certificate: X509Certificate): void {\n const extendedKeyUsage = certificate.getExtension(ExtendedKeyUsageExtension);\n if (\n extendedKeyUsage &&\n !extendedKeyUsage.usages.includes(ExtendedKeyUsage.clientAuth) &&\n !extendedKeyUsage.usages.includes(ANY_EXTENDED_KEY_USAGE_OID)\n ) {\n throw new ValidationError('A client certificate issuer is not permitted to issue TLS client-authentication certificates.');\n }\n}\n\nfunction assertClientCertificateIdentity(certificate: X509Certificate, clientId: string): void {\n const subjectAlternativeName = certificate.getExtension(SubjectAlternativeNameExtension);\n const authupUris = subjectAlternativeName ?\n subjectAlternativeName.names.items\n .filter((name) => name.type === GENERAL_NAME_URL)\n .map((name) => name.value)\n .filter((value) => value.startsWith(CLIENT_CERTIFICATE_URI_PREFIX)) :\n [];\n\n const expected = buildClientCertificateURI(clientId);\n if (authupUris.length !== 1 || authupUris[0] !== expected) {\n throw new ValidationError(`The certificate must contain exactly one Authup client URI SAN: ${expected}.`);\n }\n}\n\nfunction assertCertificateCurrent(certificate: X509Certificate): void {\n const now = Date.now();\n if (\n certificate.notBefore.getTime() > now ||\n certificate.notAfter.getTime() < now\n ) {\n throw new ValidationError('The client certificate is not currently valid.');\n }\n}\n\nfunction assertCertificateExtensionsUnderstood(certificate: X509Certificate): void {\n for (const extension of certificate.extensions) {\n if (extension.critical && !HANDLED_CRITICAL_EXTENSION_OIDS.has(extension.type)) {\n throw new ValidationError(\n `The certificate carries an unsupported critical extension (${extension.type}).`,\n );\n }\n }\n}\n\nfunction assertStrongSignature(certificate: X509Certificate): void {\n const hash = certificate.signatureAlgorithm?.hash?.name;\n if (typeof hash === 'string' && WEAK_SIGNATURE_HASHES.has(hash.toUpperCase())) {\n throw new ValidationError(`The certificate is signed with a weak algorithm (${hash}).`);\n }\n}\n"],"mappings":";;;;;;;;AAgCA,MAAMe,kBAAkB;AACxB,MAAMC,4BAA4B;;;;;;;;GAUlC,MAAMC,mCAAmC;;;;;;;;GAUzC,MAAMC,kDAAkC,IAAIC,IAAY;CACpD;CACA;CACA;CACA;CACA;CACA;CACH;AAED,MAAMC,wCAAwB,IAAID,IAAY;CAAC;CAAS;CAAO;CAAO;CAAM;AAG5E,MAAME,6BAA6B;;;;GAQnC,IAAaC,6BAAb,MAAaA;CACCC;CAEAC;CAEV,YAAYC,KAAwC;EAChD,KAAKF,wBAAwBE,IAAIF;EACjC,KAAKC,SAASC,IAAID;CACtB;CAEAE,mBAAmBC,UAA2C;EAC1DC,+CAA+CD,QAAAA;CACnD;CAEA,MAAME,0BACFC,QACAH,UACa;EACb,KAAKD,mBAAmBC,QAAAA;EACxBI,+BAA+BJ,SAASK,WAAW;EACnDC,gCAAgCN,SAASK,aAAaF,OAAOI,EAAE;EAC/DC,sCAAsCR,SAASK,WAAW;EAC1DI,sBAAsBT,SAASK,WAAW;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IhG;AAEA,SAAS5E,sBAAsBJ,aAA4B;CACvD,MAAM4F,OAAO5F,YAAY6F,oBAAoBD,MAAMb;CACnD,IAAI,OAAOa,SAAS,YAAYxG,sBAAsBuG,IAAIC,KAAKE,YAAW,CAAA,GACtE,MAAM,IAAIjH,gBAAgB,oDAAoD+G,KAAK,GAAG;AAE9F"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { X509Certificate } from '@peculiar/x509';
|
|
2
|
+
import type { Client } from '@authup/core-kit';
|
|
3
|
+
import type { ITrustAnchorRepository } from '../entities/index.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Runtime-neutral evidence derived from the certificate used in the external
|
|
6
|
+
* client-facing TLS handshake. `chain` excludes the leaf and is ordered as it
|
|
7
|
+
* appeared on the wire when the forwarding format preserves that order.
|
|
8
|
+
*/
|
|
9
|
+
export type ClientCertificateEvidence = {
|
|
10
|
+
certificate: X509Certificate;
|
|
11
|
+
chain: X509Certificate[];
|
|
12
|
+
thumbprint: string;
|
|
13
|
+
};
|
|
14
|
+
export type ClientCertificateValidatorContext = {
|
|
15
|
+
trustAnchorRepository: Pick<ITrustAnchorRepository, 'findManyBy'>;
|
|
16
|
+
crypto?: Crypto;
|
|
17
|
+
};
|
|
18
|
+
export interface IClientCertificateValidator {
|
|
19
|
+
validateForBinding(evidence: ClientCertificateEvidence): void;
|
|
20
|
+
validateForAuthentication(client: Pick<Client, 'id' | 'realm_id'>, evidence: ClientCertificateEvidence): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/client-certificate/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,WAAW,EAAE,eAAe,CAAC;IAC7B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC5C,qBAAqB,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IACxC,kBAAkB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC9D,yBAAyB,CACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,UAAU,CAAC,EACvC,QAAQ,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/service.ts"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/service.ts"],"names":[],"mappings":"AAUA,OAAO,EAGH,eAAe,EAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B,EAAG,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG;IAC/B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,eAAe,EAAE,gBAAgB,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|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { ClientCredentialsService } from "../../authentication/credential/entities/client/module.mjs";
|
|
5
5
|
import { ValidatorGroup, isUUID } from "@authup/kit";
|
|
6
|
-
import { CLIENT_RESERVED_NAMES, ClientValidator, PermissionName } from "@authup/core-kit";
|
|
6
|
+
import { CLIENT_RESERVED_NAMES, ClientAuthMethod, ClientValidator, PermissionName } from "@authup/core-kit";
|
|
7
7
|
import { AbstractEntityService } from "@authup/server-kit";
|
|
8
8
|
import { BuiltInPolicyType, definePolicyData } from "@authup/access";
|
|
9
|
-
import {
|
|
9
|
+
import { EntityNotFoundError, ValidationError } from "@authup/errors";
|
|
10
10
|
//#region src/core/entities/client/service.ts
|
|
11
11
|
var ClientService = class extends AbstractEntityService {
|
|
12
12
|
repository;
|
|
@@ -115,7 +115,7 @@ var ClientService = class extends AbstractEntityService {
|
|
|
115
115
|
group = ValidatorGroup.CREATE;
|
|
116
116
|
}
|
|
117
117
|
const validated = await this.validator.run(data, { group });
|
|
118
|
-
if (typeof validated.name === "string" && CLIENT_RESERVED_NAMES.includes(validated.name) && !(entity && entity.built_in && entity.name === validated.name)) throw new
|
|
118
|
+
if (typeof validated.name === "string" && CLIENT_RESERVED_NAMES.includes(validated.name) && !(entity && entity.built_in && entity.name === validated.name)) throw new ValidationError(`The client name '${validated.name}' is reserved.`);
|
|
119
119
|
await this.repository.validateJoinColumns(validated);
|
|
120
120
|
await this.repository.checkUniqueness(validated, entity || void 0);
|
|
121
121
|
const credentialsService = new ClientCredentialsService();
|
|
@@ -139,10 +139,14 @@ var ClientService = class extends AbstractEntityService {
|
|
|
139
139
|
...this.resourceRealmMatch(entity)
|
|
140
140
|
})
|
|
141
141
|
});
|
|
142
|
-
if (entity.
|
|
142
|
+
if (entity.auth_method === ClientAuthMethod.SECRET) {
|
|
143
143
|
if (!validated.secret && !entity.secret) validated.secret = credentialsService.generateSecret();
|
|
144
144
|
if (validated.secret) entity.secret = await credentialsService.protect(validated.secret, entity);
|
|
145
|
-
} else
|
|
145
|
+
} else {
|
|
146
|
+
entity.secret = null;
|
|
147
|
+
entity.secret_hashed = false;
|
|
148
|
+
entity.secret_encrypted = false;
|
|
149
|
+
}
|
|
146
150
|
await this.repository.save(entity);
|
|
147
151
|
return {
|
|
148
152
|
entity,
|
|
@@ -161,10 +165,14 @@ var ClientService = class extends AbstractEntityService {
|
|
|
161
165
|
})
|
|
162
166
|
});
|
|
163
167
|
entity = this.repository.create(validated);
|
|
164
|
-
if (entity.
|
|
168
|
+
if (entity.auth_method === ClientAuthMethod.SECRET) {
|
|
165
169
|
if (!validated.secret) validated.secret = credentialsService.generateSecret();
|
|
166
170
|
entity.secret = await credentialsService.protect(validated.secret, validated);
|
|
167
|
-
} else
|
|
171
|
+
} else {
|
|
172
|
+
entity.secret = null;
|
|
173
|
+
entity.secret_hashed = false;
|
|
174
|
+
entity.secret_encrypted = false;
|
|
175
|
+
}
|
|
168
176
|
await this.repository.save(entity);
|
|
169
177
|
return {
|
|
170
178
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","definePolicyData","ValidatorGroup","isUUID","BadRequestError","EntityNotFoundError","CLIENT_RESERVED_NAMES","ClientValidator","PermissionName","AbstractEntityService","ClientCredentialsService","ClientService","repository","realmRepository","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","CLIENT_READ","CLIENT_UPDATE","CLIENT_DELETE","data","entities","meta","findMany","total","entity","secret","secret_encrypted","secret_hashed","evaluateOneOf","ATTRIBUTES","resourceRealmMatch","push","getOne","idOrName","realmId","permissionNames","isMe","identity","type","id","findOne","create","save","undefined","update","updateOnly","options","group","realm","realm_id","resolve","where","findOneWithSecret","isSelfEdit","preEvaluate","e","CLIENT_SELF_MANAGE","UPDATE","CLIENT_CREATE","CREATE","validated","run","includes","built_in","validateJoinColumns","checkUniqueness","credentialsService","actorRealmId","getActorRealmId","evaluate","merge","is_confidential","generateSecret","protect","created","delete","findOneBy","entityId","remove"],"sources":["../../../../src/core/entities/client/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, definePolicyData } from '@authup/access';\nimport { ValidatorGroup, isUUID } from '@authup/kit';\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport {\n CLIENT_RESERVED_NAMES,\n ClientValidator,\n PermissionName,\n} from '@authup/core-kit';\nimport type { Client } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IRealmRepository } from '../realm/types.ts';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport { ClientCredentialsService } from '../../authentication/credential/entities/client/module.ts';\nimport type { IClientRepository, IClientService } from './types.ts';\n\nexport type ClientServiceContext = {\n repository: IClientRepository;\n realmRepository: IRealmRepository;\n};\n\nexport class ClientService extends AbstractEntityService implements IClientService {\n protected repository: IClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected validator: ClientValidator;\n\n constructor(ctx: ClientServiceContext) {\n super();\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.validator = new ClientValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<Client>> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ],\n });\n\n const {\n data: entities, \n meta, \n } = await this.repository.findMany(query);\n let { total } = meta;\n\n const data: Client[] = [];\n for (const entity of entities) {\n if (\n entity.secret &&\n !entity.secret_encrypted &&\n !entity.secret_hashed\n ) {\n try {\n await actor.permissionEvaluator.evaluateOneOf({\n name: [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ],\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n data.push(entity);\n } catch {\n total -= 1;\n }\n\n continue;\n }\n\n data.push(entity);\n }\n\n return {\n data,\n meta: {\n ...meta,\n total, \n }, \n };\n }\n\n async getOne(\n idOrName: string,\n actor: ActorContext,\n query?: Record<string, any>,\n realmId?: string,\n ): Promise<Client> {\n const permissionNames = [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ];\n\n let isMe = !!actor.identity &&\n actor.identity.type === 'client' &&\n (\n actor.identity.data.id === idOrName ||\n actor.identity.data.name === idOrName\n );\n\n if (!isMe) {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: permissionNames });\n }\n\n const entity = await this.repository.findOne(idOrName, query, realmId);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (isMe && actor.identity!.data.id !== entity.id) {\n isMe = false;\n await actor.permissionEvaluator.preEvaluateOneOf({ name: permissionNames });\n }\n\n if (\n !isMe &&\n entity.secret &&\n !entity.secret_encrypted &&\n !entity.secret_hashed\n ) {\n await actor.permissionEvaluator.evaluateOneOf({\n name: permissionNames,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Client,\n created: boolean \n }> {\n let group: string;\n\n const realm = typeof data.realm_id === 'string' ?\n await this.realmRepository.resolve(data.realm_id) :\n undefined;\n\n let entity: Client | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n if (realm) {\n where.realm_id = realm.id;\n }\n\n entity = await this.repository.findOneWithSecret(where);\n if (!entity && options.updateOnly) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n let isSelfEdit = false;\n if (entity) {\n try {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_UPDATE });\n } catch (e) {\n if (\n !actor.identity ||\n actor.identity.type !== 'client' ||\n actor.identity.data.id !== entity.id\n ) {\n throw e;\n }\n isSelfEdit = true;\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_SELF_MANAGE });\n }\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n // Reserve the system-provisioned client names (`system`, `web`) so an\n // API caller can't create or rename a client onto them — that would\n // collide on unique(name, realm_id) or shadow the built_in client.\n // Provisioning and runtime hooks bypass this service, so they remain\n // free to manage the reserved clients. built_in clients are exempt\n // (they ARE the provisioned ones) but API callers can never produce a\n // built_in client since the validator strips the flag.\n if (\n typeof validated.name === 'string' &&\n CLIENT_RESERVED_NAMES.includes(validated.name) &&\n !(entity && entity.built_in && entity.name === validated.name)\n ) {\n throw new BadRequestError(`The client name '${validated.name}' is reserved.`);\n }\n\n await this.repository.validateJoinColumns(validated);\n await this.repository.checkUniqueness(validated, entity || undefined);\n\n const credentialsService = new ClientCredentialsService();\n\n if (entity) {\n if (\n !isSelfEdit &&\n !validated.realm_id &&\n !entity.realm_id\n ) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realm_id = actorRealmId;\n }\n }\n\n if (isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_SELF_MANAGE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n }\n\n entity = this.repository.merge(entity, validated);\n\n if (!isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_UPDATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n if (entity.is_confidential) {\n if (!validated.secret && !entity.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n if (validated.secret) {\n entity.secret = await credentialsService.protect(validated.secret, entity);\n }\n } else {\n entity.secret = null;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n if (!validated.realm_id) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realm_id = actorRealmId;\n }\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_CREATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n\n entity = this.repository.create(validated);\n\n if (entity.is_confidential) {\n if (!validated.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n entity.secret = await credentialsService.protect(validated.secret, validated);\n } else {\n entity.secret = null;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: true, \n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Client> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_DELETE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAaW,gBAAb,cAAmCF,sBAAAA;CACrBG;CAEA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mC,SAAAA;EACvE,OACIpC,OAAOC,SAAS;EAGpB,MAAM,KAAKnB,WAAWoC,KAAKlB,MAAAA;EAE3B,OAAO;GACHA;GACAkD,SAAS;EACb;CACJ;CAEA,MAAMC,OACFpC,IACA3B,OACe;EACf,MAAMA,MAAMC,oBAAoByC,YAAY,EAAEvC,MAAMb,eAAegB,cAAc,CAAA;EAEjF,MAAMM,SAAS,MAAM,KAAKlB,WAAWsE,UAAU,EAAErC,GAAG,CAAA;EACpD,IAAI,CAACf,QACD,MAAM,IAAIzB,oBAAAA;EAGd,MAAMa,MAAMC,oBAAoBwD,SAAS;GACrCtD,MAAMb,eAAegB;GACrBC,MAAMxB,iBAAiB;KAAGD,kBAAkBmC,aAAaL;IAAQ,GAAG,KAAKM,mBAAmBN,MAAAA;GAAQ,CAAA;EACxG,CAAA;EAEA,MAAM,EAAEe,IAAIsC,aAAarD;EACzB,MAAM,KAAKlB,WAAWwE,OAAOtD,MAAAA;EAC7BA,OAAOe,KAAKsC;EAEZ,OAAOrD;CACX;AACJ"}
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","definePolicyData","ValidatorGroup","isUUID","EntityNotFoundError","ValidationError","CLIENT_RESERVED_NAMES","ClientAuthMethod","ClientValidator","PermissionName","AbstractEntityService","ClientCredentialsService","ClientService","repository","realmRepository","validator","ctx","getMany","query","actor","permissionEvaluator","preEvaluateOneOf","name","CLIENT_READ","CLIENT_UPDATE","CLIENT_DELETE","data","entities","meta","findMany","total","entity","secret","secret_encrypted","secret_hashed","evaluateOneOf","ATTRIBUTES","resourceRealmMatch","push","getOne","idOrName","realmId","permissionNames","isMe","identity","type","id","findOne","create","save","undefined","update","updateOnly","options","group","realm","realm_id","resolve","where","findOneWithSecret","isSelfEdit","preEvaluate","e","CLIENT_SELF_MANAGE","UPDATE","CLIENT_CREATE","CREATE","validated","run","includes","built_in","validateJoinColumns","checkUniqueness","credentialsService","actorRealmId","getActorRealmId","evaluate","merge","auth_method","SECRET","generateSecret","protect","created","delete","findOneBy","entityId","remove"],"sources":["../../../../src/core/entities/client/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, definePolicyData } from '@authup/access';\nimport { ValidatorGroup, isUUID } from '@authup/kit';\nimport { EntityNotFoundError, ValidationError } from '@authup/errors';\nimport {\n CLIENT_RESERVED_NAMES,\n ClientAuthMethod,\n ClientValidator,\n PermissionName,\n} from '@authup/core-kit';\nimport type { Client } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport type { IRealmRepository } from '../realm/types.ts';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport { ClientCredentialsService } from '../../authentication/credential/entities/client/module.ts';\nimport type { IClientRepository, IClientService } from './types.ts';\n\nexport type ClientServiceContext = {\n repository: IClientRepository;\n realmRepository: IRealmRepository;\n};\n\nexport class ClientService extends AbstractEntityService implements IClientService {\n protected repository: IClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected validator: ClientValidator;\n\n constructor(ctx: ClientServiceContext) {\n super();\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.validator = new ClientValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n actor: ActorContext,\n ): Promise<EntityRepositoryFindManyResult<Client>> {\n await actor.permissionEvaluator.preEvaluateOneOf({\n name: [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ],\n });\n\n const {\n data: entities, \n meta, \n } = await this.repository.findMany(query);\n let { total } = meta;\n\n const data: Client[] = [];\n for (const entity of entities) {\n if (\n entity.secret &&\n !entity.secret_encrypted &&\n !entity.secret_hashed\n ) {\n try {\n await actor.permissionEvaluator.evaluateOneOf({\n name: [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ],\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n data.push(entity);\n } catch {\n total -= 1;\n }\n\n continue;\n }\n\n data.push(entity);\n }\n\n return {\n data,\n meta: {\n ...meta,\n total, \n }, \n };\n }\n\n async getOne(\n idOrName: string,\n actor: ActorContext,\n query?: Record<string, any>,\n realmId?: string,\n ): Promise<Client> {\n const permissionNames = [\n PermissionName.CLIENT_READ,\n PermissionName.CLIENT_UPDATE,\n PermissionName.CLIENT_DELETE,\n ];\n\n let isMe = !!actor.identity &&\n actor.identity.type === 'client' &&\n (\n actor.identity.data.id === idOrName ||\n actor.identity.data.name === idOrName\n );\n\n if (!isMe) {\n await actor.permissionEvaluator.preEvaluateOneOf({ name: permissionNames });\n }\n\n const entity = await this.repository.findOne(idOrName, query, realmId);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (isMe && actor.identity!.data.id !== entity.id) {\n isMe = false;\n await actor.permissionEvaluator.preEvaluateOneOf({ name: permissionNames });\n }\n\n if (\n !isMe &&\n entity.secret &&\n !entity.secret_encrypted &&\n !entity.secret_hashed\n ) {\n await actor.permissionEvaluator.evaluateOneOf({\n name: permissionNames,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Client> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Client,\n created: boolean \n }> {\n let group: string;\n\n const realm = typeof data.realm_id === 'string' ?\n await this.realmRepository.resolve(data.realm_id) :\n undefined;\n\n let entity: Client | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n if (realm) {\n where.realm_id = realm.id;\n }\n\n entity = await this.repository.findOneWithSecret(where);\n if (!entity && options.updateOnly) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n let isSelfEdit = false;\n if (entity) {\n try {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_UPDATE });\n } catch (e) {\n if (\n !actor.identity ||\n actor.identity.type !== 'client' ||\n actor.identity.data.id !== entity.id\n ) {\n throw e;\n }\n isSelfEdit = true;\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_SELF_MANAGE });\n }\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n // Reserve the system-provisioned client names (`system`, `web`) so an\n // API caller can't create or rename a client onto them — that would\n // collide on unique(name, realm_id) or shadow the built_in client.\n // Provisioning and runtime hooks bypass this service, so they remain\n // free to manage the reserved clients. built_in clients are exempt\n // (they ARE the provisioned ones) but API callers can never produce a\n // built_in client since the validator strips the flag.\n if (\n typeof validated.name === 'string' &&\n CLIENT_RESERVED_NAMES.includes(validated.name) &&\n !(entity && entity.built_in && entity.name === validated.name)\n ) {\n throw new ValidationError(`The client name '${validated.name}' is reserved.`);\n }\n\n await this.repository.validateJoinColumns(validated);\n await this.repository.checkUniqueness(validated, entity || undefined);\n\n const credentialsService = new ClientCredentialsService();\n\n if (entity) {\n if (\n !isSelfEdit &&\n !validated.realm_id &&\n !entity.realm_id\n ) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realm_id = actorRealmId;\n }\n }\n\n if (isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_SELF_MANAGE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n }\n\n entity = this.repository.merge(entity, validated);\n\n if (!isSelfEdit) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_UPDATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n }\n\n if (entity.auth_method === ClientAuthMethod.SECRET) {\n if (!validated.secret && !entity.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n if (validated.secret) {\n entity.secret = await credentialsService.protect(validated.secret, entity);\n }\n } else {\n entity.secret = null;\n entity.secret_hashed = false;\n entity.secret_encrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n if (!validated.realm_id) {\n const actorRealmId = this.getActorRealmId(actor);\n if (actorRealmId) {\n validated.realm_id = actorRealmId;\n }\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_CREATE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated, ...this.resourceRealmMatch(validated) }),\n });\n\n entity = this.repository.create(validated);\n\n if (entity.auth_method === ClientAuthMethod.SECRET) {\n if (!validated.secret) {\n validated.secret = credentialsService.generateSecret();\n }\n\n entity.secret = await credentialsService.protect(validated.secret, validated);\n } else {\n entity.secret = null;\n entity.secret_hashed = false;\n entity.secret_encrypted = false;\n }\n\n await this.repository.save(entity);\n\n return {\n entity,\n created: true, \n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Client> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.CLIENT_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.CLIENT_DELETE,\n data: definePolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity, ...this.resourceRealmMatch(entity) }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;;AA4BA,IAAaY,gBAAb,cAAmCF,sBAAAA;CACrBG;CAEAC;CAEAC;CAEV,YAAYC,KAA2B;EACnC,MAAK;EACL,KAAKH,aAAaG,IAAIH;EACtB,KAAKC,kBAAkBE,IAAIF;EAC3B,KAAKC,YAAY,IAAIP,gBAAAA;CACzB;CAEA,MAAMS,QACFC,OACAC,OAC+C;EAC/C,MAAMA,MAAMC,oBAAoBC,iBAAiB,EAC7CC,MAAM;GACFb,eAAec;GACfd,eAAee;GACff,eAAegB;IAEvB,CAAA;EAEA,MAAM,EACFC,MAAMC,UACNC,SACA,MAAM,KAAKf,WAAWgB,SAASX,KAAAA;EACnC,IAAI,EAAEY,UAAUF;EAEhB,MAAMF,OAAiB,CAAA;EACvB,KAAK,MAAMK,UAAUJ,UAAU;GAC3B,IACII,OAAOC,UACP,CAACD,OAAOE,oBACR,CAACF,OAAOG,eACV;IACE,IAAI;KACA,MAAMf,MAAMC,oBAAoBe,cAAc;MAC1Cb,MAAM;OACFb,eAAec;OACfd,eAAee;OACff,eAAegB;;MAEnBC,MAAMzB,iBAAiB;QAAGD,kBAAkBoC,aAAaL;OAAQ,GAAG,KAAKM,mBAAmBN,MAAAA;MAAQ,CAAA;KACxG,CAAA;KACAL,KAAKY,KAAKP,MAAAA;IACd,QAAQ;KACJD,SAAS;IACb;IAEA;GACJ;GAEAJ,KAAKY,KAAKP,MAAAA;EACd;EAEA,OAAO;GACHL;GACAE,MAAM;IACF,GAAGA;IACHE;GACJ;EACJ;CACJ;CAEA,MAAMS,OACFC,UACArB,OACAD,OACAuB,SACe;EACf,MAAMC,kBAAkB;GACpBjC,eAAec;GACfd,eAAee;GACff,eAAegB;;EAGnB,IAAIkB,OAAO,CAAC,CAACxB,MAAMyB,YACfzB,MAAMyB,SAASC,SAAS,aAEpB1B,MAAMyB,SAASlB,KAAKoB,OAAON,YAC3BrB,MAA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;EAEApC,SAAS,KAAKlB,WAAWmC,OAAOmB,SAAAA;EAEhC,IAAIpC,OAAO+C,gBAAgBvE,iBAAiBwE,QAAQ;GAChD,IAAI,CAACZ,UAAUnC,QACXmC,UAAUnC,SAASyC,mBAAmBO,eAAc;GAGxDjD,OAAOC,SAAS,MAAMyC,mBAAmBQ,QAAQd,UAAUnC,QAAQmC,SAAAA;EACvE,OAAO;GACHpC,OAAOC,SAAS;GAChBD,OAAOG,gBAAgB;GACvBH,OAAOE,mBAAmB;EAC9B;EAEA,MAAM,KAAKpB,WAAWoC,KAAKlB,MAAAA;EAE3B,OAAO;GACHA;GACAmD,SAAS;EACb;CACJ;CAEA,MAAMC,OACFrC,IACA3B,OACe;EACf,MAAMA,MAAMC,oBAAoByC,YAAY,EAAEvC,MAAMb,eAAegB,cAAc,CAAA;EAEjF,MAAMM,SAAS,MAAM,KAAKlB,WAAWuE,UAAU,EAAEtC,GAAG,CAAA;EACpD,IAAI,CAACf,QACD,MAAM,IAAI3B,oBAAAA;EAGd,MAAMe,MAAMC,oBAAoBwD,SAAS;GACrCtD,MAAMb,eAAegB;GACrBC,MAAMzB,iBAAiB;KAAGD,kBAAkBoC,aAAaL;IAAQ,GAAG,KAAKM,mBAAmBN,MAAAA;GAAQ,CAAA;EACxG,CAAA;EAEA,MAAM,EAAEe,IAAIuC,aAAatD;EACzB,MAAM,KAAKlB,WAAWyE,OAAOvD,MAAAA;EAC7BA,OAAOe,KAAKuC;EAEZ,OAAOtD;CACX;AACJ"}
|
|
@@ -15,9 +15,11 @@ export type WebClientProvisionerContext = {
|
|
|
15
15
|
* `global` scope lets the issued token drive the management API (parity
|
|
16
16
|
* with the legacy password-grant admin login); `openid` for the id-token.
|
|
17
17
|
*
|
|
18
|
-
* `grant_types` is
|
|
19
|
-
* token
|
|
20
|
-
*
|
|
18
|
+
* `grant_types` is an enforced allowlist (`assertClientGrantAllowed` at the
|
|
19
|
+
* /token grants and the /authorize code-request verifier; null = allow-all),
|
|
20
|
+
* so it must list every flow the client uses. `redirect_uri` and
|
|
21
|
+
* `post_logout_redirect_uri` are each one `<origin>/**` wildcard per trusted
|
|
22
|
+
* origin (matched by isSimpleMatch).
|
|
21
23
|
*/
|
|
22
24
|
export declare function buildWebClientAttributes(realm: Realm | {
|
|
23
25
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/web-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client/web-client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,MAAM,2BAA2B,GAAG;IACtC,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACpC,KAAK,EAAE,KAAK,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC7B,UAAU,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,MAAM,CAAC,CAejB;AAED,qBAAa,oBAAqB,YAAW,qBAAqB;IAC9D,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAE9C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAE/B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEd,GAAG,EAAE,2BAA2B;IAMtC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCrE"}
|