@authup/server-core 1.0.0-beta.52 → 1.0.0-beta.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/database/data-source/options/module.d.ts.map +1 -1
- package/dist/adapters/database/data-source/options/module.mjs +18 -8
- package/dist/adapters/database/data-source/options/module.mjs.map +1 -1
- package/dist/adapters/database/domains/client/entity.d.ts +5 -2
- package/dist/adapters/database/domains/client/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/entity.mjs +28 -4
- package/dist/adapters/database/domains/client/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/client-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/consent/entity.d.ts +20 -0
- package/dist/adapters/database/domains/consent/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/entity.mjs +110 -0
- package/dist/adapters/database/domains/consent/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/consent/index.d.ts +3 -0
- package/dist/adapters/database/domains/consent/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/index.mjs +6 -0
- package/dist/adapters/database/domains/consent/subscriber.d.ts +6 -0
- package/dist/adapters/database/domains/consent/subscriber.d.ts.map +1 -0
- package/dist/adapters/database/domains/consent/subscriber.mjs +45 -0
- package/dist/adapters/database/domains/consent/subscriber.mjs.map +1 -0
- package/dist/adapters/database/domains/constants.d.ts +1 -0
- package/dist/adapters/database/domains/constants.d.ts.map +1 -1
- package/dist/adapters/database/domains/constants.mjs +1 -0
- package/dist/adapters/database/domains/constants.mjs.map +1 -1
- package/dist/adapters/database/domains/event/entity.d.ts +22 -0
- package/dist/adapters/database/domains/event/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/event/entity.mjs +174 -0
- package/dist/adapters/database/domains/event/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/event/index.d.ts +2 -0
- package/dist/adapters/database/domains/event/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/event/index.mjs +5 -0
- package/dist/adapters/database/domains/identity-provider-account/entity.mjs +2 -2
- package/dist/adapters/database/domains/index.d.ts +4 -0
- package/dist/adapters/database/domains/index.d.ts.map +1 -1
- package/dist/adapters/database/domains/index.mjs +24 -15
- package/dist/adapters/database/domains/key/entity.d.ts +7 -3
- package/dist/adapters/database/domains/key/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/key/entity.mjs +35 -10
- package/dist/adapters/database/domains/key/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/permission-policy/entity.mjs +2 -2
- package/dist/adapters/database/domains/policy/repository.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy/repository.mjs +3 -3
- package/dist/adapters/database/domains/policy/repository.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/role/repository.mjs +1 -1
- package/dist/adapters/database/domains/role-permission/entity.mjs +2 -2
- package/dist/adapters/database/domains/session/entity.d.ts +3 -1
- package/dist/adapters/database/domains/session/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/session/entity.mjs +12 -0
- package/dist/adapters/database/domains/session/entity.mjs.map +1 -1
- package/dist/adapters/database/domains/trust-anchor/entity.d.ts +13 -0
- package/dist/adapters/database/domains/trust-anchor/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/entity.mjs +55 -0
- package/dist/adapters/database/domains/trust-anchor/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/index.d.ts +2 -0
- package/dist/adapters/database/domains/trust-anchor/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/trust-anchor/index.mjs +5 -0
- package/dist/adapters/database/domains/user-authenticator/entity.d.ts +20 -0
- package/dist/adapters/database/domains/user-authenticator/entity.d.ts.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/entity.mjs +98 -0
- package/dist/adapters/database/domains/user-authenticator/entity.mjs.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/index.d.ts +2 -0
- package/dist/adapters/database/domains/user-authenticator/index.d.ts.map +1 -0
- package/dist/adapters/database/domains/user-authenticator/index.mjs +5 -0
- package/dist/adapters/database/domains/user-permission/entity.mjs +1 -1
- package/dist/adapters/database/errors/driver.d.ts +14 -0
- package/dist/adapters/database/errors/driver.d.ts.map +1 -0
- package/dist/adapters/database/errors/driver.mjs +32 -0
- package/dist/adapters/database/errors/driver.mjs.map +1 -0
- package/dist/adapters/database/errors/index.d.ts +1 -0
- package/dist/adapters/database/errors/index.d.ts.map +1 -1
- package/dist/adapters/database/errors/index.mjs +2 -1
- package/dist/adapters/database/index.mjs +17 -11
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts +50 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs +320 -0
- package/dist/adapters/database/migrations/mysql/1783769340000-Default.mjs.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts +50 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.d.ts.map +1 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs +310 -0
- package/dist/adapters/database/migrations/postgres/1783769340000-Default.mjs.map +1 -0
- package/dist/adapters/database/subscriber/module.d.ts +1 -1
- package/dist/adapters/database/subscriber/module.d.ts.map +1 -1
- package/dist/adapters/database/subscriber/module.mjs +4 -3
- package/dist/adapters/database/subscriber/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.d.ts +4 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs +27 -2
- package/dist/adapters/http/adapters/oauth2/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts +9 -1
- package/dist/adapters/http/adapters/oauth2/authorization/types.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts +4 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +23 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts +4 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +13 -6
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts +38 -2
- package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +119 -6
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts +2 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +16 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts +14 -3
- package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts +5 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.d.ts.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs +18 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/certificate.mjs.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/guess.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.mjs +2 -1
- package/dist/adapters/http/adapters/oauth2/index.mjs +2 -1
- package/dist/adapters/http/controllers/entities/consent/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/consent/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/consent/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/consent/module.d.ts +15 -0
- package/dist/adapters/http/controllers/entities/consent/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/consent/module.mjs +82 -0
- package/dist/adapters/http/controllers/entities/consent/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/event/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/event/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/event/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/event/module.d.ts +14 -0
- package/dist/adapters/http/controllers/entities/event/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/event/module.mjs +68 -0
- package/dist/adapters/http/controllers/entities/event/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +4 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +38 -10
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts +3 -1
- package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.d.ts +5 -0
- package/dist/adapters/http/controllers/entities/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/index.mjs +11 -1
- package/dist/adapters/http/controllers/entities/key/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/key/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/key/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/key/module.d.ts +17 -0
- package/dist/adapters/http/controllers/entities/key/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/key/module.mjs +122 -0
- package/dist/adapters/http/controllers/entities/key/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/policy/utils/validation.mjs +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs +16 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts +17 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs +120 -0
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts +2 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/index.mjs +5 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts +21 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +154 -0
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/index.mjs +7 -1
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts +46 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs +132 -0
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs.map +1 -0
- package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +34 -6
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +17 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.d.ts +1 -0
- package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.mjs +3 -1
- package/dist/adapters/http/controllers/workflows/jwks/handlers/read.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs +28 -14
- package/dist/adapters/http/controllers/workflows/jwks/handlers/read.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/jwks/module.mjs +28 -14
- package/dist/adapters/http/controllers/workflows/jwks/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.d.ts +2 -1
- package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/module.mjs +28 -8
- package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/token/types.d.ts +11 -4
- package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
- package/dist/adapters/http/index.mjs +13 -3
- package/dist/adapters/http/middleware/built-in/assets.mjs +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +13 -0
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs +52 -2
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/types.d.ts +2 -0
- package/dist/adapters/http/middleware/built-in/authorization/types.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.mjs +2 -2
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts +12 -1
- package/dist/adapters/http/middleware/built-in/prometheus.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/prometheus.mjs +75 -6
- package/dist/adapters/http/middleware/built-in/prometheus.mjs.map +1 -1
- package/dist/adapters/http/middleware/index.mjs +2 -2
- package/dist/adapters/http/request/client-certificate.d.ts +5 -0
- package/dist/adapters/http/request/client-certificate.d.ts.map +1 -0
- package/dist/adapters/http/request/client-certificate.mjs +88 -0
- package/dist/adapters/http/request/client-certificate.mjs.map +1 -0
- package/dist/adapters/http/request/constants.d.ts +1 -0
- package/dist/adapters/http/request/constants.d.ts.map +1 -1
- package/dist/adapters/http/request/constants.mjs +6 -1
- package/dist/adapters/http/request/constants.mjs.map +1 -1
- package/dist/adapters/http/request/event-context.d.ts +19 -0
- package/dist/adapters/http/request/event-context.d.ts.map +1 -0
- package/dist/adapters/http/request/event-context.mjs +37 -0
- package/dist/adapters/http/request/event-context.mjs.map +1 -0
- package/dist/adapters/http/request/helpers/index.d.ts +1 -0
- package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
- package/dist/adapters/http/request/helpers/index.mjs +2 -1
- package/dist/adapters/http/request/helpers/mfa-login-ticket.d.ts +16 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs +15 -0
- package/dist/adapters/http/request/helpers/mfa-login-ticket.mjs.map +1 -0
- package/dist/adapters/http/request/index.d.ts +3 -0
- package/dist/adapters/http/request/index.d.ts.map +1 -1
- package/dist/adapters/http/request/index.mjs +5 -2
- package/dist/adapters/http/request/types.d.ts +3 -0
- package/dist/adapters/http/request/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/render.mjs +2 -2
- package/dist/app/index.mjs +11 -5
- package/dist/app/modules/components/module.d.ts.map +1 -1
- package/dist/app/modules/components/module.mjs +22 -2
- package/dist/app/modules/components/module.mjs.map +1 -1
- package/dist/app/modules/config/constants.d.ts +14 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +14 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +30 -2
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +57 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +101 -0
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/config/validator.d.ts.map +1 -1
- package/dist/app/modules/config/validator.mjs +16 -0
- package/dist/app/modules/config/validator.mjs.map +1 -1
- package/dist/app/modules/database/constants.d.ts +3 -0
- package/dist/app/modules/database/constants.d.ts.map +1 -1
- package/dist/app/modules/database/constants.mjs +3 -1
- package/dist/app/modules/database/constants.mjs.map +1 -1
- package/dist/app/modules/database/index.mjs +7 -3
- package/dist/app/modules/database/module.d.ts +1 -0
- package/dist/app/modules/database/module.d.ts.map +1 -1
- package/dist/app/modules/database/module.mjs +32 -1
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.mjs +8 -4
- package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/event/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/event/index.mjs +5 -0
- package/dist/app/modules/database/repositories/event/repository.d.ts +15 -0
- package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/event/repository.mjs +113 -0
- package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/helpers.d.ts +4 -2
- package/dist/app/modules/database/repositories/helpers.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/helpers.mjs +7 -3
- package/dist/app/modules/database/repositories/helpers.mjs.map +1 -1
- package/dist/app/modules/database/repositories/index.d.ts +4 -0
- package/dist/app/modules/database/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/index.mjs +9 -1
- package/dist/app/modules/database/repositories/key/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/key/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/key/index.mjs +5 -0
- package/dist/app/modules/database/repositories/key/repository.d.ts +50 -0
- package/dist/app/modules/database/repositories/key/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/key/repository.mjs +273 -0
- package/dist/app/modules/database/repositories/key/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/permission-provider/module.mjs +1 -1
- package/dist/app/modules/database/repositories/trust-anchor/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/trust-anchor/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/trust-anchor/index.mjs +5 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts +24 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +113 -0
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.d.ts +2 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/index.mjs +5 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts +19 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.d.ts.map +1 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs +92 -0
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs.map +1 -0
- package/dist/app/modules/http/module.d.ts +8 -0
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +19 -1
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +16 -3
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +186 -15
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.d.ts +1 -0
- package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +10 -4
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +2 -2
- package/dist/app/modules/index.d.ts +1 -0
- package/dist/app/modules/index.d.ts.map +1 -1
- package/dist/app/modules/index.mjs +13 -6
- package/dist/app/modules/mail/module.d.ts.map +1 -1
- package/dist/app/modules/mail/module.mjs +2 -1
- package/dist/app/modules/mail/module.mjs.map +1 -1
- package/dist/app/modules/metrics/constants.d.ts +4 -0
- package/dist/app/modules/metrics/constants.d.ts.map +1 -0
- package/dist/app/modules/metrics/constants.mjs +10 -0
- package/dist/app/modules/metrics/constants.mjs.map +1 -0
- package/dist/app/modules/metrics/index.d.ts +3 -0
- package/dist/app/modules/metrics/index.d.ts.map +1 -0
- package/dist/app/modules/metrics/index.mjs +6 -0
- package/dist/app/modules/metrics/prom.d.ts +15 -0
- package/dist/app/modules/metrics/prom.d.ts.map +1 -0
- package/dist/app/modules/metrics/prom.mjs +42 -0
- package/dist/app/modules/metrics/prom.mjs.map +1 -0
- package/dist/app/modules/oauth2/constants.d.ts +9 -2
- package/dist/app/modules/oauth2/constants.d.ts.map +1 -1
- package/dist/app/modules/oauth2/constants.mjs +7 -1
- package/dist/app/modules/oauth2/constants.mjs.map +1 -1
- package/dist/app/modules/oauth2/module.d.ts.map +1 -1
- package/dist/app/modules/oauth2/module.mjs +23 -4
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/consent/index.d.ts +2 -0
- package/dist/app/modules/oauth2/repositories/consent/index.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/consent/index.mjs +5 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.d.ts +20 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.d.ts.map +1 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs +116 -0
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -0
- package/dist/app/modules/oauth2/repositories/index.d.ts +1 -1
- package/dist/app/modules/oauth2/repositories/index.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/index.mjs +3 -3
- package/dist/app/modules/oauth2/repositories/token/repository.d.ts +1 -0
- package/dist/app/modules/oauth2/repositories/token/repository.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs +8 -0
- package/dist/app/modules/oauth2/repositories/token/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +16 -5
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.mjs +22 -7
- package/dist/app/modules/provisioning/sources/default/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.mjs +12 -2
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/components/event-cleaner/index.d.ts +2 -0
- package/dist/components/event-cleaner/index.d.ts.map +1 -0
- package/dist/components/event-cleaner/index.mjs +5 -0
- package/dist/components/event-cleaner/module.d.ts +5 -0
- package/dist/components/event-cleaner/module.d.ts.map +1 -0
- package/dist/components/event-cleaner/module.mjs +30 -0
- package/dist/components/event-cleaner/module.mjs.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/components/oauth2-cleaner/module.d.ts +2 -1
- package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
- package/dist/components/oauth2-cleaner/module.mjs +9 -4
- package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
- package/dist/core/authentication/credential/entities/client/module.d.ts +1 -1
- package/dist/core/authentication/credential/entities/client/module.d.ts.map +1 -1
- package/dist/core/authentication/credential/entities/client/module.mjs +2 -1
- package/dist/core/authentication/credential/entities/client/module.mjs.map +1 -1
- package/dist/core/authentication/entities/client/module.mjs +2 -2
- package/dist/core/authentication/entities/client/module.mjs.map +1 -1
- package/dist/core/authentication/index.d.ts +1 -0
- package/dist/core/authentication/index.d.ts.map +1 -1
- package/dist/core/authentication/index.mjs +3 -1
- package/dist/core/authentication/login-throttle/index.d.ts +3 -0
- package/dist/core/authentication/login-throttle/index.d.ts.map +1 -0
- package/dist/core/authentication/login-throttle/index.mjs +5 -0
- package/dist/core/authentication/login-throttle/service.d.ts +13 -0
- package/dist/core/authentication/login-throttle/service.d.ts.map +1 -0
- package/dist/core/authentication/login-throttle/service.mjs +33 -0
- package/dist/core/authentication/login-throttle/service.mjs.map +1 -0
- package/dist/core/authentication/login-throttle/types.d.ts +34 -0
- package/dist/core/authentication/login-throttle/types.d.ts.map +1 -0
- package/dist/core/authentication/session/module.d.ts +1 -0
- package/dist/core/authentication/session/module.d.ts.map +1 -1
- package/dist/core/authentication/session/module.mjs +4 -0
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/authentication/session/types.d.ts +6 -0
- package/dist/core/authentication/session/types.d.ts.map +1 -1
- package/dist/core/authentication/session/types.mjs.map +1 -1
- package/dist/core/client-certificate/index.d.ts +3 -0
- package/dist/core/client-certificate/index.d.ts.map +1 -0
- package/dist/core/client-certificate/index.mjs +5 -0
- package/dist/core/client-certificate/module.d.ts +18 -0
- package/dist/core/client-certificate/module.d.ts.map +1 -0
- package/dist/core/client-certificate/module.mjs +195 -0
- package/dist/core/client-certificate/module.mjs.map +1 -0
- package/dist/core/client-certificate/types.d.ts +22 -0
- package/dist/core/client-certificate/types.d.ts.map +1 -0
- package/dist/core/client-certificate/types.mjs +4 -0
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +15 -7
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/web-client.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.mjs +3 -2
- package/dist/core/entities/client/web-client.mjs.map +1 -1
- package/dist/core/entities/consent/index.d.ts +3 -0
- package/dist/core/entities/consent/index.d.ts.map +1 -0
- package/dist/core/entities/consent/index.mjs +6 -0
- package/dist/core/entities/consent/service.d.ts +19 -0
- package/dist/core/entities/consent/service.d.ts.map +1 -0
- package/dist/core/entities/consent/service.mjs +122 -0
- package/dist/core/entities/consent/service.mjs.map +1 -0
- package/dist/core/entities/consent/types.d.ts +97 -0
- package/dist/core/entities/consent/types.d.ts.map +1 -0
- package/dist/core/entities/consent/types.mjs +25 -0
- package/dist/core/entities/consent/types.mjs.map +1 -0
- package/dist/core/entities/event/constants.d.ts +7 -0
- package/dist/core/entities/event/constants.d.ts.map +1 -0
- package/dist/core/entities/event/constants.mjs +13 -0
- package/dist/core/entities/event/constants.mjs.map +1 -0
- package/dist/core/entities/event/diff.d.ts +20 -0
- package/dist/core/entities/event/diff.d.ts.map +1 -0
- package/dist/core/entities/event/diff.mjs +45 -0
- package/dist/core/entities/event/diff.mjs.map +1 -0
- package/dist/core/entities/event/entity-event-handler.d.ts +19 -0
- package/dist/core/entities/event/entity-event-handler.d.ts.map +1 -0
- package/dist/core/entities/event/entity-event-handler.mjs +100 -0
- package/dist/core/entities/event/entity-event-handler.mjs.map +1 -0
- package/dist/core/entities/event/index.d.ts +7 -0
- package/dist/core/entities/event/index.d.ts.map +1 -0
- package/dist/core/entities/event/index.mjs +9 -0
- package/dist/core/entities/event/sanitize.d.ts +2 -0
- package/dist/core/entities/event/sanitize.d.ts.map +1 -0
- package/dist/core/entities/event/sanitize.mjs +83 -0
- package/dist/core/entities/event/sanitize.mjs.map +1 -0
- package/dist/core/entities/event/service.d.ts +22 -0
- package/dist/core/entities/event/service.d.ts.map +1 -0
- package/dist/core/entities/event/service.mjs +169 -0
- package/dist/core/entities/event/service.mjs.map +1 -0
- package/dist/core/entities/event/types.d.ts +124 -0
- package/dist/core/entities/event/types.d.ts.map +1 -0
- package/dist/core/entities/event/types.mjs +4 -0
- package/dist/core/entities/identity-provider-role-mapping/service.mjs +2 -2
- package/dist/core/entities/identity-provider-role-mapping/service.mjs.map +1 -1
- package/dist/core/entities/index.d.ts +5 -0
- package/dist/core/entities/index.d.ts.map +1 -1
- package/dist/core/entities/index.mjs +20 -1
- package/dist/core/entities/key/index.d.ts +3 -0
- package/dist/core/entities/key/index.d.ts.map +1 -0
- package/dist/core/entities/key/index.mjs +5 -0
- package/dist/core/entities/key/service.d.ts +55 -0
- package/dist/core/entities/key/service.d.ts.map +1 -0
- package/dist/core/entities/key/service.mjs +301 -0
- package/dist/core/entities/key/service.mjs.map +1 -0
- package/dist/core/entities/key/types.d.ts +33 -0
- package/dist/core/entities/key/types.d.ts.map +1 -0
- package/dist/core/entities/key/types.mjs +4 -0
- package/dist/core/entities/permission/service.mjs +3 -3
- package/dist/core/entities/permission/service.mjs.map +1 -1
- package/dist/core/entities/policy/service.mjs +4 -4
- package/dist/core/entities/policy/service.mjs.map +1 -1
- package/dist/core/entities/realm/service.d.ts +3 -0
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +6 -3
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/entities/role/service.mjs +2 -2
- package/dist/core/entities/role/service.mjs.map +1 -1
- package/dist/core/entities/role-attribute/service.mjs +3 -3
- package/dist/core/entities/role-attribute/service.mjs.map +1 -1
- package/dist/core/entities/session/service.mjs +5 -2
- package/dist/core/entities/session/service.mjs.map +1 -1
- package/dist/core/entities/trust-anchor/index.d.ts +3 -0
- package/dist/core/entities/trust-anchor/index.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/index.mjs +5 -0
- package/dist/core/entities/trust-anchor/service.d.ts +33 -0
- package/dist/core/entities/trust-anchor/service.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/service.mjs +175 -0
- package/dist/core/entities/trust-anchor/service.mjs.map +1 -0
- package/dist/core/entities/trust-anchor/types.d.ts +14 -0
- package/dist/core/entities/trust-anchor/types.d.ts.map +1 -0
- package/dist/core/entities/trust-anchor/types.mjs +4 -0
- package/dist/core/entities/user/service.mjs +2 -2
- package/dist/core/entities/user/service.mjs.map +1 -1
- package/dist/core/entities/user-attribute/service.mjs +4 -4
- package/dist/core/entities/user-attribute/service.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/constants.d.ts +26 -0
- package/dist/core/entities/user-authenticator/constants.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/constants.mjs +32 -0
- package/dist/core/entities/user-authenticator/constants.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/helpers.d.ts +10 -0
- package/dist/core/entities/user-authenticator/helpers.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/helpers.mjs +35 -0
- package/dist/core/entities/user-authenticator/helpers.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/index.d.ts +6 -0
- package/dist/core/entities/user-authenticator/index.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/index.mjs +9 -0
- package/dist/core/entities/user-authenticator/service.d.ts +89 -0
- package/dist/core/entities/user-authenticator/service.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/service.mjs +709 -0
- package/dist/core/entities/user-authenticator/service.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/types.d.ts +221 -0
- package/dist/core/entities/user-authenticator/types.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/types.mjs +15 -0
- package/dist/core/entities/user-authenticator/types.mjs.map +1 -0
- package/dist/core/entities/user-authenticator/webauthn.d.ts +28 -0
- package/dist/core/entities/user-authenticator/webauthn.d.ts.map +1 -0
- package/dist/core/entities/user-authenticator/webauthn.mjs +88 -0
- package/dist/core/entities/user-authenticator/webauthn.mjs.map +1 -0
- package/dist/core/identity/index.mjs +2 -1
- package/dist/core/identity/password-recovery/disabled.d.ts +2 -2
- package/dist/core/identity/password-recovery/disabled.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/disabled.mjs +2 -2
- package/dist/core/identity/password-recovery/disabled.mjs.map +1 -1
- package/dist/core/identity/password-recovery/email-verification-required.d.ts +2 -2
- package/dist/core/identity/password-recovery/email-verification-required.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/email-verification-required.mjs +2 -2
- package/dist/core/identity/password-recovery/email-verification-required.mjs.map +1 -1
- package/dist/core/identity/password-recovery/service.d.ts +2 -1
- package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +26 -4
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/token-expired.d.ts +2 -2
- package/dist/core/identity/password-recovery/token-expired.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/token-expired.mjs +2 -2
- package/dist/core/identity/password-recovery/token-expired.mjs.map +1 -1
- package/dist/core/identity/password-recovery/types.d.ts +2 -1
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/permission/index.d.ts +1 -0
- package/dist/core/identity/permission/index.d.ts.map +1 -1
- package/dist/core/identity/permission/index.mjs +2 -1
- package/dist/core/identity/policy/checker/service.mjs +1 -1
- package/dist/core/identity/policy/checker/service.mjs.map +1 -1
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +2 -2
- package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
- package/dist/core/identity/registration/error.d.ts +2 -2
- package/dist/core/identity/registration/error.d.ts.map +1 -1
- package/dist/core/identity/registration/error.mjs +2 -2
- package/dist/core/identity/registration/error.mjs.map +1 -1
- package/dist/core/identity/registration/service.d.ts +2 -1
- package/dist/core/identity/registration/service.d.ts.map +1 -1
- package/dist/core/identity/registration/service.mjs +26 -4
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +2 -1
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.mjs +39 -8
- package/dist/core/key/certificate-error.d.ts +10 -0
- package/dist/core/key/certificate-error.d.ts.map +1 -0
- package/dist/core/key/certificate-error.mjs +19 -0
- package/dist/core/key/certificate-error.mjs.map +1 -0
- package/dist/core/key/certificate.d.ts +15 -0
- package/dist/core/key/certificate.d.ts.map +1 -0
- package/dist/core/key/certificate.mjs +72 -0
- package/dist/core/key/certificate.mjs.map +1 -0
- package/dist/core/key/check.d.ts +3 -0
- package/dist/core/key/check.d.ts.map +1 -0
- package/dist/core/key/check.mjs +13 -0
- package/dist/core/key/check.mjs.map +1 -0
- package/dist/core/key/constants.d.ts +10 -0
- package/dist/core/key/constants.d.ts.map +1 -0
- package/dist/core/key/constants.mjs +15 -0
- package/dist/core/key/constants.mjs.map +1 -0
- package/dist/core/key/error.d.ts +14 -0
- package/dist/core/key/error.d.ts.map +1 -0
- package/dist/core/key/error.mjs +23 -0
- package/dist/core/key/error.mjs.map +1 -0
- package/dist/core/key/index.d.ts +10 -0
- package/dist/core/key/index.d.ts.map +1 -0
- package/dist/core/key/index.mjs +12 -0
- package/dist/core/key/provisioner.d.ts +22 -0
- package/dist/core/key/provisioner.d.ts.map +1 -0
- package/dist/core/key/provisioner.mjs +30 -0
- package/dist/core/key/provisioner.mjs.map +1 -0
- package/dist/core/key/realm-cipher.d.ts +20 -0
- package/dist/core/key/realm-cipher.d.ts.map +1 -0
- package/dist/core/key/realm-cipher.mjs +60 -0
- package/dist/core/key/realm-cipher.mjs.map +1 -0
- package/dist/core/key/types.d.ts +59 -0
- package/dist/core/key/types.d.ts.map +1 -0
- package/dist/core/key/types.mjs +4 -0
- package/dist/core/key/wrap.d.ts +5 -0
- package/dist/core/key/wrap.d.ts.map +1 -0
- package/dist/core/key/wrap.mjs +21 -0
- package/dist/core/key/wrap.mjs.map +1 -0
- package/dist/core/mail/template/registry.d.ts.map +1 -1
- package/dist/core/mail/template/registry.mjs +3 -1
- package/dist/core/mail/template/registry.mjs.map +1 -1
- package/dist/core/mail/template/templates/mfa-email-otp.d.ts +3 -0
- package/dist/core/mail/template/templates/mfa-email-otp.d.ts.map +1 -0
- package/dist/core/mail/template/templates/mfa-email-otp.mjs +34 -0
- package/dist/core/mail/template/templates/mfa-email-otp.mjs.map +1 -0
- package/dist/core/mail/template/types.d.ts +6 -1
- package/dist/core/mail/template/types.d.ts.map +1 -1
- package/dist/core/mail/template/types.mjs +1 -0
- package/dist/core/mail/template/types.mjs.map +1 -1
- package/dist/core/metrics/index.d.ts +3 -0
- package/dist/core/metrics/index.d.ts.map +1 -0
- package/dist/core/metrics/index.mjs +5 -0
- package/dist/core/metrics/noop.d.ts +8 -0
- package/dist/core/metrics/noop.d.ts.map +1 -0
- package/dist/core/metrics/noop.mjs +14 -0
- package/dist/core/metrics/noop.mjs.map +1 -0
- package/dist/core/metrics/types.d.ts +19 -0
- package/dist/core/metrics/types.d.ts.map +1 -0
- package/dist/core/metrics/types.mjs +4 -0
- package/dist/core/oauth2/access-policy/index.d.ts +3 -0
- package/dist/core/oauth2/access-policy/index.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/index.mjs +5 -0
- package/dist/core/oauth2/access-policy/module.d.ts +12 -0
- package/dist/core/oauth2/access-policy/module.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/module.mjs +32 -0
- package/dist/core/oauth2/access-policy/module.mjs.map +1 -0
- package/dist/core/oauth2/access-policy/types.d.ts +19 -0
- package/dist/core/oauth2/access-policy/types.d.ts.map +1 -0
- package/dist/core/oauth2/access-policy/types.mjs +4 -0
- package/dist/core/oauth2/authorization/code/issuer/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/module.mjs +2 -0
- package/dist/core/oauth2/authorization/code/issuer/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts +6 -1
- package/dist/core/oauth2/authorization/code/issuer/types.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/code-request/validator.mjs +1 -0
- package/dist/core/oauth2/authorization/code-request/validator.mjs.map +1 -1
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +3 -3
- package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/helpers.d.ts +10 -1
- package/dist/core/oauth2/authorization/helpers.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/helpers.mjs +28 -2
- package/dist/core/oauth2/authorization/helpers.mjs.map +1 -1
- package/dist/core/oauth2/authorization/index.mjs +2 -2
- package/dist/core/oauth2/authorization/module.d.ts +9 -0
- package/dist/core/oauth2/authorization/module.d.ts.map +1 -1
- package/dist/core/oauth2/authorization/module.mjs +80 -3
- package/dist/core/oauth2/authorization/module.mjs.map +1 -1
- package/dist/core/oauth2/authorization/types.d.ts +36 -0
- package/dist/core/oauth2/authorization/types.d.ts.map +1 -1
- package/dist/core/oauth2/client/authenticator.d.ts +16 -7
- package/dist/core/oauth2/client/authenticator.d.ts.map +1 -1
- package/dist/core/oauth2/client/authenticator.mjs +49 -12
- package/dist/core/oauth2/client/authenticator.mjs.map +1 -1
- package/dist/core/oauth2/end-session/service.d.ts +2 -1
- package/dist/core/oauth2/end-session/service.d.ts.map +1 -1
- package/dist/core/oauth2/end-session/service.mjs +13 -0
- package/dist/core/oauth2/end-session/service.mjs.map +1 -1
- package/dist/core/oauth2/end-session/types.d.ts +2 -1
- package/dist/core/oauth2/end-session/types.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.d.ts +2 -2
- package/dist/core/oauth2/grant-types/authorize.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/authorize.mjs +12 -8
- package/dist/core/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/client-credentials.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/client-credentials.mjs +5 -3
- package/dist/core/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/identity.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/identity.mjs +10 -3
- package/dist/core/oauth2/grant-types/identity.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/password.d.ts +9 -0
- package/dist/core/oauth2/grant-types/password.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/password.mjs +32 -4
- package/dist/core/oauth2/grant-types/password.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.d.ts +4 -0
- package/dist/core/oauth2/grant-types/refresh-token.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs +17 -1
- package/dist/core/oauth2/grant-types/refresh-token.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/robot-credentials.d.ts.map +1 -1
- package/dist/core/oauth2/grant-types/robot-credentials.mjs +3 -2
- package/dist/core/oauth2/grant-types/robot-credentials.mjs.map +1 -1
- package/dist/core/oauth2/grant-types/types.d.ts +10 -3
- package/dist/core/oauth2/grant-types/types.d.ts.map +1 -1
- package/dist/core/oauth2/index.d.ts +2 -1
- package/dist/core/oauth2/index.d.ts.map +1 -1
- package/dist/core/oauth2/index.mjs +7 -2
- package/dist/core/oauth2/mfa-login/index.d.ts +3 -0
- package/dist/core/oauth2/mfa-login/index.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/index.mjs +5 -0
- package/dist/core/oauth2/mfa-login/module.d.ts +19 -0
- package/dist/core/oauth2/mfa-login/module.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/module.mjs +109 -0
- package/dist/core/oauth2/mfa-login/module.mjs.map +1 -0
- package/dist/core/oauth2/mfa-login/types.d.ts +64 -0
- package/dist/core/oauth2/mfa-login/types.d.ts.map +1 -0
- package/dist/core/oauth2/mfa-login/types.mjs +4 -0
- package/dist/core/oauth2/token/index.mjs +2 -1
- package/dist/core/oauth2/token/issuer/index.d.ts +1 -0
- package/dist/core/oauth2/token/issuer/index.d.ts.map +1 -1
- package/dist/core/oauth2/token/issuer/index.mjs +3 -1
- package/dist/core/oauth2/token/issuer/mfa/index.d.ts +2 -0
- package/dist/core/oauth2/token/issuer/mfa/index.d.ts.map +1 -0
- package/dist/core/oauth2/token/issuer/mfa/index.mjs +5 -0
- package/dist/core/oauth2/token/issuer/mfa/module.d.ts +18 -0
- package/dist/core/oauth2/token/issuer/mfa/module.d.ts.map +1 -0
- package/dist/core/oauth2/token/issuer/mfa/module.mjs +36 -0
- package/dist/core/oauth2/token/issuer/mfa/module.mjs.map +1 -0
- package/dist/core/oauth2/token/repository/types.d.ts +10 -0
- package/dist/core/oauth2/token/repository/types.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/revoker/module.mjs +1 -0
- package/dist/core/oauth2/token/revoker/module.mjs.map +1 -1
- package/dist/core/oauth2/token/signer/module.d.ts +3 -3
- package/dist/core/oauth2/token/signer/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/signer/module.mjs +5 -6
- package/dist/core/oauth2/token/signer/module.mjs.map +1 -1
- package/dist/core/oauth2/token/verifier/module.d.ts +3 -3
- package/dist/core/oauth2/token/verifier/module.d.ts.map +1 -1
- package/dist/core/oauth2/token/verifier/module.mjs +8 -5
- package/dist/core/oauth2/token/verifier/module.mjs.map +1 -1
- package/dist/index.mjs +52 -30
- package/dist/swagger.json +5431 -2952
- package/dist/ui/client/.vite/ssr-manifest.json +3888 -864
- package/dist/ui/client/assets/index-BmWsoQro.css +2 -0
- package/dist/ui/client/assets/{index-CP9HCHoS.js → index-CT0Nq5pA.js} +18 -17
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/server.js +19470 -18436
- package/package.json +22 -16
- package/dist/app/modules/oauth2/repositories/key/index.d.ts.map +0 -1
- package/dist/app/modules/oauth2/repositories/key/index.mjs +0 -5
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts +0 -14
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts.map +0 -1
- package/dist/app/modules/oauth2/repositories/key/repository.mjs +0 -51
- package/dist/app/modules/oauth2/repositories/key/repository.mjs.map +0 -1
- package/dist/core/oauth2/key/index.d.ts +0 -2
- package/dist/core/oauth2/key/index.d.ts.map +0 -1
- package/dist/core/oauth2/key/types.d.ts +0 -16
- package/dist/core/oauth2/key/types.d.ts.map +0 -1
- package/dist/ui/client/assets/index-VM4JXBXw.css +0 -2
- /package/dist/{core/oauth2/key → adapters/http/request}/types.mjs +0 -0
- /package/dist/app/modules/{oauth2/repositories/key → database/repositories/event}/index.d.ts +0 -0
- /package/dist/core/{oauth2/key/index.mjs → authentication/login-throttle/types.mjs} +0 -0
|
@@ -3,33 +3,70 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { ClientCredentialsService } from "../../authentication/credential/entities/client/module.mjs";
|
|
5
5
|
import "../../authentication/credential/index.mjs";
|
|
6
|
-
import { IdentityType } from "@authup/core-kit";
|
|
6
|
+
import { ClientAuthMethod, ClientTokenBindingMethod, IdentityType } from "@authup/core-kit";
|
|
7
|
+
import { isValidationError } from "@authup/errors";
|
|
7
8
|
import { OAuth2ClientError } from "@authup/specs";
|
|
8
9
|
//#region src/core/oauth2/client/authenticator.ts
|
|
9
10
|
/**
|
|
10
|
-
* Authenticates a client at the OAuth2 token endpoint
|
|
11
|
-
*
|
|
12
|
-
* public clients identify via client_id only.
|
|
11
|
+
* Authenticates a client at the OAuth2 token endpoint according to its
|
|
12
|
+
* exclusive method: public id only, shared secret, or trusted TLS evidence.
|
|
13
13
|
*
|
|
14
|
-
* Used by
|
|
14
|
+
* Used by every standard client-resolving grant.
|
|
15
15
|
*/ var OAuth2ClientAuthenticator = class {
|
|
16
16
|
identityResolver;
|
|
17
17
|
credentialsService;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
certificateValidator;
|
|
19
|
+
constructor(ctx) {
|
|
20
|
+
if ("identityResolver" in ctx) {
|
|
21
|
+
this.identityResolver = ctx.identityResolver;
|
|
22
|
+
this.certificateValidator = ctx.certificateValidator;
|
|
23
|
+
} else this.identityResolver = ctx;
|
|
20
24
|
this.credentialsService = new ClientCredentialsService();
|
|
21
25
|
}
|
|
22
|
-
async authenticate(clientId, clientSecret, realmId) {
|
|
26
|
+
async authenticate(clientId, clientSecret, realmId, certificateEvidence) {
|
|
23
27
|
if (!clientId) throw OAuth2ClientError.invalid();
|
|
28
|
+
const client = await this.resolve(clientId, realmId);
|
|
29
|
+
switch (client.auth_method) {
|
|
30
|
+
case ClientAuthMethod.NONE:
|
|
31
|
+
if (typeof clientSecret === "string") throw OAuth2ClientError.invalid();
|
|
32
|
+
break;
|
|
33
|
+
case ClientAuthMethod.SECRET:
|
|
34
|
+
if (!clientSecret) throw OAuth2ClientError.invalid();
|
|
35
|
+
if (!await this.credentialsService.verify(clientSecret, client)) throw OAuth2ClientError.invalid();
|
|
36
|
+
break;
|
|
37
|
+
case ClientAuthMethod.TLS:
|
|
38
|
+
if (typeof clientSecret === "string" || !certificateEvidence || !this.certificateValidator) throw OAuth2ClientError.invalid();
|
|
39
|
+
try {
|
|
40
|
+
await this.certificateValidator.validateForAuthentication(client, certificateEvidence);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
if (isValidationError(e)) throw OAuth2ClientError.invalid();
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
default: throw OAuth2ClientError.invalid();
|
|
47
|
+
}
|
|
48
|
+
return client;
|
|
49
|
+
}
|
|
50
|
+
async resolve(clientId, realmId) {
|
|
24
51
|
const identity = await this.identityResolver.resolve(IdentityType.CLIENT, clientId, realmId);
|
|
25
52
|
if (!identity || identity.type !== IdentityType.CLIENT) throw OAuth2ClientError.invalid();
|
|
26
53
|
if (!identity.data.active) throw OAuth2ClientError.inactive();
|
|
27
|
-
if (identity.data.is_confidential) {
|
|
28
|
-
if (!clientSecret) throw OAuth2ClientError.invalid();
|
|
29
|
-
if (!await this.credentialsService.verify(clientSecret, identity.data)) throw OAuth2ClientError.invalid();
|
|
30
|
-
}
|
|
31
54
|
return identity.data;
|
|
32
55
|
}
|
|
56
|
+
resolveTokenBinding(client, certificateEvidence) {
|
|
57
|
+
if (client.token_binding_method === ClientTokenBindingMethod.NONE) return;
|
|
58
|
+
if (client.token_binding_method !== ClientTokenBindingMethod.TLS) throw OAuth2ClientError.invalid();
|
|
59
|
+
return this.validateCertificateEvidenceForBinding(certificateEvidence);
|
|
60
|
+
}
|
|
61
|
+
validateCertificateEvidenceForBinding(certificateEvidence) {
|
|
62
|
+
if (!certificateEvidence || !this.certificateValidator) throw OAuth2ClientError.invalid();
|
|
63
|
+
try {
|
|
64
|
+
this.certificateValidator.validateForBinding(certificateEvidence);
|
|
65
|
+
} catch {
|
|
66
|
+
throw OAuth2ClientError.invalid();
|
|
67
|
+
}
|
|
68
|
+
return { "x5t#S256": certificateEvidence.thumbprint };
|
|
69
|
+
}
|
|
33
70
|
};
|
|
34
71
|
//#endregion
|
|
35
72
|
export { OAuth2ClientAuthenticator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.mjs","names":["IdentityType","OAuth2ClientError","ClientCredentialsService","OAuth2ClientAuthenticator","identityResolver","credentialsService","authenticate","clientId","clientSecret","realmId","invalid","
|
|
1
|
+
{"version":3,"file":"authenticator.mjs","names":["ClientAuthMethod","ClientTokenBindingMethod","IdentityType","OAuth2ClientError","isValidationError","ClientCredentialsService","OAuth2ClientAuthenticator","identityResolver","credentialsService","certificateValidator","ctx","authenticate","clientId","clientSecret","realmId","certificateEvidence","invalid","client","resolve","auth_method","NONE","SECRET","verified","verify","TLS","validateForAuthentication","e","identity","CLIENT","type","data","active","inactive","resolveTokenBinding","token_binding_method","undefined","validateCertificateEvidenceForBinding","validateForBinding","thumbprint"],"sources":["../../../../src/core/oauth2/client/authenticator.ts"],"sourcesContent":["/*\n * Copyright (c) 2025-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport {\n type Client,\n ClientAuthMethod,\n ClientTokenBindingMethod,\n IdentityType,\n} from '@authup/core-kit';\nimport type { OAuth2TokenConfirmation } from '@authup/specs';\nimport { OAuth2ClientError } from '@authup/specs';\nimport { isValidationError } from '@authup/errors';\nimport { ClientCredentialsService } from '../../authentication/credential/index.ts';\nimport type {\n ClientCertificateEvidence,\n IClientCertificateValidator,\n} from '../../client-certificate/index.ts';\nimport type { IIdentityResolver } from '../../identity/index.ts';\n\nexport type OAuth2ClientAuthenticatorContext = {\n identityResolver: IIdentityResolver,\n certificateValidator: IClientCertificateValidator,\n};\n\n/**\n * Authenticates a client at the OAuth2 token endpoint according to its\n * exclusive method: public id only, shared secret, or trusted TLS evidence.\n *\n * Used by every standard client-resolving grant.\n */\nexport class OAuth2ClientAuthenticator {\n protected identityResolver: IIdentityResolver;\n\n protected credentialsService: ClientCredentialsService;\n\n protected certificateValidator?: IClientCertificateValidator;\n\n constructor(ctx: IIdentityResolver | OAuth2ClientAuthenticatorContext) {\n if ('identityResolver' in ctx) {\n this.identityResolver = ctx.identityResolver;\n this.certificateValidator = ctx.certificateValidator;\n } else {\n // Kept as a compatibility seam for focused secret/public-client\n // unit tests. Production wiring always supplies the validator.\n this.identityResolver = ctx;\n }\n this.credentialsService = new ClientCredentialsService();\n }\n\n async authenticate(\n clientId: string | undefined,\n clientSecret?: string,\n realmId?: string,\n certificateEvidence?: ClientCertificateEvidence,\n ): Promise<Client> {\n if (!clientId) {\n throw OAuth2ClientError.invalid();\n }\n\n const client = await this.resolve(clientId, realmId);\n\n switch (client.auth_method) {\n case ClientAuthMethod.NONE:\n if (typeof clientSecret === 'string') {\n throw OAuth2ClientError.invalid();\n }\n break;\n case ClientAuthMethod.SECRET: {\n if (!clientSecret) {\n throw OAuth2ClientError.invalid();\n }\n\n const verified = await this.credentialsService.verify(clientSecret, client);\n if (!verified) {\n throw OAuth2ClientError.invalid();\n }\n break;\n }\n case ClientAuthMethod.TLS:\n if (\n typeof clientSecret === 'string' ||\n !certificateEvidence ||\n !this.certificateValidator\n ) {\n throw OAuth2ClientError.invalid();\n }\n\n try {\n await this.certificateValidator.validateForAuthentication(client, certificateEvidence);\n } catch (e) {\n // A validation failure deliberately reveals neither the\n // certificate identity nor which realm anchor failed. An\n // infrastructure fault (e.g. the trust-anchor store being\n // unreachable) must NOT masquerade as a bad certificate —\n // let it surface as a server error instead.\n if (isValidationError(e)) {\n throw OAuth2ClientError.invalid();\n }\n throw e;\n }\n break;\n default:\n throw OAuth2ClientError.invalid();\n }\n\n return client;\n }\n\n async resolve(clientId: string, realmId?: string): Promise<Client> {\n const identity = await this.identityResolver.resolve(IdentityType.CLIENT, clientId, realmId);\n if (!identity || identity.type !== IdentityType.CLIENT) {\n throw OAuth2ClientError.invalid();\n }\n\n if (!identity.data.active) {\n throw OAuth2ClientError.inactive();\n }\n\n return identity.data;\n }\n\n resolveTokenBinding(\n client: Pick<Client, 'token_binding_method'>,\n certificateEvidence?: ClientCertificateEvidence,\n ): OAuth2TokenConfirmation | undefined {\n if (client.token_binding_method === ClientTokenBindingMethod.NONE) {\n return undefined;\n }\n\n if (client.token_binding_method !== ClientTokenBindingMethod.TLS) {\n throw OAuth2ClientError.invalid();\n }\n\n return this.validateCertificateEvidenceForBinding(certificateEvidence);\n }\n\n validateCertificateEvidenceForBinding(\n certificateEvidence?: ClientCertificateEvidence,\n ): OAuth2TokenConfirmation {\n if (!certificateEvidence || !this.certificateValidator) {\n throw OAuth2ClientError.invalid();\n }\n\n try {\n this.certificateValidator.validateForBinding(certificateEvidence);\n } catch {\n throw OAuth2ClientError.invalid();\n }\n\n return { 'x5t#S256': certificateEvidence.thumbprint };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;GAkCA,IAAaM,4BAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEV,YAAYC,KAA2D;EACnE,IAAI,sBAAsBA,KAAK;GAC3B,KAAKH,mBAAmBG,IAAIH;GAC5B,KAAKE,uBAAuBC,IAAID;EACpC,OAGI,KAAKF,mBAAmBG;EAE5B,KAAKF,qBAAqB,IAAIH,yBAAAA;CAClC;CAEA,MAAMM,aACFC,UACAC,cACAC,SACAC,qBACe;EACf,IAAI,CAACH,UACD,MAAMT,kBAAkBa,QAAO;EAGnC,MAAMC,SAAS,MAAM,KAAKC,QAAQN,UAAUE,OAAAA;EAE5C,QAAQG,OAAOE,aAAf;GACI,KAAKnB,iBAAiBoB;IAClB,IAAI,OAAOP,iBAAiB,UACxB,MAAMV,kBAAkBa,QAAO;IAEnC;GACJ,KAAKhB,iBAAiBqB;IAClB,IAAI,CAACR,cACD,MAAMV,kBAAkBa,QAAO;IAInC,IAAI,CAACM,MADkB,KAAKd,mBAAmBe,OAAOV,cAAcI,MAAAA,GAEhE,MAAMd,kBAAkBa,QAAO;IAEnC;GAEJ,KAAKhB,iBAAiBwB;IAClB,IACI,OAAOX,iBAAiB,YACxB,CAACE,uBACD,CAAC,KAAKN,sBAEN,MAAMN,kBAAkBa,QAAO;IAGnC,IAAI;KACA,MAAM,KAAKP,qBAAqBgB,0BAA0BR,QAAQF,mBAAAA;IACtE,SAASW,GAAG;KAMR,IAAItB,kBAAkBsB,CAAAA,GAClB,MAAMvB,kBAAkBa,QAAO;KAEnC,MAAMU;IACV;IACA;GACJ,SACI,MAAMvB,kBAAkBa,QAAO;EACvC;EAEA,OAAOC;CACX;CAEA,MAAMC,QAAQN,UAAkBE,SAAmC;EAC/D,MAAMa,WAAW,MAAM,KAAKpB,iBAAiBW,QAAQhB,aAAa0B,QAAQhB,UAAUE,OAAAA;EACpF,IAAI,CAACa,YAAYA,SAASE,SAAS3B,aAAa0B,QAC5C,MAAMzB,kBAAkBa,QAAO;EAGnC,IAAI,CAACW,SAASG,KAAKC,QACf,MAAM5B,kBAAkB6B,SAAQ;EAGpC,OAAOL,SAASG;CACpB;CAEAG,oBACIhB,QACAF,qBACmC;EACnC,IAAIE,OAAOiB,yBAAyBjC,yBAAyBmB,MACzD;EAGJ,IAAIH,OAAOiB,yBAAyBjC,yBAAyBuB,KACzD,MAAMrB,kBAAkBa,QAAO;EAGnC,OAAO,KAAKoB,sCAAsCrB,mBAAAA;CACtD;CAEAqB,sCACIrB,qBACuB;EACvB,IAAI,CAACA,uBAAuB,CAAC,KAAKN,sBAC9B,MAAMN,kBAAkBa,QAAO;EAGnC,IAAI;GACA,KAAKP,qBAAqB4B,mBAAmBtB,mBAAAA;EACjD,QAAQ;GACJ,MAAMZ,kBAAkBa,QAAO;EACnC;EAEA,OAAO,EAAE,YAAYD,oBAAoBuB,WAAW;CACxD;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OAuth2TokenPayload } from '@authup/specs';
|
|
2
|
-
import type { IRealmRepository } from '../../entities/index.ts';
|
|
2
|
+
import type { IEventService, IRealmRepository } from '../../entities/index.ts';
|
|
3
3
|
import type { ISessionManager } from '../../authentication/index.ts';
|
|
4
4
|
import type { IOAuth2ClientRepository } from '../client/index.ts';
|
|
5
5
|
import type { IOAuth2TokenVerifier } from '../token/index.ts';
|
|
@@ -9,6 +9,7 @@ export declare class OAuth2EndSessionService implements IOAuth2EndSessionService
|
|
|
9
9
|
protected sessionManager: ISessionManager;
|
|
10
10
|
protected clientRepository: IOAuth2ClientRepository;
|
|
11
11
|
protected realmRepository: IRealmRepository;
|
|
12
|
+
protected eventService?: IEventService;
|
|
12
13
|
protected hintGracePeriod: number;
|
|
13
14
|
constructor(ctx: OAuth2EndSessionServiceContext);
|
|
14
15
|
verify(data: OAuth2EndSessionRequest): Promise<OAuth2EndSessionResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/end-session/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/end-session/service.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EACR,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EACjC,MAAM,YAAY,CAAC;AAEpB,qBAAa,uBAAwB,YAAW,wBAAwB;IACpE,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAE9C,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;IAE1C,SAAS,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAEpD,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAE5C,SAAS,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IAEvC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;gBAEtB,GAAG,EAAE,8BAA8B;IASzC,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA+GtE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA2B/E;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO;IAcvE;;;;OAIG;IACH,SAAS,CAAC,yBAAyB,CAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,SAAS,EAAE,MAAM,GAClB,OAAO;CAkBb"}
|
|
@@ -2,6 +2,7 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { isSimpleMatch, isUUID } from "@authup/kit";
|
|
5
|
+
import { EventName, EventRefType, EventScope } from "@authup/core-kit";
|
|
5
6
|
import { OAuth2TokenKind } from "@authup/specs";
|
|
6
7
|
//#region src/core/oauth2/end-session/service.ts
|
|
7
8
|
var OAuth2EndSessionService = class {
|
|
@@ -9,12 +10,14 @@ var OAuth2EndSessionService = class {
|
|
|
9
10
|
sessionManager;
|
|
10
11
|
clientRepository;
|
|
11
12
|
realmRepository;
|
|
13
|
+
eventService;
|
|
12
14
|
hintGracePeriod;
|
|
13
15
|
constructor(ctx) {
|
|
14
16
|
this.tokenVerifier = ctx.tokenVerifier;
|
|
15
17
|
this.sessionManager = ctx.sessionManager;
|
|
16
18
|
this.clientRepository = ctx.clientRepository;
|
|
17
19
|
this.realmRepository = ctx.realmRepository;
|
|
20
|
+
this.eventService = ctx.eventService;
|
|
18
21
|
this.hintGracePeriod = ctx.hintGracePeriod ?? 0;
|
|
19
22
|
}
|
|
20
23
|
async verify(data) {
|
|
@@ -83,6 +86,16 @@ var OAuth2EndSessionService = class {
|
|
|
83
86
|
if (!session) return false;
|
|
84
87
|
if (session.sub !== sub || session.sub_kind !== subKind) return false;
|
|
85
88
|
await this.sessionManager.revoke(sessionId);
|
|
89
|
+
await this.eventService?.record({
|
|
90
|
+
scope: EventScope.OAUTH2,
|
|
91
|
+
name: EventName.LOGOUT,
|
|
92
|
+
refType: EventRefType.SESSION,
|
|
93
|
+
refId: sessionId,
|
|
94
|
+
actorType: session.sub_kind,
|
|
95
|
+
actorId: session.sub,
|
|
96
|
+
realmId: session.realm_id,
|
|
97
|
+
data: { revoked_session_id: sessionId }
|
|
98
|
+
});
|
|
86
99
|
return true;
|
|
87
100
|
}
|
|
88
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["isSimpleMatch","isUUID","OAuth2TokenKind","OAuth2EndSessionService","tokenVerifier","sessionManager","clientRepository","realmRepository","hintGracePeriod","ctx","verify","data","hintVerified","sub","subKind","sessionId","hintRealmId","audiences","id_token_hint","payload","ignoreExpiry","skipActiveCheck","kind","ID_TOKEN","isWithinHintGraceWindow","sub_kind","sid","session_id","undefined","realm_id","aud","Array","isArray","filter","entry","clientId","client_id","length","client","realmKey","realm_name","realm","resolve","findOneByIdOrName","id","expected","includes","clientName","redirectUri","name","post_logout_redirect_uri","isValidPostLogoutRedirect","state","revoke","session","findOneById","exp","nowSeconds","Math","floor","Date","now","registered","candidate","parsed","URL","protocol","split"],"sources":["../../../../src/core/oauth2/end-session/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isSimpleMatch, isUUID } from '@authup/kit';\nimport type { Client } from '@authup/core-kit';\nimport type { OAuth2TokenPayload } from '@authup/specs';\nimport { OAuth2TokenKind } from '@authup/specs';\nimport type { IRealmRepository } from '../../entities/index.ts';\nimport type { ISessionManager } from '../../authentication/index.ts';\nimport type { IOAuth2ClientRepository } from '../client/index.ts';\nimport type { IOAuth2TokenVerifier } from '../token/index.ts';\nimport type {\n IOAuth2EndSessionService,\n OAuth2EndSessionRequest,\n OAuth2EndSessionResult,\n OAuth2EndSessionServiceContext,\n} from './types.ts';\n\nexport class OAuth2EndSessionService implements IOAuth2EndSessionService {\n protected tokenVerifier: IOAuth2TokenVerifier;\n\n protected sessionManager: ISessionManager;\n\n protected clientRepository: IOAuth2ClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected hintGracePeriod: number;\n\n constructor(ctx: OAuth2EndSessionServiceContext) {\n this.tokenVerifier = ctx.tokenVerifier;\n this.sessionManager = ctx.sessionManager;\n this.clientRepository = ctx.clientRepository;\n this.realmRepository = ctx.realmRepository;\n this.hintGracePeriod = ctx.hintGracePeriod ?? 0;\n }\n\n async verify(data: OAuth2EndSessionRequest): Promise<OAuth2EndSessionResult> {\n let hintVerified = false;\n let sub: string | undefined;\n let subKind: string | undefined;\n let sessionId: string | undefined;\n let hintRealmId: string | undefined;\n let audiences: string[] = [];\n\n if (data.id_token_hint) {\n try {\n // Signature + kind are the anchors; exp is skipped (a logout hint\n // is routinely expired) and the cache blocklist is irrelevant.\n const payload = await this.tokenVerifier.verify(data.id_token_hint, {\n ignoreExpiry: true,\n skipActiveCheck: true,\n });\n\n // MUST be an id_token — access/refresh tokens also carry\n // session_id, so accepting them would let a leaked access token\n // act as a logout weapon.\n if (payload.kind === OAuth2TokenKind.ID_TOKEN && this.isWithinHintGraceWindow(payload)) {\n hintVerified = true;\n sub = payload.sub;\n subKind = payload.sub_kind;\n sessionId = payload.sid ?? payload.session_id ?? undefined;\n hintRealmId = payload.realm_id ?? undefined;\n // aud may be a single string or an array (JWT spec).\n const { aud } = payload;\n if (Array.isArray(aud)) {\n audiences = aud.filter((entry): entry is string => typeof entry === 'string');\n } else if (typeof aud === 'string') {\n audiences = [aud];\n }\n }\n } catch {\n // forged / unverifiable hint → stays unverified (no revoke)\n }\n }\n\n // Resolve a single client for the aud cross-check and redirect\n // validation: the request's client_id, else the hint's sole audience\n // (ambiguous for a multi-aud hint).\n const clientId = data.client_id ?? (audiences.length === 1 ? audiences[0] : undefined);\n\n let client: Client | null = null;\n if (clientId) {\n // Scope a name-identified client to the request's realm hint; a\n // VERIFIED hint's own realm claim serves as fallback (claims from an\n // unverified hint are never trusted). No master fallback here\n // (unlike /token): a bogus hint must NOT silently resolve a\n // same-named client in master → null realm.\n const realmKey = data.realm_id ?? data.realm_name ?? (hintVerified ? hintRealmId : undefined);\n const realm = await this.realmRepository.resolve(realmKey, false);\n\n // Fail closed instead of dropping the realm predicate: a supplied\n // realm key that does not resolve never degrades to an unscoped\n // lookup, and a NAME-form client_id without any realm key is\n // ambiguous (every realm has a built-in `web` client — same rule as\n // the /authorize verifier). A UUID is globally unique and needs no\n // scope; the sole-aud-derived clientId is always a UUID.\n if (realm) {\n client = await this.clientRepository.findOneByIdOrName(clientId, realm.id);\n } else if (!realmKey && isUUID(clientId)) {\n client = await this.clientRepository.findOneByIdOrName(clientId);\n }\n }\n\n // aud/client_id cross-check: when the request supplies a client_id on a\n // verified hint, it MUST denote one of the hint's audiences. The aud is\n // the client UUID, so a name-form client_id is compared via its resolved\n // client's id. Fail closed: an aud-less hint, or a name that did not\n // resolve, counts as unverified.\n if (hintVerified && data.client_id) {\n const expected = isUUID(data.client_id) ? data.client_id : client?.id;\n if (audiences.length === 0 || !expected || !audiences.includes(expected)) {\n hintVerified = false;\n sub = undefined;\n subKind = undefined;\n sessionId = undefined;\n }\n }\n\n let clientName: string | undefined;\n let redirectUri: string | undefined;\n\n // Redirect validation is independent of hint verification — the\n // click-gated confirm page (unverified hint / hint-less request) still\n // honors a registered post-logout redirect.\n if (client) {\n clientName = client.name;\n if (\n data.post_logout_redirect_uri &&\n this.isValidPostLogoutRedirect(client.post_logout_redirect_uri, data.post_logout_redirect_uri)\n ) {\n redirectUri = data.post_logout_redirect_uri;\n }\n }\n\n return {\n hintVerified,\n ...(hintVerified ? {\n sub,\n subKind,\n sessionId,\n } : {}),\n ...(clientId ? { clientId } : {}),\n ...(clientName ? { clientName } : {}),\n ...(redirectUri ? { redirectUri, ...(data.state ? { state: data.state } : {}) } : {}),\n };\n }\n\n async revoke(sessionId: string, sub: string, subKind: string): Promise<boolean> {\n const session = await this.sessionManager.findOneById(sessionId);\n if (!session) {\n return false;\n }\n\n // Never revoke a session that does not belong to the hint's subject.\n if (session.sub !== sub || session.sub_kind !== subKind) {\n return false;\n }\n\n await this.sessionManager.revoke(sessionId);\n return true;\n }\n\n /**\n * With a positive `hintGracePeriod`, an expired hint is honored only within\n * the window past `exp` — beyond it a leaked id_token stops being a\n * replayable remote logout (the hint counts as unverified; the click-gated\n * confirm page still works). 0 keeps spec/Keycloak parity: any expired hint.\n */\n protected isWithinHintGraceWindow(payload: OAuth2TokenPayload): boolean {\n if (this.hintGracePeriod <= 0) {\n return true;\n }\n\n // a bounded window without an exp claim to judge against fails closed\n if (typeof payload.exp !== 'number') {\n return false;\n }\n\n const nowSeconds = Math.floor(Date.now() / 1000);\n return nowSeconds - payload.exp <= this.hintGracePeriod;\n }\n\n /**\n * A post-logout redirect is honored only when it is an absolute http(s) URL\n * that matches a registered client redirect pattern (defense against open\n * redirects to attacker-controlled URLs).\n */\n protected isValidPostLogoutRedirect(\n registered: string | null | undefined,\n candidate: string,\n ): boolean {\n let parsed: URL;\n try {\n parsed = new URL(candidate);\n } catch {\n return false;\n }\n\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n return false;\n }\n\n if (!registered) {\n return false;\n }\n\n return isSimpleMatch(candidate, registered.split(','));\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["isSimpleMatch","isUUID","EventName","EventRefType","EventScope","OAuth2TokenKind","OAuth2EndSessionService","tokenVerifier","sessionManager","clientRepository","realmRepository","eventService","hintGracePeriod","ctx","verify","data","hintVerified","sub","subKind","sessionId","hintRealmId","audiences","id_token_hint","payload","ignoreExpiry","skipActiveCheck","kind","ID_TOKEN","isWithinHintGraceWindow","sub_kind","sid","session_id","undefined","realm_id","aud","Array","isArray","filter","entry","clientId","client_id","length","client","realmKey","realm_name","realm","resolve","findOneByIdOrName","id","expected","includes","clientName","redirectUri","name","post_logout_redirect_uri","isValidPostLogoutRedirect","state","revoke","session","findOneById","record","scope","OAUTH2","LOGOUT","refType","SESSION","refId","actorType","actorId","realmId","revoked_session_id","exp","nowSeconds","Math","floor","Date","now","registered","candidate","parsed","URL","protocol","split"],"sources":["../../../../src/core/oauth2/end-session/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isSimpleMatch, isUUID } from '@authup/kit';\nimport type { Client, IdentityType } from '@authup/core-kit';\nimport { EventName, EventRefType, EventScope } from '@authup/core-kit';\nimport type { OAuth2TokenPayload } from '@authup/specs';\nimport { OAuth2TokenKind } from '@authup/specs';\nimport type { IEventService, IRealmRepository } from '../../entities/index.ts';\nimport type { ISessionManager } from '../../authentication/index.ts';\nimport type { IOAuth2ClientRepository } from '../client/index.ts';\nimport type { IOAuth2TokenVerifier } from '../token/index.ts';\nimport type {\n IOAuth2EndSessionService,\n OAuth2EndSessionRequest,\n OAuth2EndSessionResult,\n OAuth2EndSessionServiceContext,\n} from './types.ts';\n\nexport class OAuth2EndSessionService implements IOAuth2EndSessionService {\n protected tokenVerifier: IOAuth2TokenVerifier;\n\n protected sessionManager: ISessionManager;\n\n protected clientRepository: IOAuth2ClientRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected eventService?: IEventService;\n\n protected hintGracePeriod: number;\n\n constructor(ctx: OAuth2EndSessionServiceContext) {\n this.tokenVerifier = ctx.tokenVerifier;\n this.sessionManager = ctx.sessionManager;\n this.clientRepository = ctx.clientRepository;\n this.realmRepository = ctx.realmRepository;\n this.eventService = ctx.eventService;\n this.hintGracePeriod = ctx.hintGracePeriod ?? 0;\n }\n\n async verify(data: OAuth2EndSessionRequest): Promise<OAuth2EndSessionResult> {\n let hintVerified = false;\n let sub: string | undefined;\n let subKind: string | undefined;\n let sessionId: string | undefined;\n let hintRealmId: string | undefined;\n let audiences: string[] = [];\n\n if (data.id_token_hint) {\n try {\n // Signature + kind are the anchors; exp is skipped (a logout hint\n // is routinely expired) and the cache blocklist is irrelevant.\n const payload = await this.tokenVerifier.verify(data.id_token_hint, {\n ignoreExpiry: true,\n skipActiveCheck: true,\n });\n\n // MUST be an id_token — access/refresh tokens also carry\n // session_id, so accepting them would let a leaked access token\n // act as a logout weapon.\n if (payload.kind === OAuth2TokenKind.ID_TOKEN && this.isWithinHintGraceWindow(payload)) {\n hintVerified = true;\n sub = payload.sub;\n subKind = payload.sub_kind;\n sessionId = payload.sid ?? payload.session_id ?? undefined;\n hintRealmId = payload.realm_id ?? undefined;\n // aud may be a single string or an array (JWT spec).\n const { aud } = payload;\n if (Array.isArray(aud)) {\n audiences = aud.filter((entry): entry is string => typeof entry === 'string');\n } else if (typeof aud === 'string') {\n audiences = [aud];\n }\n }\n } catch {\n // forged / unverifiable hint → stays unverified (no revoke)\n }\n }\n\n // Resolve a single client for the aud cross-check and redirect\n // validation: the request's client_id, else the hint's sole audience\n // (ambiguous for a multi-aud hint).\n const clientId = data.client_id ?? (audiences.length === 1 ? audiences[0] : undefined);\n\n let client: Client | null = null;\n if (clientId) {\n // Scope a name-identified client to the request's realm hint; a\n // VERIFIED hint's own realm claim serves as fallback (claims from an\n // unverified hint are never trusted). No master fallback here\n // (unlike /token): a bogus hint must NOT silently resolve a\n // same-named client in master → null realm.\n const realmKey = data.realm_id ?? data.realm_name ?? (hintVerified ? hintRealmId : undefined);\n const realm = await this.realmRepository.resolve(realmKey, false);\n\n // Fail closed instead of dropping the realm predicate: a supplied\n // realm key that does not resolve never degrades to an unscoped\n // lookup, and a NAME-form client_id without any realm key is\n // ambiguous (every realm has a built-in `web` client — same rule as\n // the /authorize verifier). A UUID is globally unique and needs no\n // scope; the sole-aud-derived clientId is always a UUID.\n if (realm) {\n client = await this.clientRepository.findOneByIdOrName(clientId, realm.id);\n } else if (!realmKey && isUUID(clientId)) {\n client = await this.clientRepository.findOneByIdOrName(clientId);\n }\n }\n\n // aud/client_id cross-check: when the request supplies a client_id on a\n // verified hint, it MUST denote one of the hint's audiences. The aud is\n // the client UUID, so a name-form client_id is compared via its resolved\n // client's id. Fail closed: an aud-less hint, or a name that did not\n // resolve, counts as unverified.\n if (hintVerified && data.client_id) {\n const expected = isUUID(data.client_id) ? data.client_id : client?.id;\n if (audiences.length === 0 || !expected || !audiences.includes(expected)) {\n hintVerified = false;\n sub = undefined;\n subKind = undefined;\n sessionId = undefined;\n }\n }\n\n let clientName: string | undefined;\n let redirectUri: string | undefined;\n\n // Redirect validation is independent of hint verification — the\n // click-gated confirm page (unverified hint / hint-less request) still\n // honors a registered post-logout redirect.\n if (client) {\n clientName = client.name;\n if (\n data.post_logout_redirect_uri &&\n this.isValidPostLogoutRedirect(client.post_logout_redirect_uri, data.post_logout_redirect_uri)\n ) {\n redirectUri = data.post_logout_redirect_uri;\n }\n }\n\n return {\n hintVerified,\n ...(hintVerified ? {\n sub,\n subKind,\n sessionId,\n } : {}),\n ...(clientId ? { clientId } : {}),\n ...(clientName ? { clientName } : {}),\n ...(redirectUri ? { redirectUri, ...(data.state ? { state: data.state } : {}) } : {}),\n };\n }\n\n async revoke(sessionId: string, sub: string, subKind: string): Promise<boolean> {\n const session = await this.sessionManager.findOneById(sessionId);\n if (!session) {\n return false;\n }\n\n // Never revoke a session that does not belong to the hint's subject.\n if (session.sub !== sub || session.sub_kind !== subKind) {\n return false;\n }\n\n await this.sessionManager.revoke(sessionId);\n\n await this.eventService?.record({\n scope: EventScope.OAUTH2,\n name: EventName.LOGOUT,\n refType: EventRefType.SESSION,\n refId: sessionId,\n actorType: session.sub_kind as `${IdentityType}`,\n actorId: session.sub,\n realmId: session.realm_id,\n data: { revoked_session_id: sessionId },\n });\n\n return true;\n }\n\n /**\n * With a positive `hintGracePeriod`, an expired hint is honored only within\n * the window past `exp` — beyond it a leaked id_token stops being a\n * replayable remote logout (the hint counts as unverified; the click-gated\n * confirm page still works). 0 keeps spec/Keycloak parity: any expired hint.\n */\n protected isWithinHintGraceWindow(payload: OAuth2TokenPayload): boolean {\n if (this.hintGracePeriod <= 0) {\n return true;\n }\n\n // a bounded window without an exp claim to judge against fails closed\n if (typeof payload.exp !== 'number') {\n return false;\n }\n\n const nowSeconds = Math.floor(Date.now() / 1000);\n return nowSeconds - payload.exp <= this.hintGracePeriod;\n }\n\n /**\n * A post-logout redirect is honored only when it is an absolute http(s) URL\n * that matches a registered client redirect pattern (defense against open\n * redirects to attacker-controlled URLs).\n */\n protected isValidPostLogoutRedirect(\n registered: string | null | undefined,\n candidate: string,\n ): boolean {\n let parsed: URL;\n try {\n parsed = new URL(candidate);\n } catch {\n return false;\n }\n\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n return false;\n }\n\n if (!registered) {\n return false;\n }\n\n return isSimpleMatch(candidate, registered.split(','));\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IRealmRepository } from '../../entities/index.ts';
|
|
1
|
+
import type { IEventService, IRealmRepository } from '../../entities/index.ts';
|
|
2
2
|
import type { ISessionManager } from '../../authentication/index.ts';
|
|
3
3
|
import type { IOAuth2ClientRepository } from '../client/index.ts';
|
|
4
4
|
import type { IOAuth2TokenVerifier } from '../token/index.ts';
|
|
@@ -33,6 +33,7 @@ export type OAuth2EndSessionServiceContext = {
|
|
|
33
33
|
sessionManager: ISessionManager;
|
|
34
34
|
clientRepository: IOAuth2ClientRepository;
|
|
35
35
|
realmRepository: IRealmRepository;
|
|
36
|
+
eventService?: IEventService;
|
|
36
37
|
/**
|
|
37
38
|
* Seconds past its `exp` an (expired) id_token_hint is still accepted for
|
|
38
39
|
* a server-side revoke (config `endSessionHintGracePeriod`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/end-session/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/end-session/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IACzC,aAAa,EAAE,oBAAoB,CAAC;IACpC,cAAc,EAAE,eAAe,CAAC;IAChC,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACrC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEvE;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7E"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { OAuth2TokenGrantResponse } from '@authup/specs';
|
|
2
2
|
import type { OAuth2AuthorizationCode, Session } from '@authup/core-kit';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IKeyStore } from '../../key/index.ts';
|
|
4
4
|
import type { IOAuth2OpenIDTokenIssuer, IOAuth2TokenIssuer } from '../token/index.ts';
|
|
5
5
|
import { OAuth2BaseGrant } from './base.ts';
|
|
6
6
|
import type { IOAuth2Grant, OAuth2AuthorizeGrantContext, OAuth2GrantRunWIthOptions } from './types.ts';
|
|
7
7
|
export declare class OAuth2AuthorizeGrant extends OAuth2BaseGrant<OAuth2AuthorizationCode> implements IOAuth2Grant {
|
|
8
8
|
protected refreshTokenIssuer: IOAuth2TokenIssuer;
|
|
9
9
|
protected openIdTokenIssuer: IOAuth2OpenIDTokenIssuer;
|
|
10
|
-
protected
|
|
10
|
+
protected keyStore: IKeyStore;
|
|
11
11
|
constructor(ctx: OAuth2AuthorizeGrantContext);
|
|
12
12
|
runWith(authorizationCode: OAuth2AuthorizationCode, options?: OAuth2GrantRunWIthOptions): Promise<OAuth2TokenGrantResponse>;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/authorize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGzE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/authorize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAIvG,qBAAa,oBAAqB,SAAQ,eAAe,CAAC,uBAAuB,CAAE,YAAW,YAAY;IACtG,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;IAElD,SAAS,CAAC,iBAAiB,EAAG,wBAAwB,CAAC;IAEvD,SAAS,CAAC,QAAQ,EAAG,SAAS,CAAC;gBAEnB,GAAG,EAAE,2BAA2B;IAWtC,OAAO,CACT,iBAAiB,EAAE,uBAAuB,EAC1C,OAAO,GAAE,yBAA8B,GACvC,OAAO,CAAC,wBAAwB,CAAC;IAmErC;;;;;;;;;;;;OAYG;cACa,cAAc,CAC1B,iBAAiB,EAAE,uBAAuB,EAC1C,OAAO,EAAE,yBAAyB,GAClC,OAAO,CAAC,OAAO,CAAC;CAyBvB"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { buildOAuth2TokenHash } from "../authorization/helpers.mjs";
|
|
4
|
+
import { buildOAuth2TokenHash, deriveAmrAcr } from "../authorization/helpers.mjs";
|
|
5
5
|
import { OAuth2BaseGrant } from "./base.mjs";
|
|
6
6
|
import { buildOAuth2BearerTokenResponse } from "../response/bearer.mjs";
|
|
7
7
|
import { ScopeName } from "@authup/core-kit";
|
|
8
|
-
import {
|
|
8
|
+
import { JWKUse, hasOAuth2Scopes } from "@authup/specs";
|
|
9
9
|
//#region src/core/oauth2/grant-types/authorize.ts
|
|
10
10
|
var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
11
11
|
refreshTokenIssuer;
|
|
12
12
|
openIdTokenIssuer;
|
|
13
|
-
|
|
13
|
+
keyStore;
|
|
14
14
|
constructor(ctx) {
|
|
15
15
|
super({
|
|
16
16
|
accessTokenIssuer: ctx.accessTokenIssuer,
|
|
@@ -18,10 +18,11 @@ var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
|
18
18
|
});
|
|
19
19
|
this.refreshTokenIssuer = ctx.refreshTokenIssuer;
|
|
20
20
|
this.openIdTokenIssuer = ctx.openIdTokenIssuer;
|
|
21
|
-
this.
|
|
21
|
+
this.keyStore = ctx.keyStore;
|
|
22
22
|
}
|
|
23
23
|
async runWith(authorizationCode, options = {}) {
|
|
24
24
|
const session = await this.resolveSession(authorizationCode, options);
|
|
25
|
+
const amrAcr = deriveAmrAcr(session);
|
|
25
26
|
const issuePayload = {
|
|
26
27
|
user_agent: options.userAgent,
|
|
27
28
|
remote_address: options.ipAddress,
|
|
@@ -31,7 +32,9 @@ var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
|
31
32
|
realm_id: authorizationCode.realm_id,
|
|
32
33
|
realm_name: authorizationCode.realm_name,
|
|
33
34
|
scope: authorizationCode.scope || void 0,
|
|
34
|
-
client_id: authorizationCode.client_id || void 0
|
|
35
|
+
client_id: authorizationCode.client_id || void 0,
|
|
36
|
+
...options.confirmation ? { cnf: options.confirmation } : {},
|
|
37
|
+
...amrAcr
|
|
35
38
|
};
|
|
36
39
|
const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);
|
|
37
40
|
const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);
|
|
@@ -42,8 +45,7 @@ var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
|
42
45
|
refreshTokenPayload
|
|
43
46
|
};
|
|
44
47
|
if (authorizationCode.scope && hasOAuth2Scopes(authorizationCode.scope, ScopeName.OPEN_ID)) {
|
|
45
|
-
const key = await this.
|
|
46
|
-
if (!key) throw JWKError.notFoundForRealm(authorizationCode.realm_id, authorizationCode.realm_name);
|
|
48
|
+
const key = await this.keyStore.resolveOrCreate(authorizationCode.realm_id, JWKUse.SIGNATURE);
|
|
47
49
|
const [idToken] = await this.openIdTokenIssuer.issue({
|
|
48
50
|
sub: authorizationCode.sub || void 0,
|
|
49
51
|
sub_kind: authorizationCode.sub_kind,
|
|
@@ -53,6 +55,7 @@ var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
|
53
55
|
client_id: authorizationCode.client_id || void 0,
|
|
54
56
|
...authorizationCode.nonce ? { nonce: authorizationCode.nonce } : {},
|
|
55
57
|
...typeof authorizationCode.auth_time === "number" ? { auth_time: authorizationCode.auth_time } : {},
|
|
58
|
+
...amrAcr,
|
|
56
59
|
sid: session.id,
|
|
57
60
|
at_hash: await buildOAuth2TokenHash(accessToken, key.signature_algorithm)
|
|
58
61
|
});
|
|
@@ -86,7 +89,8 @@ var OAuth2AuthorizeGrant = class extends OAuth2BaseGrant {
|
|
|
86
89
|
realm_id: authorizationCode.realm_id,
|
|
87
90
|
client_id: authorizationCode.client_id,
|
|
88
91
|
sub_kind: authorizationCode.sub_kind,
|
|
89
|
-
sub: authorizationCode.sub
|
|
92
|
+
sub: authorizationCode.sub,
|
|
93
|
+
auth_method: authorizationCode.auth_method ?? null
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.mjs","names":["
|
|
1
|
+
{"version":3,"file":"authorize.mjs","names":["JWKUse","hasOAuth2Scopes","ScopeName","buildOAuth2TokenHash","deriveAmrAcr","OAuth2BaseGrant","buildOAuth2BearerTokenResponse","OAuth2AuthorizeGrant","refreshTokenIssuer","openIdTokenIssuer","keyStore","ctx","accessTokenIssuer","sessionManager","runWith","authorizationCode","options","session","resolveSession","amrAcr","issuePayload","user_agent","userAgent","remote_address","ipAddress","session_id","id","sub","undefined","sub_kind","realm_id","realm_name","scope","client_id","confirmation","cnf","accessToken","accessTokenPayload","issue","refreshToken","refreshTokenPayload","buildContext","OPEN_ID","key","resolveOrCreate","SIGNATURE","idToken","nonce","auth_time","sid","at_hash","signature_algorithm","existing","findOneById","refresh","create","ip_address","auth_method"],"sources":["../../../../src/core/oauth2/grant-types/authorize.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse, OAuth2TokenPayload } from '@authup/specs';\nimport { JWKUse, hasOAuth2Scopes } from '@authup/specs';\nimport type { OAuth2AuthorizationCode, Session } from '@authup/core-kit';\nimport { ScopeName } from '@authup/core-kit';\nimport { buildOAuth2TokenHash, deriveAmrAcr } from '../authorization/helpers.ts';\nimport type { IKeyStore } from '../../key/index.ts';\nimport type { IOAuth2OpenIDTokenIssuer, IOAuth2TokenIssuer } from '../token/index.ts';\nimport { OAuth2BaseGrant } from './base.ts';\nimport type { IOAuth2Grant, OAuth2AuthorizeGrantContext, OAuth2GrantRunWIthOptions } from './types.ts';\nimport type { OAuth2BearerResponseBuildContext } from '../response/index.ts';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\n\nexport class OAuth2AuthorizeGrant extends OAuth2BaseGrant<OAuth2AuthorizationCode> implements IOAuth2Grant {\n protected refreshTokenIssuer : IOAuth2TokenIssuer;\n\n protected openIdTokenIssuer : IOAuth2OpenIDTokenIssuer;\n\n protected keyStore : IKeyStore;\n\n constructor(ctx: OAuth2AuthorizeGrantContext) {\n super({\n accessTokenIssuer: ctx.accessTokenIssuer,\n sessionManager: ctx.sessionManager,\n });\n\n this.refreshTokenIssuer = ctx.refreshTokenIssuer;\n this.openIdTokenIssuer = ctx.openIdTokenIssuer;\n this.keyStore = ctx.keyStore;\n }\n\n async runWith(\n authorizationCode: OAuth2AuthorizationCode,\n options: OAuth2GrantRunWIthOptions = {},\n ) : Promise<OAuth2TokenGrantResponse> {\n const session = await this.resolveSession(authorizationCode, options);\n\n // amr/acr derive from the RESOLVED session (auth_method + mfa_at) —\n // deliberately on every token kind, not only the id_token, so\n // resource servers can read the method without parsing an id_token.\n const amrAcr = deriveAmrAcr(session);\n\n const issuePayload : Partial<OAuth2TokenPayload> = {\n user_agent: options.userAgent,\n remote_address: options.ipAddress,\n session_id: session.id,\n sub: authorizationCode.sub || undefined,\n sub_kind: authorizationCode.sub_kind,\n realm_id: authorizationCode.realm_id,\n realm_name: authorizationCode.realm_name,\n scope: authorizationCode.scope || undefined,\n client_id: authorizationCode.client_id || undefined,\n ...(options.confirmation ? { cnf: options.confirmation } : {}),\n ...amrAcr,\n };\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);\n const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);\n\n const buildContext : OAuth2BearerResponseBuildContext = {\n accessToken,\n accessTokenPayload,\n refreshToken,\n refreshTokenPayload,\n };\n\n // The id_token is minted HERE — after resolveSession — so its `sid`\n // references the real backing session for the reuse branch, the\n // fallback branch, and session-less (federated IdP) codes alike.\n // `auth_time` is the authentication instant captured on the code.\n if (\n authorizationCode.scope &&\n hasOAuth2Scopes(authorizationCode.scope, ScopeName.OPEN_ID)\n ) {\n // The at_hash digest follows the id_token's JWS alg (OIDC Core\n // §3.1.3.6) — the alg of the realm key the openid issuer signs\n // with. The access token above was signed with the same key, so a\n // missing key would already have thrown; this resolves the same\n // active key.\n const key = await this.keyStore.resolveOrCreate(authorizationCode.realm_id, JWKUse.SIGNATURE);\n\n const [idToken] = await this.openIdTokenIssuer.issue({\n sub: authorizationCode.sub || undefined,\n sub_kind: authorizationCode.sub_kind,\n realm_id: authorizationCode.realm_id,\n realm_name: authorizationCode.realm_name,\n scope: authorizationCode.scope || undefined,\n client_id: authorizationCode.client_id || undefined,\n ...(authorizationCode.nonce ? { nonce: authorizationCode.nonce } : {}),\n ...(typeof authorizationCode.auth_time === 'number' ? { auth_time: authorizationCode.auth_time } : {}),\n ...amrAcr,\n sid: session.id,\n at_hash: await buildOAuth2TokenHash(accessToken, key.signature_algorithm),\n });\n\n buildContext.idToken = idToken;\n }\n\n return buildOAuth2BearerTokenResponse(buildContext);\n }\n\n /**\n * Reuse the bearer's session when the authorization code was issued from an\n * (interactive) `/authorize` request that carried one — otherwise the\n * interactive login would create a second session (the abandoned bearer\n * session that authenticated `POST /authorize`, plus this one).\n *\n * The reuse is gated on the session still existing and belonging to the\n * same subject/realm as the code (defense in depth — the id is\n * server-derived from the authenticated bearer, never client input). Any\n * mismatch, or a session-less authorize flow (external IdP, non-interactive\n * clients), falls back to creating a fresh session — preserving prior\n * behavior.\n */\n protected async resolveSession(\n authorizationCode: OAuth2AuthorizationCode,\n options: OAuth2GrantRunWIthOptions,\n ) : Promise<Session> {\n if (authorizationCode.session_id) {\n const existing = await this.sessionManager.findOneById(authorizationCode.session_id);\n if (\n existing &&\n existing.sub === authorizationCode.sub &&\n existing.sub_kind === authorizationCode.sub_kind &&\n existing.realm_id === authorizationCode.realm_id\n ) {\n existing.client_id = authorizationCode.client_id || null;\n\n return this.sessionManager.refresh(existing);\n }\n }\n\n return this.sessionManager.create({\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: authorizationCode.realm_id,\n client_id: authorizationCode.client_id,\n sub_kind: authorizationCode.sub_kind,\n sub: authorizationCode.sub,\n auth_method: authorizationCode.auth_method ?? null,\n });\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,IAAaO,uBAAb,cAA0CF,gBAAAA;CAC5BG;CAEAC;CAEAC;CAEV,YAAYC,KAAkC;EAC1C,MAAM;GACFC,mBAAmBD,IAAIC;GACvBC,gBAAgBF,IAAIE;EACxB,CAAA;EAEA,KAAKL,qBAAqBG,IAAIH;EAC9B,KAAKC,oBAAoBE,IAAIF;EAC7B,KAAKC,WAAWC,IAAID;CACxB;CAEA,MAAMI,QACFC,mBACAC,UAAqC,CAAC,GACJ;EAClC,MAAMC,UAAU,MAAM,KAAKC,eAAeH,mBAAmBC,OAAAA;EAK7D,MAAMG,SAASf,aAAaa,OAAAA;EAE5B,MAAMG,eAA6C;GAC/CC,YAAYL,QAAQM;GACpBC,gBAAgBP,QAAQQ;GACxBC,YAAYR,QAAQS;GACpBC,KAAKZ,kBAAkBY,OAAOC,KAAAA;GAC9BC,UAAUd,kBAAkBc;GAC5BC,UAAUf,kBAAkBe;GAC5BC,YAAYhB,kBAAkBgB;GAC9BC,OAAOjB,kBAAkBiB,SAASJ,KAAAA;GAClCK,WAAWlB,kBAAkBkB,aAAaL,KAAAA;GAC1C,GAAIZ,QAAQkB,eAAe,EAAEC,KAAKnB,QAAQkB,aAAa,IAAI,CAAC;GAC5D,GAAGf;EACP;EAEA,MAAM,CAACiB,aAAaC,sBAAsB,MAAM,KAAKzB,kBAAkB0B,MAAMlB,YAAAA;EAC7E,MAAM,CAACmB,cAAcC,uBAAuB,MAAM,KAAKhC,mBAAmB8B,MAAMlB,YAAAA;EAEhF,MAAMqB,eAAkD;GACpDL;GACAC;GACAE;GACAC;EACJ;EAMA,IACIzB,kBAAkBiB,SAClB/B,gBAAgBc,kBAAkBiB,OAAO9B,UAAUwC,OAAO,GAC5D;GAME,MAAMC,MAAM,MAAM,KAAKjC,SAASkC,gBAAgB7B,kBAAkBe,UAAU9B,OAAO6C,SAAS;GAE5F,MAAM,CAACC,WAAW,MAAM,KAAKrC,kBAAkB6B,MAAM;IACjDX,KAAKZ,kBAAkBY,OAAOC,KAAAA;IAC9BC,UAAUd,kBAAkBc;IAC5BC,UAAUf,kBAAkBe;IAC5BC,YAAYhB,kBAAkBgB;IAC9BC,OAAOjB,kBAAkBiB,SAASJ,KAAAA;IAClCK,WAAWlB,kBAAkBkB,aAAaL,KAAAA;IAC1C,GAAIb,kBAAkBgC,QAAQ,EAAEA,OAAOhC,kBAAkBgC,MAAM,IAAI,CAAC;IACpE,GAAI,OAAOhC,kBAAkBiC,cAAc,WAAW,EAAEA,WAAWjC,kBAAkBiC,UAAU,IAAI,CAAC;IACpG,GAAG7B;IACH8B,KAAKhC,QAAQS;IACbwB,SAAS,MAAM/C,qBAAqBiC,aAAaO,IAAIQ,mBAAmB;GAC5E,CAAA;GAEAV,aAAaK,UAAUA;EAC3B;EAEA,OAAOxC,+BAA+BmC,YAAAA;CAC1C;;;;;;;;;;;;;IAeA,MAAgBvB,eACZH,mBACAC,SACiB;EACjB,IAAID,kBAAkBU,YAAY;GAC9B,MAAM2B,WAAW,MAAM,KAAKvC,eAAewC,YAAYtC,kBAAkBU,UAAU;GACnF,IACI2B,YACAA,SAASzB,QAAQZ,kBAAkBY,OACnCyB,SAASvB,aAAad,kBAAkBc,YACxCuB,SAAStB,aAAaf,kBAAkBe,UAC1C;IACEsB,SAASnB,YAAYlB,kBAAkBkB,aAAa;IAEpD,OAAO,KAAKpB,eAAeyC,QAAQF,QAAAA;GACvC;EACJ;EAEA,OAAO,KAAKvC,eAAe0C,OAAO;GAC9BlC,YAAYL,QAAQM;GACpBkC,YAAYxC,QAAQQ;GACpBM,UAAUf,kBAAkBe;GAC5BG,WAAWlB,kBAAkBkB;GAC7BJ,UAAUd,kBAAkBc;GAC5BF,KAAKZ,kBAAkBY;GACvB8B,aAAa1C,kBAAkB0C,eAAe;EAClD,CAAA;CACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/client-credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"client-credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/client-credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM/C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,qBAAa,sBAAuB,SAAQ,eAAe,CAAC,MAAM,CAAC;IACzD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,yBAA8B,GAAI,OAAO,CAAC,wBAAwB,CAAC;CA4B5G"}
|
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { OAuth2BaseGrant } from "./base.mjs";
|
|
5
5
|
import { buildOAuth2BearerTokenResponse } from "../response/bearer.mjs";
|
|
6
|
-
import { IdentityType, ScopeName } from "@authup/core-kit";
|
|
6
|
+
import { IdentityType, ScopeName, SessionAuthMethod } from "@authup/core-kit";
|
|
7
7
|
import { OAuth2SubKind } from "@authup/specs";
|
|
8
8
|
//#region src/core/oauth2/grant-types/client-credentials.ts
|
|
9
9
|
var ClientCredentialsGrant = class extends OAuth2BaseGrant {
|
|
@@ -13,7 +13,8 @@ var ClientCredentialsGrant = class extends OAuth2BaseGrant {
|
|
|
13
13
|
ip_address: options.ipAddress,
|
|
14
14
|
realm_id: input.realm_id,
|
|
15
15
|
sub: input.id,
|
|
16
|
-
sub_kind: IdentityType.CLIENT
|
|
16
|
+
sub_kind: IdentityType.CLIENT,
|
|
17
|
+
auth_method: SessionAuthMethod.CLIENT
|
|
17
18
|
});
|
|
18
19
|
const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue({
|
|
19
20
|
user_agent: session.user_agent,
|
|
@@ -24,7 +25,8 @@ var ClientCredentialsGrant = class extends OAuth2BaseGrant {
|
|
|
24
25
|
sub_kind: OAuth2SubKind.CLIENT,
|
|
25
26
|
realm_id: input.realm.id,
|
|
26
27
|
realm_name: input.realm.name,
|
|
27
|
-
client_id: input.id
|
|
28
|
+
client_id: input.id,
|
|
29
|
+
...options.confirmation ? { cnf: options.confirmation } : {}
|
|
28
30
|
});
|
|
29
31
|
return buildOAuth2BearerTokenResponse({
|
|
30
32
|
accessToken,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-credentials.mjs","names":["OAuth2SubKind","IdentityType","ScopeName","OAuth2BaseGrant","buildOAuth2BearerTokenResponse","ClientCredentialsGrant","runWith","input","options","session","sessionManager","create","user_agent","userAgent","ip_address","ipAddress","realm_id","sub","id","sub_kind","CLIENT","accessToken","accessTokenPayload","accessTokenIssuer","issue","remote_address","session_id","scope","GLOBAL","realm","realm_name","name","client_id"],"sources":["../../../../src/core/oauth2/grant-types/client-credentials.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { Client } from '@authup/core-kit';\nimport {\n IdentityType,\n ScopeName,\n} from '@authup/core-kit';\nimport { OAuth2BaseGrant } from './base.ts';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { OAuth2GrantRunWIthOptions } from './types.ts';\n\nexport class ClientCredentialsGrant extends OAuth2BaseGrant<Client> {\n async runWith(input: Client, options: OAuth2GrantRunWIthOptions = {}) : Promise<OAuth2TokenGrantResponse> {\n const session = await this.sessionManager.create({\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: input.realm_id,\n sub: input.id,\n sub_kind: IdentityType.CLIENT,\n });\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue({\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n session_id: session.id,\n scope: ScopeName.GLOBAL,\n sub: input.id,\n sub_kind: OAuth2SubKind.CLIENT,\n realm_id: input.realm.id,\n realm_name: input.realm.name,\n client_id: input.id,\n });\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n });\n }\n}\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"client-credentials.mjs","names":["OAuth2SubKind","IdentityType","ScopeName","SessionAuthMethod","OAuth2BaseGrant","buildOAuth2BearerTokenResponse","ClientCredentialsGrant","runWith","input","options","session","sessionManager","create","user_agent","userAgent","ip_address","ipAddress","realm_id","sub","id","sub_kind","CLIENT","auth_method","accessToken","accessTokenPayload","accessTokenIssuer","issue","remote_address","session_id","scope","GLOBAL","realm","realm_name","name","client_id","confirmation","cnf"],"sources":["../../../../src/core/oauth2/grant-types/client-credentials.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { Client } from '@authup/core-kit';\nimport {\n IdentityType,\n ScopeName, \n SessionAuthMethod,\n} from '@authup/core-kit';\nimport { OAuth2BaseGrant } from './base.ts';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { OAuth2GrantRunWIthOptions } from './types.ts';\n\nexport class ClientCredentialsGrant extends OAuth2BaseGrant<Client> {\n async runWith(input: Client, options: OAuth2GrantRunWIthOptions = {}) : Promise<OAuth2TokenGrantResponse> {\n const session = await this.sessionManager.create({\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: input.realm_id,\n sub: input.id,\n sub_kind: IdentityType.CLIENT,\n auth_method: SessionAuthMethod.CLIENT,\n });\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue({\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n session_id: session.id,\n scope: ScopeName.GLOBAL,\n sub: input.id,\n sub_kind: OAuth2SubKind.CLIENT,\n realm_id: input.realm.id,\n realm_name: input.realm.name,\n client_id: input.id,\n ...(options.confirmation ? { cnf: options.confirmation } : {}),\n });\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n });\n }\n}\n"],"mappings":";;;;;;;;AAmBA,IAAaM,yBAAb,cAA4CF,gBAAAA;CACxC,MAAMG,QAAQC,OAAeC,UAAqC,CAAC,GAAuC;EACtG,MAAMC,UAAU,MAAM,KAAKC,eAAeC,OAAO;GAC7CC,YAAYJ,QAAQK;GACpBC,YAAYN,QAAQO;GACpBC,UAAUT,MAAMS;GAChBC,KAAKV,MAAMW;GACXC,UAAUnB,aAAaoB;GACvBC,aAAanB,kBAAkBkB;EACnC,CAAA;EAEA,MAAM,CAACE,aAAaC,sBAAsB,MAAM,KAAKC,kBAAkBC,MAAM;GACzEb,YAAYH,QAAQG;GACpBc,gBAAgBjB,QAAQK;GACxBa,YAAYlB,QAAQS;GACpBU,OAAO3B,UAAU4B;GACjBZ,KAAKV,MAAMW;GACXC,UAAUpB,cAAcqB;GACxBJ,UAAUT,MAAMuB,MAAMZ;GACtBa,YAAYxB,MAAMuB,MAAME;GACxBC,WAAW1B,MAAMW;GACjB,GAAIV,QAAQ0B,eAAe,EAAEC,KAAK3B,QAAQ0B,aAAa,IAAI,CAAC;EAChE,CAAA;EAEA,OAAO9B,+BAA+B;GAClCkB;GACAC;EACJ,CAAA;CACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/identity.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/identity.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC5D,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;gBAEtC,GAAG,EAAE,0BAA0B;IASrC,OAAO,CACT,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,yBAA8B,GACxC,OAAO,CAAC,wBAAwB,CAAC;CA0CvC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { deriveAmrAcr } from "../authorization/helpers.mjs";
|
|
4
5
|
import { OAuth2BaseGrant } from "./base.mjs";
|
|
5
6
|
import { buildOAuth2BearerTokenResponse } from "../response/bearer.mjs";
|
|
6
|
-
import { ScopeName } from "@authup/core-kit";
|
|
7
|
+
import { ScopeName, SessionAuthMethod } from "@authup/core-kit";
|
|
7
8
|
//#region src/core/oauth2/grant-types/identity.ts
|
|
8
9
|
var IdentityGrantType = class extends OAuth2BaseGrant {
|
|
9
10
|
refreshTokenIssuer;
|
|
@@ -20,9 +21,14 @@ var IdentityGrantType = class extends OAuth2BaseGrant {
|
|
|
20
21
|
ip_address: options.ipAddress,
|
|
21
22
|
realm_id: identity.data.realm_id,
|
|
22
23
|
sub: identity.data.id,
|
|
23
|
-
sub_kind: identity.type
|
|
24
|
+
sub_kind: identity.type,
|
|
25
|
+
auth_method: SessionAuthMethod.EXTERNAL
|
|
24
26
|
};
|
|
25
27
|
const { id: sessionId } = await this.sessionManager.create(session);
|
|
28
|
+
const amrAcr = deriveAmrAcr({
|
|
29
|
+
auth_method: session.auth_method ?? null,
|
|
30
|
+
mfa_at: session.mfa_at ?? null
|
|
31
|
+
});
|
|
26
32
|
const issuePayload = {
|
|
27
33
|
session_id: sessionId,
|
|
28
34
|
user_agent: session.user_agent,
|
|
@@ -31,7 +37,8 @@ var IdentityGrantType = class extends OAuth2BaseGrant {
|
|
|
31
37
|
realm_id: identity.data.realm_id,
|
|
32
38
|
realm_name: identity.data.realm?.name,
|
|
33
39
|
sub: identity.data.id,
|
|
34
|
-
sub_kind: identity.type
|
|
40
|
+
sub_kind: identity.type,
|
|
41
|
+
...amrAcr
|
|
35
42
|
};
|
|
36
43
|
const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);
|
|
37
44
|
const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.mjs","names":["ScopeName","OAuth2BaseGrant","buildOAuth2BearerTokenResponse","IdentityGrantType","refreshTokenIssuer","ctx","accessTokenIssuer","sessionManager","runWith","identity","options","session","user_agent","userAgent","ip_address","ipAddress","realm_id","data","sub","id","sub_kind","type","sessionId","create","issuePayload","session_id","remote_address","scope","GLOBAL","realm_name","realm","name","accessToken","accessTokenPayload","issue","refreshToken","refreshTokenPayload"],"sources":["../../../../src/core/oauth2/grant-types/identity.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse, OAuth2TokenPayload } from '@authup/specs';\nimport type { Identity, Session } from '@authup/core-kit';\nimport { ScopeName } from '@authup/core-kit';\nimport type { IOAuth2TokenIssuer } from '../token/index.ts';\nimport { OAuth2BaseGrant } from './base.ts';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { OAuth2GrantRunWIthOptions, OAuth2IdentityGrantContext } from './types.ts';\n\nexport class IdentityGrantType extends OAuth2BaseGrant<Identity> {\n protected refreshTokenIssuer : IOAuth2TokenIssuer;\n\n constructor(ctx: OAuth2IdentityGrantContext) {\n super({\n accessTokenIssuer: ctx.accessTokenIssuer,\n sessionManager: ctx.sessionManager,\n });\n\n this.refreshTokenIssuer = ctx.refreshTokenIssuer;\n }\n\n async runWith(\n identity: Identity,\n options: OAuth2GrantRunWIthOptions = {},\n ): Promise<OAuth2TokenGrantResponse> {\n const session : Partial<Session> = {\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: identity.data.realm_id,\n sub: identity.data.id,\n sub_kind: identity.type,\n };\n\n const { id: sessionId } = await this.sessionManager.create(session);\n\n const issuePayload : Partial<OAuth2TokenPayload> = {\n session_id: sessionId,\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n scope: ScopeName.GLOBAL,\n realm_id: identity.data.realm_id,\n realm_name: identity.data.realm?.name,\n sub: identity.data.id,\n sub_kind: identity.type,\n };\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);\n const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n refreshToken,\n refreshTokenPayload,\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"identity.mjs","names":["ScopeName","SessionAuthMethod","OAuth2BaseGrant","deriveAmrAcr","buildOAuth2BearerTokenResponse","IdentityGrantType","refreshTokenIssuer","ctx","accessTokenIssuer","sessionManager","runWith","identity","options","session","user_agent","userAgent","ip_address","ipAddress","realm_id","data","sub","id","sub_kind","type","auth_method","EXTERNAL","sessionId","create","amrAcr","mfa_at","issuePayload","session_id","remote_address","scope","GLOBAL","realm_name","realm","name","accessToken","accessTokenPayload","issue","refreshToken","refreshTokenPayload"],"sources":["../../../../src/core/oauth2/grant-types/identity.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse, OAuth2TokenPayload } from '@authup/specs';\nimport type { Identity, Session } from '@authup/core-kit';\nimport { ScopeName, SessionAuthMethod } from '@authup/core-kit';\nimport type { IOAuth2TokenIssuer } from '../token/index.ts';\nimport { OAuth2BaseGrant } from './base.ts';\nimport { deriveAmrAcr } from '../authorization/helpers.ts';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { OAuth2GrantRunWIthOptions, OAuth2IdentityGrantContext } from './types.ts';\n\nexport class IdentityGrantType extends OAuth2BaseGrant<Identity> {\n protected refreshTokenIssuer : IOAuth2TokenIssuer;\n\n constructor(ctx: OAuth2IdentityGrantContext) {\n super({\n accessTokenIssuer: ctx.accessTokenIssuer,\n sessionManager: ctx.sessionManager,\n });\n\n this.refreshTokenIssuer = ctx.refreshTokenIssuer;\n }\n\n async runWith(\n identity: Identity,\n options: OAuth2GrantRunWIthOptions = {},\n ): Promise<OAuth2TokenGrantResponse> {\n const session : Partial<Session> = {\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: identity.data.realm_id,\n sub: identity.data.id,\n sub_kind: identity.type,\n auth_method: SessionAuthMethod.EXTERNAL,\n };\n\n const { id: sessionId } = await this.sessionManager.create(session);\n\n // amr/acr derive from the session's auth_method + mfa_at — deliberately\n // on every token kind, so a direct identity grant's tokens advertise the\n // (external) method the same way the authorization_code exchange does.\n const amrAcr = deriveAmrAcr({\n auth_method: session.auth_method ?? null,\n mfa_at: session.mfa_at ?? null,\n });\n\n const issuePayload : Partial<OAuth2TokenPayload> = {\n session_id: sessionId,\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n scope: ScopeName.GLOBAL,\n realm_id: identity.data.realm_id,\n realm_name: identity.data.realm?.name,\n sub: identity.data.id,\n sub_kind: identity.type,\n ...amrAcr,\n };\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);\n const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n refreshToken,\n refreshTokenPayload,\n });\n }\n}\n"],"mappings":";;;;;;;;AAgBA,IAAaK,oBAAb,cAAuCH,gBAAAA;CACzBI;CAEV,YAAYC,KAAiC;EACzC,MAAM;GACFC,mBAAmBD,IAAIC;GACvBC,gBAAgBF,IAAIE;EACxB,CAAA;EAEA,KAAKH,qBAAqBC,IAAID;CAClC;CAEA,MAAMI,QACFC,UACAC,UAAqC,CAAC,GACL;EACjC,MAAMC,UAA6B;GAC/BC,YAAYF,QAAQG;GACpBC,YAAYJ,QAAQK;GACpBC,UAAUP,SAASQ,KAAKD;GACxBE,KAAKT,SAASQ,KAAKE;GACnBC,UAAUX,SAASY;GACnBC,aAAavB,kBAAkBwB;EACnC;EAEA,MAAM,EAAEJ,IAAIK,cAAc,MAAM,KAAKjB,eAAekB,OAAOd,OAAAA;EAK3D,MAAMe,SAASzB,aAAa;GACxBqB,aAAaX,QAAQW,eAAe;GACpCK,QAAQhB,QAAQgB,UAAU;EAC9B,CAAA;EAEA,MAAMC,eAA6C;GAC/CC,YAAYL;GACZZ,YAAYD,QAAQC;GACpBkB,gBAAgBnB,QAAQG;GACxBiB,OAAOjC,UAAUkC;GACjBhB,UAAUP,SAASQ,KAAKD;GACxBiB,YAAYxB,SAASQ,KAAKiB,OAAOC;GACjCjB,KAAKT,SAASQ,KAAKE;GACnBC,UAAUX,SAASY;GACnB,GAAGK;EACP;EAEA,MAAM,CAACU,aAAaC,sBAAsB,MAAM,KAAK/B,kBAAkBgC,MAAMV,YAAAA;EAC7E,MAAM,CAACW,cAAcC,uBAAuB,MAAM,KAAKpC,mBAAmBkC,MAAMV,YAAAA;EAEhF,OAAO1B,+BAA+B;GAClCkC;GACAC;GACAE;GACAC;EACJ,CAAA;CACJ;AACJ"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import type { OAuth2TokenGrantResponse } from '@authup/specs';
|
|
2
2
|
import type { Client, User } from '@authup/core-kit';
|
|
3
|
+
import type { IEventService } from '../../entities/index.ts';
|
|
4
|
+
import type { IAuthFlowMetrics } from '../../metrics/index.ts';
|
|
3
5
|
import type { IOAuth2TokenIssuer } from '../token/index.ts';
|
|
4
6
|
import { OAuth2BaseGrant } from './base.ts';
|
|
5
7
|
import type { OAuth2GrantRunWIthOptions, OAuth2PasswordGrantContext } from './types.ts';
|
|
6
8
|
export type OAuth2PasswordGrantInput = {
|
|
7
9
|
user: User;
|
|
8
10
|
client?: Client;
|
|
11
|
+
/**
|
|
12
|
+
* Instant the user passed a second-factor challenge alongside the
|
|
13
|
+
* grant (the `otp` parameter) — stamped onto the session as mfa_at.
|
|
14
|
+
*/
|
|
15
|
+
mfaVerifiedAt?: string;
|
|
9
16
|
};
|
|
10
17
|
export declare class PasswordGrantType extends OAuth2BaseGrant<OAuth2PasswordGrantInput> {
|
|
11
18
|
protected refreshTokenIssuer: IOAuth2TokenIssuer;
|
|
19
|
+
protected eventService?: IEventService;
|
|
20
|
+
protected metrics?: IAuthFlowMetrics;
|
|
12
21
|
constructor(ctx: OAuth2PasswordGrantContext);
|
|
13
22
|
runWith(input: OAuth2PasswordGrantInput, options?: OAuth2GrantRunWIthOptions): Promise<OAuth2TokenGrantResponse>;
|
|
14
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AASrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,wBAAwB,CAAC;IAC5E,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;IAElD,SAAS,CAAC,YAAY,CAAC,EAAG,aAAa,CAAC;IAExC,SAAS,CAAC,OAAO,CAAC,EAAG,gBAAgB,CAAC;gBAE1B,GAAG,EAAE,0BAA0B;IAWrC,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,GAAE,yBAA8B,GAAI,OAAO,CAAC,wBAAwB,CAAC;CA+D9H"}
|