@acorex-platform/module-security-management-server 0.0.18 → 2.0.0-next.42
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/contracts/src/AXM_USER_ACCESS_STATE_DEFINITION_KEY.js.map +1 -1
- package/contracts/src/AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY.js.map +1 -1
- package/contracts/src/ROLE_PERMISSIONS_PAGE_COMPONENT_KEY.d.ts +2 -0
- package/contracts/src/ROLE_PERMISSIONS_PAGE_COMPONENT_KEY.js +6 -0
- package/contracts/src/ROLE_PERMISSIONS_PAGE_COMPONENT_KEY.js.map +1 -0
- package/contracts/src/USER_ROLES_PAGE_COMPONENT_KEY.d.ts +1 -0
- package/contracts/src/USER_ROLES_PAGE_COMPONENT_KEY.js +5 -0
- package/contracts/src/USER_ROLES_PAGE_COMPONENT_KEY.js.map +1 -0
- package/contracts/src/create-application-role-rows.util.d.ts +15 -0
- package/contracts/src/create-application-role-rows.util.js +67 -0
- package/contracts/src/create-application-role-rows.util.js.map +1 -0
- package/contracts/src/device-session-admin-scope.d.ts +15 -0
- package/contracts/src/device-session-admin-scope.js +16 -0
- package/contracts/src/device-session-admin-scope.js.map +1 -0
- package/contracts/src/entities/device-sessions/device-sessions.entity.js +50 -1
- package/contracts/src/entities/device-sessions/device-sessions.entity.js.map +1 -1
- package/contracts/src/entities/device-sessions/device-sessions.types.d.ts +7 -0
- package/contracts/src/entities/device-sessions/device-sessions.types.js.map +1 -1
- package/contracts/src/entities/device-sessions/index.d.ts +0 -1
- package/contracts/src/entities/device-sessions/index.js +0 -1
- package/contracts/src/entities/device-sessions/index.js.map +1 -1
- package/contracts/src/entities/identity-provider/identity-provider.entity.d.ts +2 -0
- package/contracts/src/entities/identity-provider/identity-provider.entity.js +453 -0
- package/contracts/src/entities/identity-provider/identity-provider.entity.js.map +1 -0
- package/contracts/src/entities/identity-provider/identity-provider.types.d.ts +61 -0
- package/contracts/src/entities/identity-provider/identity-provider.types.js +14 -0
- package/contracts/src/entities/identity-provider/identity-provider.types.js.map +1 -0
- package/contracts/src/entities/identity-provider/index.d.ts +1 -0
- package/contracts/src/entities/identity-provider/index.js +5 -0
- package/contracts/src/entities/identity-provider/index.js.map +1 -0
- package/contracts/src/entities/index.d.ts +4 -0
- package/contracts/src/entities/index.js +4 -0
- package/contracts/src/entities/index.js.map +1 -1
- package/contracts/src/entities/policy/index.d.ts +0 -1
- package/contracts/src/entities/policy/index.js +0 -1
- package/contracts/src/entities/policy/index.js.map +1 -1
- package/contracts/src/entities/policy/policy.entity.js +15 -0
- package/contracts/src/entities/policy/policy.entity.js.map +1 -1
- package/contracts/src/entities/policy/policy.types.js.map +1 -1
- package/contracts/src/entities/profile/index.d.ts +0 -1
- package/contracts/src/entities/profile/index.js +0 -1
- package/contracts/src/entities/profile/index.js.map +1 -1
- package/contracts/src/entities/profile/profile.entity.js +15 -0
- package/contracts/src/entities/profile/profile.entity.js.map +1 -1
- package/contracts/src/entities/profile/profile.types.js.map +1 -1
- package/contracts/src/entities/role-permission/index.d.ts +1 -0
- package/contracts/src/entities/role-permission/index.js +5 -0
- package/contracts/src/entities/role-permission/index.js.map +1 -0
- package/contracts/src/entities/role-permission/role-permission.entity.d.ts +2 -0
- package/contracts/src/entities/role-permission/role-permission.entity.js +163 -0
- package/contracts/src/entities/role-permission/role-permission.entity.js.map +1 -0
- package/contracts/src/entities/role-permission/role-permission.types.d.ts +11 -0
- package/contracts/src/entities/role-permission/role-permission.types.js +5 -0
- package/contracts/src/entities/role-permission/role-permission.types.js.map +1 -0
- package/contracts/src/entities/roles/index.d.ts +0 -1
- package/contracts/src/entities/roles/index.js +0 -1
- package/contracts/src/entities/roles/index.js.map +1 -1
- package/contracts/src/entities/roles/roles.entity.js +73 -144
- package/contracts/src/entities/roles/roles.entity.js.map +1 -1
- package/contracts/src/entities/roles/roles.types.d.ts +4 -1
- package/contracts/src/entities/roles/roles.types.js.map +1 -1
- package/contracts/src/entities/user-role/index.d.ts +1 -0
- package/{src/lib/seed/tenant → contracts/src/entities/user-role}/index.js +1 -1
- package/contracts/src/entities/user-role/index.js.map +1 -0
- package/contracts/src/entities/user-role/user-role.entity.d.ts +2 -0
- package/contracts/src/entities/user-role/user-role.entity.js +164 -0
- package/contracts/src/entities/user-role/user-role.entity.js.map +1 -0
- package/contracts/src/entities/user-role/user-role.types.d.ts +11 -0
- package/contracts/src/entities/user-role/user-role.types.js +5 -0
- package/contracts/src/entities/user-role/user-role.types.js.map +1 -0
- package/contracts/src/entities/user-two-factor/index.d.ts +2 -0
- package/contracts/src/entities/user-two-factor/index.js +8 -0
- package/contracts/src/entities/user-two-factor/index.js.map +1 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.entity.d.ts +6 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.entity.js +103 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.entity.js.map +1 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.types.d.ts +24 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.types.js +4 -0
- package/contracts/src/entities/user-two-factor/user-two-factor.types.js.map +1 -0
- package/contracts/src/entities/users/index.d.ts +1 -1
- package/contracts/src/entities/users/index.js +1 -1
- package/contracts/src/entities/users/index.js.map +1 -1
- package/contracts/src/entities/users/user-provisioning-list-actions.d.ts +8 -0
- package/contracts/src/entities/users/user-provisioning-list-actions.js +95 -0
- package/contracts/src/entities/users/user-provisioning-list-actions.js.map +1 -0
- package/contracts/src/entities/users/users.entity.js +244 -83
- package/contracts/src/entities/users/users.entity.js.map +1 -1
- package/contracts/src/entities/users/users.types.d.ts +15 -0
- package/contracts/src/entities/users/users.types.js.map +1 -1
- package/contracts/src/entity-catalog.d.ts +7 -0
- package/contracts/src/entity-catalog.js +28 -0
- package/contracts/src/entity-catalog.js.map +1 -0
- package/contracts/src/entity-entry.device-sessions.d.ts +1 -0
- package/contracts/src/entity-entry.device-sessions.js +6 -0
- package/contracts/src/entity-entry.device-sessions.js.map +1 -0
- package/contracts/src/entity-entry.identity-provider.d.ts +1 -0
- package/contracts/src/entity-entry.identity-provider.js +6 -0
- package/contracts/src/entity-entry.identity-provider.js.map +1 -0
- package/contracts/src/entity-entry.policy.d.ts +1 -0
- package/contracts/src/entity-entry.policy.js +6 -0
- package/contracts/src/entity-entry.policy.js.map +1 -0
- package/contracts/src/entity-entry.profile.d.ts +1 -0
- package/contracts/src/entity-entry.profile.js +6 -0
- package/contracts/src/entity-entry.profile.js.map +1 -0
- package/contracts/src/entity-entry.role-permission.d.ts +1 -0
- package/contracts/src/entity-entry.role-permission.js +6 -0
- package/contracts/src/entity-entry.role-permission.js.map +1 -0
- package/contracts/src/entity-entry.roles.d.ts +1 -0
- package/contracts/src/entity-entry.roles.js +6 -0
- package/contracts/src/entity-entry.roles.js.map +1 -0
- package/contracts/src/entity-entry.user-role.d.ts +1 -0
- package/contracts/src/entity-entry.user-role.js +6 -0
- package/contracts/src/entity-entry.user-role.js.map +1 -0
- package/contracts/src/entity-entry.user-two-factor.d.ts +1 -0
- package/contracts/src/entity-entry.user-two-factor.js +6 -0
- package/contracts/src/entity-entry.user-two-factor.js.map +1 -0
- package/contracts/src/entity-entry.users.d.ts +1 -0
- package/contracts/src/entity-entry.users.js +6 -0
- package/contracts/src/entity-entry.users.js.map +1 -0
- package/contracts/src/features.keys.d.ts +4 -0
- package/contracts/src/features.keys.js +4 -0
- package/contracts/src/features.keys.js.map +1 -1
- package/contracts/src/index.d.ts +10 -1
- package/contracts/src/index.js +10 -1
- package/contracts/src/index.js.map +1 -1
- package/contracts/src/invite-application-role-rows.util.d.ts +16 -0
- package/contracts/src/invite-application-role-rows.util.js +68 -0
- package/contracts/src/invite-application-role-rows.util.js.map +1 -0
- package/contracts/src/invite-assignable-roles.util.d.ts +34 -0
- package/contracts/src/invite-assignable-roles.util.js +75 -0
- package/contracts/src/invite-assignable-roles.util.js.map +1 -0
- package/contracts/src/lib/context.definitions.d.ts +2 -0
- package/contracts/src/lib/context.definitions.js +15 -0
- package/contracts/src/lib/context.definitions.js.map +1 -0
- package/contracts/src/manifest.d.ts +6 -0
- package/contracts/src/manifest.js +24 -0
- package/contracts/src/manifest.js.map +1 -0
- package/contracts/src/menu.keys.d.ts +1 -0
- package/contracts/src/menu.keys.js +1 -0
- package/contracts/src/menu.keys.js.map +1 -1
- package/contracts/src/permission.keys.d.ts +48 -18
- package/contracts/src/permission.keys.js +49 -21
- package/contracts/src/permission.keys.js.map +1 -1
- package/contracts/src/resolve-user-effective-state.js.map +1 -1
- package/contracts/src/root-config.d.ts +33 -0
- package/contracts/src/root-config.js +33 -0
- package/contracts/src/root-config.js.map +1 -1
- package/contracts/src/server-commands.d.ts +322 -0
- package/contracts/src/server-commands.js +77 -1
- package/contracts/src/server-commands.js.map +1 -1
- package/contracts/src/settings.keys.d.ts +16 -0
- package/contracts/src/settings.keys.js +21 -0
- package/contracts/src/settings.keys.js.map +1 -0
- package/contracts/src/user-access-state.js.map +1 -1
- package/contracts/src/user-effective-state.js.map +1 -1
- package/contracts/src/user-invitation.d.ts +41 -0
- package/contracts/src/user-invitation.js +18 -0
- package/contracts/src/user-invitation.js.map +1 -0
- package/contracts/src/user-password-reset.js.map +1 -1
- package/package.json +16 -18
- package/server/src/index.d.ts +3 -0
- package/server/src/index.js +11 -0
- package/server/src/index.js.map +1 -0
- package/server/src/lib/effective-access-history/effective-access-history.service.d.ts +35 -0
- package/server/src/lib/effective-access-history/effective-access-history.service.js +486 -0
- package/server/src/lib/effective-access-history/effective-access-history.service.js.map +1 -0
- package/server/src/lib/effective-access-history/effective-access-history.types.d.ts +64 -0
- package/server/src/lib/effective-access-history/effective-access-history.types.js +5 -0
- package/server/src/lib/effective-access-history/effective-access-history.types.js.map +1 -0
- package/server/src/lib/effective-access-history/version-as-of.util.d.ts +37 -0
- package/server/src/lib/effective-access-history/version-as-of.util.js +167 -0
- package/server/src/lib/effective-access-history/version-as-of.util.js.map +1 -0
- package/server/src/lib/entities/index.d.ts +1 -0
- package/server/src/lib/entities/index.js +5 -0
- package/{src/lib/seed/tenant → server/src/lib/entities}/index.js.map +1 -1
- package/server/src/lib/entities/security-management.entity-catalog.d.ts +1 -0
- package/server/src/lib/entities/security-management.entity-catalog.js +12 -0
- package/server/src/lib/entities/security-management.entity-catalog.js.map +1 -0
- package/server/src/lib/handlers/security-report.handlers.d.ts +36 -0
- package/server/src/lib/handlers/security-report.handlers.js +164 -0
- package/server/src/lib/handlers/security-report.handlers.js.map +1 -0
- package/server/src/lib/identity-provider/auth-oauth-clients.constants.d.ts +5 -0
- package/server/src/lib/identity-provider/auth-oauth-clients.constants.js +11 -0
- package/server/src/lib/identity-provider/auth-oauth-clients.constants.js.map +1 -0
- package/server/src/lib/identity-provider/identity-provider-catalog.service.d.ts +20 -0
- package/server/src/lib/identity-provider/identity-provider-catalog.service.js +169 -0
- package/server/src/lib/identity-provider/identity-provider-catalog.service.js.map +1 -0
- package/server/src/lib/identity-provider/identity-provider-ids.constants.d.ts +8 -0
- package/server/src/lib/identity-provider/identity-provider-ids.constants.js +19 -0
- package/server/src/lib/identity-provider/identity-provider-ids.constants.js.map +1 -0
- package/server/src/lib/identity-provider/identity-provider-stub.bootstrap.d.ts +12 -0
- package/server/src/lib/identity-provider/identity-provider-stub.bootstrap.js +48 -0
- package/server/src/lib/identity-provider/identity-provider-stub.bootstrap.js.map +1 -0
- package/server/src/lib/identity-provider/identity-provider.constants.d.ts +1 -0
- package/server/src/lib/identity-provider/identity-provider.constants.js +7 -0
- package/server/src/lib/identity-provider/identity-provider.constants.js.map +1 -0
- package/server/src/lib/middlewares/device-sessions-active.middleware.d.ts +15 -0
- package/server/src/lib/middlewares/device-sessions-active.middleware.js +76 -0
- package/server/src/lib/middlewares/device-sessions-active.middleware.js.map +1 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.middleware.d.ts +29 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.middleware.js +137 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.middleware.js.map +1 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.util.d.ts +41 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.util.js +69 -0
- package/server/src/lib/middlewares/device-sessions-app-scope.util.js.map +1 -0
- package/server/src/lib/middlewares/device-sessions-token-revoke.middleware.d.ts +18 -0
- package/server/src/lib/middlewares/device-sessions-token-revoke.middleware.js +90 -0
- package/server/src/lib/middlewares/device-sessions-token-revoke.middleware.js.map +1 -0
- package/server/src/lib/middlewares/user-assigned-roles.middleware.d.ts +36 -0
- package/server/src/lib/middlewares/user-assigned-roles.middleware.js +359 -0
- package/server/src/lib/middlewares/user-assigned-roles.middleware.js.map +1 -0
- package/{src → server/src}/lib/middlewares/user-effective-state.middleware.js +1 -1
- package/server/src/lib/middlewares/user-effective-state.middleware.js.map +1 -0
- package/server/src/lib/middlewares/user-invitation-list.middleware.d.ts +32 -0
- package/server/src/lib/middlewares/user-invitation-list.middleware.js +250 -0
- package/server/src/lib/middlewares/user-invitation-list.middleware.js.map +1 -0
- package/server/src/lib/middlewares/user-profile-write.middleware.d.ts +18 -0
- package/server/src/lib/middlewares/user-profile-write.middleware.js +206 -0
- package/server/src/lib/middlewares/user-profile-write.middleware.js.map +1 -0
- package/server/src/lib/password-reset/change-own-password.command.d.ts +8 -0
- package/server/src/lib/password-reset/change-own-password.command.js +38 -0
- package/server/src/lib/password-reset/change-own-password.command.js.map +1 -0
- package/{src → server/src}/lib/password-reset/complete-password-reset.command.d.ts +3 -4
- package/{src → server/src}/lib/password-reset/complete-password-reset.command.js +8 -12
- package/server/src/lib/password-reset/complete-password-reset.command.js.map +1 -0
- package/server/src/lib/password-reset/get-own-password-status.command.d.ts +8 -0
- package/server/src/lib/password-reset/get-own-password-status.command.js +31 -0
- package/server/src/lib/password-reset/get-own-password-status.command.js.map +1 -0
- package/{src → server/src}/lib/password-reset/send-password-reset-email.command.d.ts +12 -13
- package/{src → server/src}/lib/password-reset/send-password-reset-email.command.js +10 -15
- package/server/src/lib/password-reset/send-password-reset-email.command.js.map +1 -0
- package/server/src/lib/password-reset/user-change-password.service.d.ts +24 -0
- package/server/src/lib/password-reset/user-change-password.service.js +92 -0
- package/server/src/lib/password-reset/user-change-password.service.js.map +1 -0
- package/{src → server/src}/lib/password-reset/user-password-reset.service.d.ts +2 -7
- package/{src → server/src}/lib/password-reset/user-password-reset.service.js +29 -90
- package/server/src/lib/password-reset/user-password-reset.service.js.map +1 -0
- package/server/src/lib/queries/get-permission-holders-history.query.d.ts +4 -0
- package/server/src/lib/queries/get-permission-holders-history.query.definition.d.ts +5 -0
- package/server/src/lib/queries/get-permission-holders-history.query.definition.js +38 -0
- package/server/src/lib/queries/get-permission-holders-history.query.definition.js.map +1 -0
- package/server/src/lib/queries/get-permission-holders-history.query.js +25 -0
- package/server/src/lib/queries/get-permission-holders-history.query.js.map +1 -0
- package/server/src/lib/queries/get-role-holders-history.query.d.ts +4 -0
- package/server/src/lib/queries/get-role-holders-history.query.definition.d.ts +5 -0
- package/server/src/lib/queries/get-role-holders-history.query.definition.js +38 -0
- package/server/src/lib/queries/get-role-holders-history.query.definition.js.map +1 -0
- package/server/src/lib/queries/get-role-holders-history.query.js +25 -0
- package/server/src/lib/queries/get-role-holders-history.query.js.map +1 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.d.ts +4 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.definition.d.ts +5 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.definition.js +35 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.definition.js.map +1 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.js +26 -0
- package/server/src/lib/queries/get-user-effective-permissions-history.query.js.map +1 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.d.ts +4 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.definition.d.ts +5 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.definition.js +36 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.definition.js.map +1 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.js +25 -0
- package/server/src/lib/queries/get-user-effective-roles-history.query.js.map +1 -0
- package/server/src/lib/queries/get-user-password-change-history.query.d.ts +4 -0
- package/server/src/lib/queries/get-user-password-change-history.query.definition.d.ts +5 -0
- package/server/src/lib/queries/get-user-password-change-history.query.definition.js +33 -0
- package/server/src/lib/queries/get-user-password-change-history.query.definition.js.map +1 -0
- package/server/src/lib/queries/get-user-password-change-history.query.js +23 -0
- package/server/src/lib/queries/get-user-password-change-history.query.js.map +1 -0
- package/server/src/lib/queries/security-query.helpers.d.ts +47 -0
- package/server/src/lib/queries/security-query.helpers.js +184 -0
- package/server/src/lib/queries/security-query.helpers.js.map +1 -0
- package/server/src/lib/reports/password-change-history.service.d.ts +14 -0
- package/server/src/lib/reports/password-change-history.service.js +74 -0
- package/server/src/lib/reports/password-change-history.service.js.map +1 -0
- package/server/src/lib/reports/permission-display-catalog.d.ts +7 -0
- package/server/src/lib/reports/permission-display-catalog.js +101 -0
- package/server/src/lib/reports/permission-display-catalog.js.map +1 -0
- package/server/src/lib/reports/security-report-definition.provider.d.ts +5 -0
- package/server/src/lib/reports/security-report-definition.provider.js +23 -0
- package/server/src/lib/reports/security-report-definition.provider.js.map +1 -0
- package/server/src/lib/reports/security-report-parameter-groups.d.ts +343 -0
- package/server/src/lib/reports/security-report-parameter-groups.js +167 -0
- package/server/src/lib/reports/security-report-parameter-groups.js.map +1 -0
- package/server/src/lib/reports/security-report-scope.constants.d.ts +5 -0
- package/server/src/lib/reports/security-report-scope.constants.js +11 -0
- package/server/src/lib/reports/security-report-scope.constants.js.map +1 -0
- package/server/src/lib/reports/security-report.definitions.d.ts +12 -0
- package/server/src/lib/reports/security-report.definitions.js +386 -0
- package/server/src/lib/reports/security-report.definitions.js.map +1 -0
- package/server/src/lib/security-management-entity-storage.bootstrap.d.ts +26 -0
- package/server/src/lib/security-management-entity-storage.bootstrap.js +56 -0
- package/server/src/lib/security-management-entity-storage.bootstrap.js.map +1 -0
- package/server/src/lib/security-management-server.module.d.ts +7 -0
- package/server/src/lib/security-management-server.module.js +190 -0
- package/server/src/lib/security-management-server.module.js.map +1 -0
- package/server/src/lib/two-factor/admin-reset-two-factor.command.d.ts +8 -0
- package/server/src/lib/two-factor/admin-reset-two-factor.command.js +35 -0
- package/server/src/lib/two-factor/admin-reset-two-factor.command.js.map +1 -0
- package/server/src/lib/two-factor/confirm-two-factor-enrollment.command.d.ts +8 -0
- package/server/src/lib/two-factor/confirm-two-factor-enrollment.command.js +34 -0
- package/server/src/lib/two-factor/confirm-two-factor-enrollment.command.js.map +1 -0
- package/server/src/lib/two-factor/disable-two-factor.command.d.ts +8 -0
- package/server/src/lib/two-factor/disable-two-factor.command.js +31 -0
- package/server/src/lib/two-factor/disable-two-factor.command.js.map +1 -0
- package/server/src/lib/two-factor/generate-two-factor-recovery-codes.command.d.ts +8 -0
- package/server/src/lib/two-factor/generate-two-factor-recovery-codes.command.js +34 -0
- package/server/src/lib/two-factor/generate-two-factor-recovery-codes.command.js.map +1 -0
- package/server/src/lib/two-factor/get-two-factor-status.command.d.ts +8 -0
- package/server/src/lib/two-factor/get-two-factor-status.command.js +31 -0
- package/server/src/lib/two-factor/get-two-factor-status.command.js.map +1 -0
- package/server/src/lib/two-factor/recovery-codes.util.d.ts +11 -0
- package/server/src/lib/two-factor/recovery-codes.util.js +73 -0
- package/server/src/lib/two-factor/recovery-codes.util.js.map +1 -0
- package/server/src/lib/two-factor/start-two-factor-enrollment.command.d.ts +8 -0
- package/server/src/lib/two-factor/start-two-factor-enrollment.command.js +31 -0
- package/server/src/lib/two-factor/start-two-factor-enrollment.command.js.map +1 -0
- package/server/src/lib/two-factor/totp.util.d.ts +32 -0
- package/server/src/lib/two-factor/totp.util.js +128 -0
- package/server/src/lib/two-factor/totp.util.js.map +1 -0
- package/server/src/lib/two-factor/two-factor-encryption.util.d.ts +25 -0
- package/server/src/lib/two-factor/two-factor-encryption.util.js +123 -0
- package/server/src/lib/two-factor/two-factor-encryption.util.js.map +1 -0
- package/server/src/lib/two-factor/two-factor-gate.bootstrap.d.ts +9 -0
- package/server/src/lib/two-factor/two-factor-gate.bootstrap.js +65 -0
- package/server/src/lib/two-factor/two-factor-gate.bootstrap.js.map +1 -0
- package/server/src/lib/two-factor/two-factor-redis.store.d.ts +63 -0
- package/server/src/lib/two-factor/two-factor-redis.store.js +321 -0
- package/server/src/lib/two-factor/two-factor-redis.store.js.map +1 -0
- package/server/src/lib/two-factor/user-two-factor.service.d.ts +62 -0
- package/server/src/lib/two-factor/user-two-factor.service.js +573 -0
- package/server/src/lib/two-factor/user-two-factor.service.js.map +1 -0
- package/server/src/lib/two-factor/verify-two-factor-login.command.d.ts +18 -0
- package/server/src/lib/two-factor/verify-two-factor-login.command.js +54 -0
- package/server/src/lib/two-factor/verify-two-factor-login.command.js.map +1 -0
- package/server/src/lib/user-invitation/accept-invitation.command.d.ts +8 -0
- package/server/src/lib/user-invitation/accept-invitation.command.js +41 -0
- package/server/src/lib/user-invitation/accept-invitation.command.js.map +1 -0
- package/server/src/lib/user-invitation/accept-my-invitation.command.d.ts +8 -0
- package/server/src/lib/user-invitation/accept-my-invitation.command.js +40 -0
- package/server/src/lib/user-invitation/accept-my-invitation.command.js.map +1 -0
- package/server/src/lib/user-invitation/approve-join-request.command.d.ts +8 -0
- package/server/src/lib/user-invitation/approve-join-request.command.js +41 -0
- package/server/src/lib/user-invitation/approve-join-request.command.js.map +1 -0
- package/server/src/lib/user-invitation/cancel-invitation.command.d.ts +8 -0
- package/server/src/lib/user-invitation/cancel-invitation.command.js +37 -0
- package/server/src/lib/user-invitation/cancel-invitation.command.js.map +1 -0
- package/server/src/lib/user-invitation/cancel-my-join-request.command.d.ts +8 -0
- package/server/src/lib/user-invitation/cancel-my-join-request.command.js +40 -0
- package/server/src/lib/user-invitation/cancel-my-join-request.command.js.map +1 -0
- package/server/src/lib/user-invitation/create-user-in-tenant.command.d.ts +8 -0
- package/server/src/lib/user-invitation/create-user-in-tenant.command.js +37 -0
- package/server/src/lib/user-invitation/create-user-in-tenant.command.js.map +1 -0
- package/server/src/lib/user-invitation/decline-invitation.command.d.ts +8 -0
- package/server/src/lib/user-invitation/decline-invitation.command.js +37 -0
- package/server/src/lib/user-invitation/decline-invitation.command.js.map +1 -0
- package/server/src/lib/user-invitation/invite-user.command.d.ts +8 -0
- package/server/src/lib/user-invitation/invite-user.command.js +37 -0
- package/server/src/lib/user-invitation/invite-user.command.js.map +1 -0
- package/server/src/lib/user-invitation/list-invite-assignable-roles.command.d.ts +8 -0
- package/server/src/lib/user-invitation/list-invite-assignable-roles.command.js +41 -0
- package/server/src/lib/user-invitation/list-invite-assignable-roles.command.js.map +1 -0
- package/server/src/lib/user-invitation/list-my-join-requests.command.d.ts +8 -0
- package/server/src/lib/user-invitation/list-my-join-requests.command.js +40 -0
- package/server/src/lib/user-invitation/list-my-join-requests.command.js.map +1 -0
- package/server/src/lib/user-invitation/list-my-pending-invitations.command.d.ts +8 -0
- package/server/src/lib/user-invitation/list-my-pending-invitations.command.js +37 -0
- package/server/src/lib/user-invitation/list-my-pending-invitations.command.js.map +1 -0
- package/server/src/lib/user-invitation/list-tenant-entitled-applications.command.d.ts +8 -0
- package/server/src/lib/user-invitation/list-tenant-entitled-applications.command.js +41 -0
- package/server/src/lib/user-invitation/list-tenant-entitled-applications.command.js.map +1 -0
- package/server/src/lib/user-invitation/lookup-tenant-by-unique-name.command.d.ts +8 -0
- package/server/src/lib/user-invitation/lookup-tenant-by-unique-name.command.js +40 -0
- package/server/src/lib/user-invitation/lookup-tenant-by-unique-name.command.js.map +1 -0
- package/server/src/lib/user-invitation/reject-join-request.command.d.ts +8 -0
- package/server/src/lib/user-invitation/reject-join-request.command.js +41 -0
- package/server/src/lib/user-invitation/reject-join-request.command.js.map +1 -0
- package/server/src/lib/user-invitation/request-tenant-membership.command.d.ts +8 -0
- package/server/src/lib/user-invitation/request-tenant-membership.command.js +40 -0
- package/server/src/lib/user-invitation/request-tenant-membership.command.js.map +1 -0
- package/server/src/lib/user-invitation/resend-invitation.command.d.ts +12 -0
- package/server/src/lib/user-invitation/resend-invitation.command.js +37 -0
- package/server/src/lib/user-invitation/resend-invitation.command.js.map +1 -0
- package/server/src/lib/user-invitation/user-invitation-application-access.util.d.ts +25 -0
- package/server/src/lib/user-invitation/user-invitation-application-access.util.js +121 -0
- package/server/src/lib/user-invitation/user-invitation-application-access.util.js.map +1 -0
- package/server/src/lib/user-invitation/user-invitation.service.d.ts +162 -0
- package/server/src/lib/user-invitation/user-invitation.service.js +1658 -0
- package/server/src/lib/user-invitation/user-invitation.service.js.map +1 -0
- package/contracts/src/datasource.keys.d.ts +0 -4
- package/contracts/src/datasource.keys.js +0 -10
- package/contracts/src/datasource.keys.js.map +0 -1
- package/src/index.d.ts +0 -5
- package/src/index.js +0 -13
- package/src/index.js.map +0 -1
- package/src/lib/middlewares/user-effective-state.middleware.js.map +0 -1
- package/src/lib/password-reset/complete-password-reset.command.js.map +0 -1
- package/src/lib/password-reset/send-password-reset-email.command.js.map +0 -1
- package/src/lib/password-reset/user-password-reset.service.js.map +0 -1
- package/src/lib/security-management-server.module.d.ts +0 -2
- package/src/lib/security-management-server.module.js +0 -48
- package/src/lib/security-management-server.module.js.map +0 -1
- package/src/lib/seed/index.d.ts +0 -22
- package/src/lib/seed/index.js +0 -24
- package/src/lib/seed/index.js.map +0 -1
- package/src/lib/seed/policy/index.d.ts +0 -2
- package/src/lib/seed/policy/index.js +0 -6
- package/src/lib/seed/policy/index.js.map +0 -1
- package/src/lib/seed/policy/policy.mock.d.ts +0 -7
- package/src/lib/seed/policy/policy.mock.js +0 -40
- package/src/lib/seed/policy/policy.mock.js.map +0 -1
- package/src/lib/seed/policy/policy.seed.d.ts +0 -5
- package/src/lib/seed/policy/policy.seed.js +0 -31
- package/src/lib/seed/policy/policy.seed.js.map +0 -1
- package/src/lib/seed/role/index.d.ts +0 -4
- package/src/lib/seed/role/index.js +0 -8
- package/src/lib/seed/role/index.js.map +0 -1
- package/src/lib/seed/role/role-ids.constants.d.ts +0 -14
- package/src/lib/seed/role/role-ids.constants.js +0 -20
- package/src/lib/seed/role/role-ids.constants.js.map +0 -1
- package/src/lib/seed/role/role-permission-keys.constants.d.ts +0 -578
- package/src/lib/seed/role/role-permission-keys.constants.js +0 -620
- package/src/lib/seed/role/role-permission-keys.constants.js.map +0 -1
- package/src/lib/seed/role/role.mock.d.ts +0 -4
- package/src/lib/seed/role/role.mock.js +0 -321
- package/src/lib/seed/role/role.mock.js.map +0 -1
- package/src/lib/seed/role/role.seed.d.ts +0 -5
- package/src/lib/seed/role/role.seed.js +0 -31
- package/src/lib/seed/role/role.seed.js.map +0 -1
- package/src/lib/seed/security-management-seed.provider.d.ts +0 -4
- package/src/lib/seed/security-management-seed.provider.js +0 -18
- package/src/lib/seed/security-management-seed.provider.js.map +0 -1
- package/src/lib/seed/security-management-seed.tokens.d.ts +0 -1
- package/src/lib/seed/security-management-seed.tokens.js +0 -7
- package/src/lib/seed/security-management-seed.tokens.js.map +0 -1
- package/src/lib/seed/security-management.seed-catalog.d.ts +0 -2
- package/src/lib/seed/security-management.seed-catalog.js +0 -17
- package/src/lib/seed/security-management.seed-catalog.js.map +0 -1
- package/src/lib/seed/tenant/index.d.ts +0 -1
- package/src/lib/seed/tenant/tenant-ids.constants.d.ts +0 -11
- package/src/lib/seed/tenant/tenant-ids.constants.js +0 -17
- package/src/lib/seed/tenant/tenant-ids.constants.js.map +0 -1
- package/src/lib/seed/user/index.d.ts +0 -4
- package/src/lib/seed/user/index.js +0 -13
- package/src/lib/seed/user/index.js.map +0 -1
- package/src/lib/seed/user/resolve-user-effective-state.util.d.ts +0 -4
- package/src/lib/seed/user/resolve-user-effective-state.util.js +0 -10
- package/src/lib/seed/user/resolve-user-effective-state.util.js.map +0 -1
- package/src/lib/seed/user/user.mock.d.ts +0 -21
- package/src/lib/seed/user/user.mock.js +0 -338
- package/src/lib/seed/user/user.mock.js.map +0 -1
- package/src/lib/seed/user/user.seed.d.ts +0 -5
- package/src/lib/seed/user/user.seed.js +0 -31
- package/src/lib/seed/user/user.seed.js.map +0 -1
- /package/{src → server/src}/lib/middlewares/user-effective-state.middleware.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-catalog.service.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/identity-provider/identity-provider-catalog.service.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;;AAsK3B,gFAQC;;AA5KD,iEAAwF;AACxF,yEAMoD;AACpD,gHAG+D;AAC/D,2CAAoD;AACpD,6EAAkF;AAElF,+EAAyE;AACzE,uFAAsF;AAEtF,YAAY;AAEZ,mCAAmC;AAG5B,IAAM,8BAA8B,sCAApC,MAAM,8BAA8B;IAGzC,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;QAFnD,WAAM,GAAG,IAAI,eAAM,CAAC,gCAA8B,CAAC,IAAI,CAAC,CAAC;IAEH,CAAC;IAElE,mBAAmB;;;YACvB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sDAAwB,EAAE;oBAChE,IAAI,EAAE,CAAC;oBACP,IAAI,EAAE,GAAG;oBACT,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;iBAC1E,CAAC,CAAC;gBAEH,MAAM,KAAK,GAAG,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAqC,CAAC;gBACvE,OAAO,KAAK;qBACT,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;qBACvE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,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: {
|
|
2
|
+
readonly google: "f0000010-0000-4000-a000-000000000001";
|
|
3
|
+
readonly microsoft: "f0000010-0000-4000-a000-000000000002";
|
|
4
|
+
readonly oktaHr: "f0000010-0000-4000-a000-000000000003";
|
|
5
|
+
readonly azureAdCorp: "f0000010-0000-4000-a000-000000000004";
|
|
6
|
+
};
|
|
7
|
+
/** Stable ids used by ensureStub so seed + bootstrap do not create duplicate keys. */
|
|
8
|
+
export declare const IDENTITY_PROVIDER_STUB_IDS_BY_KEY: Record<string, string>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Stable IdentityProvider IDs ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.IDENTITY_PROVIDER_STUB_IDS_BY_KEY = exports.MOCK_IDENTITY_PROVIDER_IDS = void 0;
|
|
5
|
+
exports.MOCK_IDENTITY_PROVIDER_IDS = {
|
|
6
|
+
google: 'f0000010-0000-4000-a000-000000000001',
|
|
7
|
+
microsoft: 'f0000010-0000-4000-a000-000000000002',
|
|
8
|
+
oktaHr: 'f0000010-0000-4000-a000-000000000003',
|
|
9
|
+
azureAdCorp: 'f0000010-0000-4000-a000-000000000004',
|
|
10
|
+
};
|
|
11
|
+
/** Stable ids used by ensureStub so seed + bootstrap do not create duplicate keys. */
|
|
12
|
+
exports.IDENTITY_PROVIDER_STUB_IDS_BY_KEY = {
|
|
13
|
+
google: exports.MOCK_IDENTITY_PROVIDER_IDS.google,
|
|
14
|
+
microsoft: exports.MOCK_IDENTITY_PROVIDER_IDS.microsoft,
|
|
15
|
+
'okta-hr': exports.MOCK_IDENTITY_PROVIDER_IDS.oktaHr,
|
|
16
|
+
'azure-ad-corp': exports.MOCK_IDENTITY_PROVIDER_IDS.azureAdCorp,
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=identity-provider-ids.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-ids.constants.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/identity-provider/identity-provider-ids.constants.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAElC,QAAA,0BAA0B,GAAG;IACxC,MAAM,EAAE,sCAAsC;IAC9C,SAAS,EAAE,sCAAsC;IACjD,MAAM,EAAE,sCAAsC;IAC9C,WAAW,EAAE,sCAAsC;CAC3C,CAAC;AAEX,sFAAsF;AACzE,QAAA,iCAAiC,GAA2B;IACvE,MAAM,EAAE,kCAA0B,CAAC,MAAM;IACzC,SAAS,EAAE,kCAA0B,CAAC,SAAS;IAC/C,SAAS,EAAE,kCAA0B,CAAC,MAAM;IAC5C,eAAe,EAAE,kCAA0B,CAAC,WAAW;CACxD,CAAC;AAEF,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AuthIdentityProviderCatalog } from '@acorex-platform/framework-server/security';
|
|
2
|
+
import { type OnApplicationBootstrap } from '@nestjs/common';
|
|
3
|
+
/**
|
|
4
|
+
* Ensures the Microsoft platform IdP stub. Google/SSO extensions ensure their own rows.
|
|
5
|
+
* Microsoft has client-only package today — keep this until a microsoft-server module exists.
|
|
6
|
+
*/
|
|
7
|
+
export declare class IdentityProviderStubBootstrap implements OnApplicationBootstrap {
|
|
8
|
+
private readonly catalog;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(catalog: AuthIdentityProviderCatalog);
|
|
11
|
+
onApplicationBootstrap(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Imports ----
|
|
3
|
+
var IdentityProviderStubBootstrap_1;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.IdentityProviderStubBootstrap = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
8
|
+
const common_1 = require("@nestjs/common");
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Platform IdP stubs (no dedicated extension server) ----
|
|
11
|
+
/**
|
|
12
|
+
* Ensures the Microsoft platform IdP stub. Google/SSO extensions ensure their own rows.
|
|
13
|
+
* Microsoft has client-only package today — keep this until a microsoft-server module exists.
|
|
14
|
+
*/
|
|
15
|
+
let IdentityProviderStubBootstrap = IdentityProviderStubBootstrap_1 = class IdentityProviderStubBootstrap {
|
|
16
|
+
constructor(catalog) {
|
|
17
|
+
this.catalog = catalog;
|
|
18
|
+
this.logger = new common_1.Logger(IdentityProviderStubBootstrap_1.name);
|
|
19
|
+
}
|
|
20
|
+
onApplicationBootstrap() {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
yield this.catalog.ensureStub({
|
|
24
|
+
key: 'microsoft',
|
|
25
|
+
title: 'Microsoft',
|
|
26
|
+
icon: 'fa-brands fa-microsoft',
|
|
27
|
+
priority: 20,
|
|
28
|
+
authorizationUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
|
|
29
|
+
tokenUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
|
|
30
|
+
userInfoUrl: 'https://graph.microsoft.com/oidc/userinfo',
|
|
31
|
+
scopes: 'openid email profile',
|
|
32
|
+
issuerUrl: 'https://login.microsoftonline.com/common/v2.0',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.logger.warn(`Microsoft IdP stub ensure failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.IdentityProviderStubBootstrap = IdentityProviderStubBootstrap;
|
|
42
|
+
exports.IdentityProviderStubBootstrap = IdentityProviderStubBootstrap = IdentityProviderStubBootstrap_1 = tslib_1.__decorate([
|
|
43
|
+
(0, common_1.Injectable)(),
|
|
44
|
+
tslib_1.__param(0, (0, common_1.Inject)(security_1.AUTH_IDENTITY_PROVIDER_CATALOG)),
|
|
45
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
46
|
+
], IdentityProviderStubBootstrap);
|
|
47
|
+
//#endregion
|
|
48
|
+
//# sourceMappingURL=identity-provider-stub.bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-stub.bootstrap.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/identity-provider/identity-provider-stub.bootstrap.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;;;AAE3B,yEAGoD;AACpD,2CAAyF;AAEzF,YAAY;AAEZ,sEAAsE;AAEtE;;;GAGG;AAEI,IAAM,6BAA6B,qCAAnC,MAAM,6BAA6B;IAGxC,YAEE,OAAqD;QAApC,YAAO,GAAP,OAAO,CAA6B;QAJtC,WAAM,GAAG,IAAI,eAAM,CAAC,+BAA6B,CAAC,IAAI,CAAC,CAAC;IAKtE,CAAC;IAEE,sBAAsB;;YAC1B,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC5B,GAAG,EAAE,WAAW;oBAChB,KAAK,EAAE,WAAW;oBAClB,IAAI,EAAE,wBAAwB;oBAC9B,QAAQ,EAAE,EAAE;oBACZ,gBAAgB,EAAE,gEAAgE;oBAClF,QAAQ,EAAE,4DAA4D;oBACtE,WAAW,EAAE,2CAA2C;oBACxD,MAAM,EAAE,sBAAsB;oBAC9B,SAAS,EAAE,+CAA+C;iBAC3D,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,qCAAqC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9F,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAA;AA3BY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,mBAAU,GAAE;IAKR,mBAAA,IAAA,eAAM,EAAC,yCAA8B,CAAC,CAAA;;GAJ9B,6BAA6B,CA2BzC;AAED,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IDENTITY_PROVIDER_ENTITY = "SecurityManagement.IdentityProvider";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Identity provider storage constants ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.IDENTITY_PROVIDER_ENTITY = void 0;
|
|
5
|
+
exports.IDENTITY_PROVIDER_ENTITY = 'SecurityManagement.IdentityProvider';
|
|
6
|
+
//#endregion
|
|
7
|
+
//# sourceMappingURL=identity-provider.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider.constants.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/identity-provider/identity-provider.constants.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAE1C,QAAA,wBAAwB,GAAG,qCAAqC,CAAC;AAE9E,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AXPEntityOp, EntityStorageContext, EntityStorageMiddleware } from '@acorex-platform/framework-server/core';
|
|
2
|
+
/**
|
|
3
|
+
* Marks `isActiveSession` relative to the caller's JWT `sid`.
|
|
4
|
+
* Persisted values are ignored on read — every login used to stamp true,
|
|
5
|
+
* which hid other devices from Active Sessions.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeviceSessionsActiveMiddleware implements EntityStorageMiddleware {
|
|
8
|
+
readonly target: {
|
|
9
|
+
entity: string;
|
|
10
|
+
ops: AXPEntityOp[];
|
|
11
|
+
order: number;
|
|
12
|
+
};
|
|
13
|
+
execute(ctx: EntityStorageContext, next: () => Promise<void>): Promise<void>;
|
|
14
|
+
private readSession;
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ----- Imports -----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DeviceSessionsActiveMiddleware = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@acorex-platform/framework-server/core");
|
|
7
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
8
|
+
const common_1 = require("@nestjs/common");
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ----- Constants -----
|
|
11
|
+
const DEVICE_SESSION_ENTITY = 'SecurityManagement.DeviceSessions';
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ----- Helpers -----
|
|
14
|
+
function rowSessionId(row) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (typeof row.sessionId === 'string' && row.sessionId.trim()) {
|
|
17
|
+
return row.sessionId.trim();
|
|
18
|
+
}
|
|
19
|
+
const configSid = (_a = row.config) === null || _a === void 0 ? void 0 : _a.sessionId;
|
|
20
|
+
return typeof configSid === 'string' ? configSid.trim() : '';
|
|
21
|
+
}
|
|
22
|
+
function collectRows(ctx) {
|
|
23
|
+
const result = ctx.result;
|
|
24
|
+
if (!result) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(result.items)) {
|
|
28
|
+
return result.items;
|
|
29
|
+
}
|
|
30
|
+
if (typeof result === 'object') {
|
|
31
|
+
return [result];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region ----- Device sessions active-flag middleware -----
|
|
37
|
+
/**
|
|
38
|
+
* Marks `isActiveSession` relative to the caller's JWT `sid`.
|
|
39
|
+
* Persisted values are ignored on read — every login used to stamp true,
|
|
40
|
+
* which hid other devices from Active Sessions.
|
|
41
|
+
*/
|
|
42
|
+
let DeviceSessionsActiveMiddleware = class DeviceSessionsActiveMiddleware {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.target = {
|
|
45
|
+
entity: DEVICE_SESSION_ENTITY,
|
|
46
|
+
ops: ['query', 'getOne'],
|
|
47
|
+
order: 20,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
execute(ctx, next) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
yield next();
|
|
54
|
+
if (!ctx.result) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const sid = (_c = (_b = (_a = this.readSession()) === null || _a === void 0 ? void 0 : _a.sid) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
58
|
+
for (const row of collectRows(ctx)) {
|
|
59
|
+
// Always recompute. Persisted `isActiveSession: true` on every login hid other devices.
|
|
60
|
+
// Without JWT sid we cannot mark "this device" — clear flags so clients fall back to latest.
|
|
61
|
+
row.isActiveSession = Boolean(sid) && rowSessionId(row) === sid;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
readSession() {
|
|
66
|
+
var _a;
|
|
67
|
+
const req = (0, core_1.getEntityStorageRequest)();
|
|
68
|
+
return (_a = req === null || req === void 0 ? void 0 : req[security_1.CURRENT_SESSION_KEY]) !== null && _a !== void 0 ? _a : null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.DeviceSessionsActiveMiddleware = DeviceSessionsActiveMiddleware;
|
|
72
|
+
exports.DeviceSessionsActiveMiddleware = DeviceSessionsActiveMiddleware = tslib_1.__decorate([
|
|
73
|
+
(0, common_1.Injectable)()
|
|
74
|
+
], DeviceSessionsActiveMiddleware);
|
|
75
|
+
//#endregion
|
|
76
|
+
//# sourceMappingURL=device-sessions-active.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-sessions-active.middleware.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/middlewares/device-sessions-active.middleware.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AAC,GAAyB,EAAE,IAAyB;;;YAChE,MAAM,IAAI,EAAE,CAAC;YAEb,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,MAAM,GAAG,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,WAAW,EAAE,0CAAE,GAAG,0CAAE,IAAI,EAAE,mCAAI,EAAE,CAAC;YAClD,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,wFAAwF;gBACxF,6FAA6F;gBAC7F,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;YAClE,CAAC;QACH,CAAC;KAAA;IAEO,WAAW;;QACjB,MAAM,GAAG,GAAG,IAAA,8BAAuB,GAAoC,CAAC;QACxE,OAAO,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,8BAAmB,CAAC,mCAAI,IAAI,CAAC;IAC5C,CAAC;CACF,CAAA;AA1BY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;GACA,8BAA8B,CA0B1C;AAED,YAAY"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AXPEntityOp, EntityStorageContext, EntityStorageMiddleware } from '@acorex-platform/framework-server/core';
|
|
2
|
+
/**
|
|
3
|
+
|
|
4
|
+
* ADR-TEN-001 D-07: operation-owned DeviceSessions admin scope.
|
|
5
|
+
|
|
6
|
+
*
|
|
7
|
+
|
|
8
|
+
* - Application Sessions → tenant-owner + current `applicationId`
|
|
9
|
+
|
|
10
|
+
* - Tenant Sessions → tenant-owner only (explicit `deviceSessionAdminScope=tenant`)
|
|
11
|
+
|
|
12
|
+
*
|
|
13
|
+
|
|
14
|
+
* Scope is selected by the operation signal (param/header), not Application.code / TM ids.
|
|
15
|
+
|
|
16
|
+
* Does not invent Feature/Permission gates in this phase.
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
export declare class DeviceSessionsAppScopeMiddleware implements EntityStorageMiddleware {
|
|
20
|
+
readonly target: {
|
|
21
|
+
entity: string;
|
|
22
|
+
ops: AXPEntityOp[];
|
|
23
|
+
order: number;
|
|
24
|
+
};
|
|
25
|
+
execute(ctx: EntityStorageContext, next: () => Promise<void>): Promise<void>;
|
|
26
|
+
private failClosedMissingApplicationId;
|
|
27
|
+
private readRequest;
|
|
28
|
+
private readSessionApplicationId;
|
|
29
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ----- Imports -----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DeviceSessionsAppScopeMiddleware = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@acorex-platform/framework-server/core");
|
|
7
|
+
const abstract_1 = require("@acorex-platform/framework-server/jql/abstract");
|
|
8
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
const device_sessions_app_scope_util_1 = require("./device-sessions-app-scope.util");
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ----- Constants -----
|
|
13
|
+
const DEVICE_SESSION_ENTITY = 'SecurityManagement.DeviceSessions';
|
|
14
|
+
/** Fail-closed sentinel when application scope lacks session.applicationId. */
|
|
15
|
+
const NO_APPLICATION_SCOPE_ID = '__no-application__';
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ----- Device sessions application-scope middleware -----
|
|
18
|
+
/**
|
|
19
|
+
|
|
20
|
+
* ADR-TEN-001 D-07: operation-owned DeviceSessions admin scope.
|
|
21
|
+
|
|
22
|
+
*
|
|
23
|
+
|
|
24
|
+
* - Application Sessions → tenant-owner + current `applicationId`
|
|
25
|
+
|
|
26
|
+
* - Tenant Sessions → tenant-owner only (explicit `deviceSessionAdminScope=tenant`)
|
|
27
|
+
|
|
28
|
+
*
|
|
29
|
+
|
|
30
|
+
* Scope is selected by the operation signal (param/header), not Application.code / TM ids.
|
|
31
|
+
|
|
32
|
+
* Does not invent Feature/Permission gates in this phase.
|
|
33
|
+
|
|
34
|
+
*/
|
|
35
|
+
let DeviceSessionsAppScopeMiddleware = class DeviceSessionsAppScopeMiddleware {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.target = {
|
|
38
|
+
entity: DEVICE_SESSION_ENTITY,
|
|
39
|
+
ops: ['query', 'getOne', 'update', 'delete'],
|
|
40
|
+
order: 9,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
execute(ctx, next) {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var _a, _b, _c, _d;
|
|
46
|
+
if ((0, abstract_1.isEngineStorageBypass)(ctx.locals) || (0, abstract_1.isSystemCommandBypass)(ctx.locals)) {
|
|
47
|
+
yield next();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const applicationId = this.readSessionApplicationId();
|
|
51
|
+
const adminScope = (0, device_sessions_app_scope_util_1.resolveDeviceSessionAdminScope)({
|
|
52
|
+
queryParams: (_a = ctx.request) === null || _a === void 0 ? void 0 : _a.params,
|
|
53
|
+
headerValue: (0, device_sessions_app_scope_util_1.readDeviceSessionAdminScopeHeader)((_b = this.readRequest()) === null || _b === void 0 ? void 0 : _b.headers),
|
|
54
|
+
});
|
|
55
|
+
if (!(0, device_sessions_app_scope_util_1.shouldApplyDeviceSessionApplicationFilter)(adminScope)) {
|
|
56
|
+
yield next();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if ((0, device_sessions_app_scope_util_1.isDeviceSessionApplicationScopeMissingApplicationId)(adminScope, applicationId)) {
|
|
60
|
+
yield this.failClosedMissingApplicationId(ctx, next);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (ctx.op === 'query' && ctx.request) {
|
|
64
|
+
ctx.request = Object.assign(Object.assign({}, ctx.request), { filter: (0, abstract_1.mergeAxpQueryFilters)(ctx.request.filter, {
|
|
65
|
+
logic: 'and',
|
|
66
|
+
filters: [
|
|
67
|
+
{
|
|
68
|
+
field: 'applicationId',
|
|
69
|
+
operator: { type: 'equal' },
|
|
70
|
+
value: applicationId,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}) });
|
|
74
|
+
yield next();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if ((ctx.op === 'update' || ctx.op === 'delete') && ctx.id) {
|
|
78
|
+
const existing = (yield ctx.backend.getOne(ctx.entityName, ctx.id));
|
|
79
|
+
if (existing && String((_c = existing['applicationId']) !== null && _c !== void 0 ? _c : '') !== applicationId) {
|
|
80
|
+
throw new core_1.MiddlewareAbortError('Device session is outside the current application scope.', {
|
|
81
|
+
code: 'SCOPE_READONLY',
|
|
82
|
+
status: 403,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
yield next();
|
|
87
|
+
if (ctx.op === 'getOne') {
|
|
88
|
+
const row = ctx.result;
|
|
89
|
+
if (row && String((_d = row['applicationId']) !== null && _d !== void 0 ? _d : '') !== applicationId) {
|
|
90
|
+
ctx.result = null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
failClosedMissingApplicationId(ctx, next) {
|
|
96
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
if (ctx.op === 'query' && ctx.request) {
|
|
98
|
+
ctx.request = Object.assign(Object.assign({}, ctx.request), { filter: (0, abstract_1.mergeAxpQueryFilters)(ctx.request.filter, {
|
|
99
|
+
logic: 'and',
|
|
100
|
+
filters: [
|
|
101
|
+
{
|
|
102
|
+
field: 'id',
|
|
103
|
+
operator: { type: 'equal' },
|
|
104
|
+
value: NO_APPLICATION_SCOPE_ID,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
}) });
|
|
108
|
+
yield next();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (ctx.op === 'update' || ctx.op === 'delete') {
|
|
112
|
+
throw new core_1.MiddlewareAbortError('Device session application scope requires a current application.', {
|
|
113
|
+
code: 'SCOPE_READONLY',
|
|
114
|
+
status: 403,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
yield next();
|
|
118
|
+
if (ctx.op === 'getOne') {
|
|
119
|
+
ctx.result = null;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
readRequest() {
|
|
124
|
+
return (0, core_1.getEntityStorageRequest)();
|
|
125
|
+
}
|
|
126
|
+
readSessionApplicationId() {
|
|
127
|
+
var _a, _b, _c;
|
|
128
|
+
const applicationId = (_c = (_b = (_a = this.readRequest()) === null || _a === void 0 ? void 0 : _a[security_1.CURRENT_SESSION_KEY]) === null || _b === void 0 ? void 0 : _b.applicationId) === null || _c === void 0 ? void 0 : _c.trim();
|
|
129
|
+
return applicationId || undefined;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.DeviceSessionsAppScopeMiddleware = DeviceSessionsAppScopeMiddleware;
|
|
133
|
+
exports.DeviceSessionsAppScopeMiddleware = DeviceSessionsAppScopeMiddleware = tslib_1.__decorate([
|
|
134
|
+
(0, common_1.Injectable)()
|
|
135
|
+
], DeviceSessionsAppScopeMiddleware);
|
|
136
|
+
//#endregion
|
|
137
|
+
//# sourceMappingURL=device-sessions-app-scope.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-sessions-app-scope.middleware.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/middlewares/device-sessions-app-scope.middleware.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;;AAI7B,iEAYgD;AAEhD,6EAQwD;AAExD,yEAMoD;AAEpD,2CAA4C;AAI5C,qFAU0C;AAoB1C,YAAY;AAIZ,+BAA+B;AAI/B,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAIlE,+E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1,41 @@
|
|
|
1
|
+
import { type AXPDeviceSessionAdminScope } from '../../../../contracts/src/device-session-admin-scope';
|
|
2
|
+
/**
|
|
3
|
+
|
|
4
|
+
* Whether DeviceSessions should apply an additional `applicationId` filter.
|
|
5
|
+
|
|
6
|
+
* Tenant-sessions operation → false; application-sessions → true.
|
|
7
|
+
|
|
8
|
+
* Tenant bound remains `tenant-owner` either way.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
export declare function shouldApplyDeviceSessionApplicationFilter(adminScope: AXPDeviceSessionAdminScope): boolean;
|
|
12
|
+
/**
|
|
13
|
+
|
|
14
|
+
* Application-scoped Device Sessions must not degrade to tenant-wide when
|
|
15
|
+
|
|
16
|
+
* `session.applicationId` is missing.
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
export declare function isDeviceSessionApplicationScopeMissingApplicationId(adminScope: AXPDeviceSessionAdminScope, applicationId: string | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
|
|
22
|
+
* Resolve explicit admin scope from query params and/or HTTP header.
|
|
23
|
+
|
|
24
|
+
* Defaults to application-sessions (narrower scope).
|
|
25
|
+
|
|
26
|
+
*
|
|
27
|
+
|
|
28
|
+
* Note: this value is an operation signal, not an authorization decision.
|
|
29
|
+
|
|
30
|
+
* Tenant-owner isolation still applies; distinguishing who may request
|
|
31
|
+
|
|
32
|
+
* tenant-wide admin scope is a separate auth concern (see audit notes).
|
|
33
|
+
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveDeviceSessionAdminScope(options: {
|
|
36
|
+
queryParams?: Record<string, unknown> | null | undefined;
|
|
37
|
+
headerValue?: string | string[] | null | undefined;
|
|
38
|
+
}): AXPDeviceSessionAdminScope;
|
|
39
|
+
export declare function readDeviceSessionAdminScopeHeader(headers: {
|
|
40
|
+
[key: string]: string | string[] | undefined;
|
|
41
|
+
} | undefined): string | string[] | undefined;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ----- Imports -----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.shouldApplyDeviceSessionApplicationFilter = shouldApplyDeviceSessionApplicationFilter;
|
|
5
|
+
exports.isDeviceSessionApplicationScopeMissingApplicationId = isDeviceSessionApplicationScopeMissingApplicationId;
|
|
6
|
+
exports.resolveDeviceSessionAdminScope = resolveDeviceSessionAdminScope;
|
|
7
|
+
exports.readDeviceSessionAdminScopeHeader = readDeviceSessionAdminScopeHeader;
|
|
8
|
+
const device_session_admin_scope_1 = require("../../../../contracts/src/device-session-admin-scope");
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ----- Device Sessions admin scope resolution -----
|
|
11
|
+
/**
|
|
12
|
+
|
|
13
|
+
* Whether DeviceSessions should apply an additional `applicationId` filter.
|
|
14
|
+
|
|
15
|
+
* Tenant-sessions operation → false; application-sessions → true.
|
|
16
|
+
|
|
17
|
+
* Tenant bound remains `tenant-owner` either way.
|
|
18
|
+
|
|
19
|
+
*/
|
|
20
|
+
function shouldApplyDeviceSessionApplicationFilter(adminScope) {
|
|
21
|
+
return adminScope === 'application';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
|
|
25
|
+
* Application-scoped Device Sessions must not degrade to tenant-wide when
|
|
26
|
+
|
|
27
|
+
* `session.applicationId` is missing.
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
function isDeviceSessionApplicationScopeMissingApplicationId(adminScope, applicationId) {
|
|
31
|
+
return shouldApplyDeviceSessionApplicationFilter(adminScope) && !applicationId;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
|
|
35
|
+
* Resolve explicit admin scope from query params and/or HTTP header.
|
|
36
|
+
|
|
37
|
+
* Defaults to application-sessions (narrower scope).
|
|
38
|
+
|
|
39
|
+
*
|
|
40
|
+
|
|
41
|
+
* Note: this value is an operation signal, not an authorization decision.
|
|
42
|
+
|
|
43
|
+
* Tenant-owner isolation still applies; distinguishing who may request
|
|
44
|
+
|
|
45
|
+
* tenant-wide admin scope is a separate auth concern (see audit notes).
|
|
46
|
+
|
|
47
|
+
*/
|
|
48
|
+
function resolveDeviceSessionAdminScope(options) {
|
|
49
|
+
var _a;
|
|
50
|
+
const fromParams = (_a = options.queryParams) === null || _a === void 0 ? void 0 : _a[device_session_admin_scope_1.AXP_DEVICE_SESSION_ADMIN_SCOPE_PARAM];
|
|
51
|
+
if (fromParams === 'tenant' || fromParams === 'application') {
|
|
52
|
+
return fromParams;
|
|
53
|
+
}
|
|
54
|
+
const header = options.headerValue;
|
|
55
|
+
const headerRaw = Array.isArray(header) ? header[0] : header;
|
|
56
|
+
if (typeof headerRaw === 'string' && headerRaw.trim()) {
|
|
57
|
+
return (0, device_session_admin_scope_1.normalizeDeviceSessionAdminScope)(headerRaw.trim().toLowerCase());
|
|
58
|
+
}
|
|
59
|
+
return 'application';
|
|
60
|
+
}
|
|
61
|
+
function readDeviceSessionAdminScopeHeader(headers) {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!headers) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return ((_a = headers[device_session_admin_scope_1.AXP_DEVICE_SESSION_ADMIN_SCOPE_HEADER]) !== null && _a !== void 0 ? _a : headers[device_session_admin_scope_1.AXP_DEVICE_SESSION_ADMIN_SCOPE_HEADER.toUpperCase()]);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//# sourceMappingURL=device-sessions-app-scope.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-sessions-app-scope.util.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/middlewares/device-sessions-app-scope.util.ts"],"names":[],"mappings":";AAAA,6BAA6B;;AAoC7B,8FAQC;AAYD,kHAUC;AAoBD,wEAgCC;AAID,8EAoBC;AA1ID,qGAU8D;AAI9D,YAAY;AAIZ,4DAA4D;AAI5D;;;;;;;;GAQG;AAEH,SAAgB,yCAAyC,CAEvD,UAAsC;IAItC,OAAO,UAAU,KAAK,aAAa,CAAC;AAEtC,CAAC;AAID;;;;;;GAMG;AAEH,SAAgB,mDAAmD,CAEjE,UAAsC,EAEtC,aAAiC;IAIjC,OAAO,yCAAyC,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC;AAEjF,CAAC;AAID;;;;;;;;;;;;;;GAcG;AAEH,SAAgB,8BAA8B,CAAC,OAM9C;;IAEC,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,WAAW,0CAAG,iEAAoC,CAAC,CAAC;IAE/E,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;QAE5D,OAAO,UAAU,CAAC;IAEpB,CAAC;IAID,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAEnC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QAEtD,OAAO,IAAA,6DAAgC,EAAC,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAE1E,CAAC;IAID,OAAO,aAAa,CAAC;AAEvB,CAAC;AAID,SAAgB,iCAAiC,CAE/C,OAAqE;;IAIrE,IAAI,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,SAAS,CAAC;IAEnB,CAAC;IAED,OAAO,CAEL,MAAA,OAAO,CAAC,kEAAqC,CAAC,mCAE9C,OAAO,CAAC,kEAAqC,CAAC,WAAW,EAAE,CAAC,CAE7D,CAAC;AAEJ,CAAC;AAID,YAAY"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AXPEntityOp, EntityStorageContext, EntityStorageMiddleware, EntityStorageMiddlewareService } from '@acorex-platform/framework-server/core';
|
|
2
|
+
import { AuthService } from '@acorex-platform/framework-server/security';
|
|
3
|
+
/**
|
|
4
|
+
* Projects DeviceSessions revoke (DB SoT) onto Redis (`sid`).
|
|
5
|
+
* Request validation must check Redis only — see device-session-revocation.mdc.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DeviceSessionsTokenRevokeMiddleware implements EntityStorageMiddleware {
|
|
8
|
+
private readonly auth;
|
|
9
|
+
private readonly storage;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
readonly target: {
|
|
12
|
+
entity: string;
|
|
13
|
+
ops: AXPEntityOp[];
|
|
14
|
+
order: number;
|
|
15
|
+
};
|
|
16
|
+
constructor(auth: AuthService, storage: EntityStorageMiddlewareService);
|
|
17
|
+
execute(ctx: EntityStorageContext, next: () => Promise<void>): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ----- Imports -----
|
|
3
|
+
var DeviceSessionsTokenRevokeMiddleware_1;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.DeviceSessionsTokenRevokeMiddleware = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const core_1 = require("@acorex-platform/framework-server/core");
|
|
8
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ----- Constants -----
|
|
12
|
+
const DEVICE_SESSION_ENTITY = 'SecurityManagement.DeviceSessions';
|
|
13
|
+
const REVOKED = 'revoked';
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ----- Helpers -----
|
|
16
|
+
function rowSessionId(row) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (typeof row.sessionId === 'string' && row.sessionId.trim()) {
|
|
19
|
+
return row.sessionId.trim();
|
|
20
|
+
}
|
|
21
|
+
const configSid = (_a = row.config) === null || _a === void 0 ? void 0 : _a.sessionId;
|
|
22
|
+
return typeof configSid === 'string' ? configSid.trim() : '';
|
|
23
|
+
}
|
|
24
|
+
function isRevokedStatus(value) {
|
|
25
|
+
return String(value !== null && value !== void 0 ? value : '')
|
|
26
|
+
.trim()
|
|
27
|
+
.toLowerCase() === REVOKED;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ----- Device sessions JWT revoke middleware -----
|
|
31
|
+
/**
|
|
32
|
+
* Projects DeviceSessions revoke (DB SoT) onto Redis (`sid`).
|
|
33
|
+
* Request validation must check Redis only — see device-session-revocation.mdc.
|
|
34
|
+
*/
|
|
35
|
+
let DeviceSessionsTokenRevokeMiddleware = DeviceSessionsTokenRevokeMiddleware_1 = class DeviceSessionsTokenRevokeMiddleware {
|
|
36
|
+
constructor(auth, storage) {
|
|
37
|
+
this.auth = auth;
|
|
38
|
+
this.storage = storage;
|
|
39
|
+
this.logger = new common_1.Logger(DeviceSessionsTokenRevokeMiddleware_1.name);
|
|
40
|
+
this.target = {
|
|
41
|
+
entity: DEVICE_SESSION_ENTITY,
|
|
42
|
+
ops: ['update'],
|
|
43
|
+
order: 30,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
execute(ctx, next) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
var _a;
|
|
49
|
+
const patchStatus = (_a = ctx.data) === null || _a === void 0 ? void 0 : _a['status'];
|
|
50
|
+
const patchRequestsRevoke = isRevokedStatus(patchStatus);
|
|
51
|
+
yield next();
|
|
52
|
+
if (!patchRequestsRevoke || !ctx.result || typeof ctx.result !== 'object') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let row = ctx.result;
|
|
56
|
+
if (!isRevokedStatus(row.status)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let sid = rowSessionId(row);
|
|
60
|
+
const entityId = typeof row.id === 'string' ? row.id : typeof ctx.id === 'string' ? ctx.id : '';
|
|
61
|
+
let userId = typeof row.userId === 'string' ? row.userId.trim() : '';
|
|
62
|
+
if ((!sid || !userId) && entityId) {
|
|
63
|
+
// Update responses can omit nested/legacy fields — reload for sessionId / userId.
|
|
64
|
+
const full = (yield this.storage.getOneAsEngine(DEVICE_SESSION_ENTITY, entityId));
|
|
65
|
+
if (full) {
|
|
66
|
+
row = full;
|
|
67
|
+
sid = rowSessionId(row);
|
|
68
|
+
userId = typeof row.userId === 'string' ? row.userId.trim() : userId;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!sid) {
|
|
72
|
+
this.logger.warn(`Device session ${entityId || '(unknown)'} revoked without sessionId; JWT family not invalidated`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
yield this.auth.invalidateLoginSession(sid);
|
|
76
|
+
this.logger.warn(`DeviceSessions revoke projected JWT family invalidate + session_terminated: sid=${sid} userId=${userId || '(unknown)'} entityId=${entityId || '(unknown)'}`);
|
|
77
|
+
if (userId) {
|
|
78
|
+
this.auth.notifyRemoteSessionTerminated(userId, sid);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
exports.DeviceSessionsTokenRevokeMiddleware = DeviceSessionsTokenRevokeMiddleware;
|
|
84
|
+
exports.DeviceSessionsTokenRevokeMiddleware = DeviceSessionsTokenRevokeMiddleware = DeviceSessionsTokenRevokeMiddleware_1 = tslib_1.__decorate([
|
|
85
|
+
(0, common_1.Injectable)(),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [security_1.AuthService,
|
|
87
|
+
core_1.EntityStorageMiddlewareService])
|
|
88
|
+
], DeviceSessionsTokenRevokeMiddleware);
|
|
89
|
+
//#endregion
|
|
90
|
+
//# sourceMappingURL=device-sessions-token-revoke.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-sessions-token-revoke.middleware.js","sourceRoot":"","sources":["../../../../../../../libs/modules/security-management/server/src/lib/middlewares/device-sessions-token-revoke.middleware.ts"],"names":[],"mappings":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