@adonis-agora/authkit-server 0.34.0
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/LICENSE +21 -0
- package/README.md +158 -0
- package/build/assets/grafana/authkit-dashboard.json +118 -0
- package/build/commands/clients_create.d.ts +27 -0
- package/build/commands/clients_create.js +121 -0
- package/build/commands/commands.json +292 -0
- package/build/commands/configure.d.ts +2 -0
- package/build/commands/configure.js +45 -0
- package/build/commands/doctor.d.ts +10 -0
- package/build/commands/doctor.js +113 -0
- package/build/commands/eject.d.ts +11 -0
- package/build/commands/eject.js +96 -0
- package/build/commands/expire_scan.d.ts +28 -0
- package/build/commands/expire_scan.js +92 -0
- package/build/commands/import_users.d.ts +17 -0
- package/build/commands/import_users.js +80 -0
- package/build/commands/keys_rotate.d.ts +21 -0
- package/build/commands/keys_rotate.js +126 -0
- package/build/commands/main.d.ts +12 -0
- package/build/commands/main.js +38 -0
- package/build/commands/settings_get.d.ts +18 -0
- package/build/commands/settings_get.js +43 -0
- package/build/commands/settings_list.d.ts +17 -0
- package/build/commands/settings_list.js +39 -0
- package/build/commands/settings_set.d.ts +20 -0
- package/build/commands/settings_set.js +55 -0
- package/build/commands/settings_unset.d.ts +18 -0
- package/build/commands/settings_unset.js +46 -0
- package/build/commands/ui_preset.d.ts +4 -0
- package/build/commands/ui_preset.js +32 -0
- package/build/database/migrations/make_authkit_oidc_table.d.ts +6 -0
- package/build/database/migrations/make_authkit_oidc_table.js +19 -0
- package/build/host/ui/admin.html +29 -0
- package/build/host/views/account/apps.edge +59 -0
- package/build/host/views/account/confirm.edge +70 -0
- package/build/host/views/account/email-confirmed.edge +16 -0
- package/build/host/views/account/login.edge +33 -0
- package/build/host/views/account/mfa.edge +152 -0
- package/build/host/views/account/orgs.edge +58 -0
- package/build/host/views/account/security.edge +215 -0
- package/build/host/views/account/tokens.edge +75 -0
- package/build/host/views/consent.edge +20 -0
- package/build/host/views/forgot.edge +43 -0
- package/build/host/views/login.edge +251 -0
- package/build/host/views/maintenance.edge +32 -0
- package/build/host/views/mfa-challenge.edge +107 -0
- package/build/host/views/otp-unlock.edge +40 -0
- package/build/host/views/partials/styles.edge +2 -0
- package/build/host/views/reset.edge +30 -0
- package/build/host/views/signup.edge +62 -0
- package/build/host/views/verify-email.edge +17 -0
- package/build/index.d.ts +115 -0
- package/build/index.js +76 -0
- package/build/password/common_passwords.txt +10000 -0
- package/build/providers/authkit_server_provider.d.ts +27 -0
- package/build/providers/authkit_server_provider.js +242 -0
- package/build/src/accounts/account_store.d.ts +578 -0
- package/build/src/accounts/account_store.js +60 -0
- package/build/src/accounts/lucid_account_store.d.ts +156 -0
- package/build/src/accounts/lucid_account_store.js +294 -0
- package/build/src/accounts/lucid_store/core.d.ts +9 -0
- package/build/src/accounts/lucid_store/core.js +306 -0
- package/build/src/accounts/lucid_store/mfa.d.ts +15 -0
- package/build/src/accounts/lucid_store/mfa.js +108 -0
- package/build/src/accounts/lucid_store/organizations.d.ts +13 -0
- package/build/src/accounts/lucid_store/organizations.js +294 -0
- package/build/src/accounts/lucid_store/password_hygiene.d.ts +20 -0
- package/build/src/accounts/lucid_store/password_hygiene.js +130 -0
- package/build/src/accounts/lucid_store/provider_identity.d.ts +8 -0
- package/build/src/accounts/lucid_store/provider_identity.js +59 -0
- package/build/src/accounts/lucid_store/shared.d.ts +113 -0
- package/build/src/accounts/lucid_store/shared.js +130 -0
- package/build/src/accounts/lucid_store/status_profile.d.ts +34 -0
- package/build/src/accounts/lucid_store/status_profile.js +100 -0
- package/build/src/accounts/lucid_store/webauthn.d.ts +8 -0
- package/build/src/accounts/lucid_store/webauthn.js +140 -0
- package/build/src/accounts/lucid_stores.d.ts +45 -0
- package/build/src/accounts/lucid_stores.js +30 -0
- package/build/src/adapters/adapter_contract.d.ts +37 -0
- package/build/src/adapters/adapter_contract.js +1 -0
- package/build/src/adapters/database_adapter.d.ts +21 -0
- package/build/src/adapters/database_adapter.js +79 -0
- package/build/src/adapters/factory.d.ts +30 -0
- package/build/src/adapters/factory.js +43 -0
- package/build/src/adapters/redis_adapter.d.ts +24 -0
- package/build/src/adapters/redis_adapter.js +122 -0
- package/build/src/audit/audit_sink.d.ts +63 -0
- package/build/src/audit/audit_sink.js +1 -0
- package/build/src/audit/lucid_audit_sink.d.ts +10 -0
- package/build/src/audit/lucid_audit_sink.js +99 -0
- package/build/src/commands/expire_scan_command.d.ts +60 -0
- package/build/src/commands/expire_scan_command.js +229 -0
- package/build/src/commands/import_clients.d.ts +40 -0
- package/build/src/commands/import_clients.js +79 -0
- package/build/src/commands/import_users.d.ts +51 -0
- package/build/src/commands/import_users.js +94 -0
- package/build/src/commands/resolve_config.d.ts +13 -0
- package/build/src/commands/resolve_config.js +18 -0
- package/build/src/commands/settings_commands.d.ts +47 -0
- package/build/src/commands/settings_commands.js +270 -0
- package/build/src/controllers/oidc_callback_controller.d.ts +22 -0
- package/build/src/controllers/oidc_callback_controller.js +33 -0
- package/build/src/define_config.d.ts +772 -0
- package/build/src/define_config.js +351 -0
- package/build/src/doctor/checks.d.ts +197 -0
- package/build/src/doctor/checks.js +858 -0
- package/build/src/events/dispatcher.d.ts +45 -0
- package/build/src/events/dispatcher.js +117 -0
- package/build/src/host/account_api/account_api_controller.d.ts +245 -0
- package/build/src/host/account_api/account_api_controller.js +827 -0
- package/build/src/host/account_deletion_ops.d.ts +80 -0
- package/build/src/host/account_deletion_ops.js +118 -0
- package/build/src/host/account_deletion_service.d.ts +63 -0
- package/build/src/host/account_deletion_service.js +133 -0
- package/build/src/host/account_export_service.d.ts +76 -0
- package/build/src/host/account_export_service.js +140 -0
- package/build/src/host/account_home.d.ts +11 -0
- package/build/src/host/account_home.js +11 -0
- package/build/src/host/account_lockout.d.ts +86 -0
- package/build/src/host/account_lockout.js +185 -0
- package/build/src/host/active_org_cookie.d.ts +28 -0
- package/build/src/host/active_org_cookie.js +47 -0
- package/build/src/host/admin_api/admin_api_guard.d.ts +16 -0
- package/build/src/host/admin_api/admin_api_guard.js +59 -0
- package/build/src/host/admin_api/admin_orgs_service.d.ts +125 -0
- package/build/src/host/admin_api/admin_orgs_service.js +324 -0
- package/build/src/host/admin_api/admin_users_service.d.ts +163 -0
- package/build/src/host/admin_api/admin_users_service.js +308 -0
- package/build/src/host/admin_api/api_clients_controller.d.ts +54 -0
- package/build/src/host/admin_api/api_clients_controller.js +89 -0
- package/build/src/host/admin_api/api_keys_controller.d.ts +19 -0
- package/build/src/host/admin_api/api_keys_controller.js +36 -0
- package/build/src/host/admin_api/api_misc_controller.d.ts +19 -0
- package/build/src/host/admin_api/api_misc_controller.js +44 -0
- package/build/src/host/admin_api/api_orgs_controller.d.ts +108 -0
- package/build/src/host/admin_api/api_orgs_controller.js +189 -0
- package/build/src/host/admin_api/api_settings_controller.d.ts +55 -0
- package/build/src/host/admin_api/api_settings_controller.js +134 -0
- package/build/src/host/admin_api/api_users_controller.d.ts +108 -0
- package/build/src/host/admin_api/api_users_controller.js +187 -0
- package/build/src/host/admin_api/dto.d.ts +131 -0
- package/build/src/host/admin_api/dto.js +122 -0
- package/build/src/host/admin_api/token_verify_service.d.ts +34 -0
- package/build/src/host/admin_api/token_verify_service.js +74 -0
- package/build/src/host/admin_clients_service.d.ts +88 -0
- package/build/src/host/admin_clients_service.js +181 -0
- package/build/src/host/admin_console/admin_shell_controller.d.ts +27 -0
- package/build/src/host/admin_console/admin_shell_controller.js +167 -0
- package/build/src/host/admin_console/console_audit_controller.d.ts +17 -0
- package/build/src/host/admin_console/console_audit_controller.js +25 -0
- package/build/src/host/admin_console/console_clients_controller.d.ts +53 -0
- package/build/src/host/admin_console/console_clients_controller.js +102 -0
- package/build/src/host/admin_console/console_impersonation_controller.d.ts +23 -0
- package/build/src/host/admin_console/console_impersonation_controller.js +45 -0
- package/build/src/host/admin_console/console_keys_controller.d.ts +24 -0
- package/build/src/host/admin_console/console_keys_controller.js +41 -0
- package/build/src/host/admin_console/console_orgs_controller.d.ts +96 -0
- package/build/src/host/admin_console/console_orgs_controller.js +238 -0
- package/build/src/host/admin_console/console_overview_controller.d.ts +27 -0
- package/build/src/host/admin_console/console_overview_controller.js +44 -0
- package/build/src/host/admin_console/console_roles_controller.d.ts +31 -0
- package/build/src/host/admin_console/console_roles_controller.js +108 -0
- package/build/src/host/admin_console/console_sessions_controller.d.ts +91 -0
- package/build/src/host/admin_console/console_sessions_controller.js +125 -0
- package/build/src/host/admin_console/console_settings_controller.d.ts +47 -0
- package/build/src/host/admin_console/console_settings_controller.js +115 -0
- package/build/src/host/admin_console/console_users_controller.d.ts +110 -0
- package/build/src/host/admin_console/console_users_controller.js +212 -0
- package/build/src/host/admin_prefix.d.ts +50 -0
- package/build/src/host/admin_prefix.js +77 -0
- package/build/src/host/admin_sessions_service.d.ts +119 -0
- package/build/src/host/admin_sessions_service.js +284 -0
- package/build/src/host/admin_stats_service.d.ts +44 -0
- package/build/src/host/admin_stats_service.js +130 -0
- package/build/src/host/admin_validators.d.ts +247 -0
- package/build/src/host/admin_validators.js +197 -0
- package/build/src/host/augmentations.d.ts +12 -0
- package/build/src/host/augmentations.js +1 -0
- package/build/src/host/auth_host_config.d.ts +22 -0
- package/build/src/host/auth_host_config.js +13 -0
- package/build/src/host/avatar_storage.d.ts +68 -0
- package/build/src/host/avatar_storage.js +166 -0
- package/build/src/host/bot_protection.d.ts +187 -0
- package/build/src/host/bot_protection.js +132 -0
- package/build/src/host/branding.d.ts +19 -0
- package/build/src/host/branding.js +8 -0
- package/build/src/host/config_locks.d.ts +38 -0
- package/build/src/host/config_locks.js +70 -0
- package/build/src/host/console_session.d.ts +27 -0
- package/build/src/host/console_session.js +36 -0
- package/build/src/host/controllers/account_apps_controller.d.ts +15 -0
- package/build/src/host/controllers/account_apps_controller.js +61 -0
- package/build/src/host/controllers/account_confirm_controller.d.ts +24 -0
- package/build/src/host/controllers/account_confirm_controller.js +144 -0
- package/build/src/host/controllers/account_mfa_controller.d.ts +28 -0
- package/build/src/host/controllers/account_mfa_controller.js +208 -0
- package/build/src/host/controllers/account_orgs_controller.d.ts +80 -0
- package/build/src/host/controllers/account_orgs_controller.js +401 -0
- package/build/src/host/controllers/account_security_controller.d.ts +43 -0
- package/build/src/host/controllers/account_security_controller.js +546 -0
- package/build/src/host/controllers/account_session_controller.d.ts +21 -0
- package/build/src/host/controllers/account_session_controller.js +113 -0
- package/build/src/host/controllers/account_tokens_controller.d.ts +7 -0
- package/build/src/host/controllers/account_tokens_controller.js +67 -0
- package/build/src/host/controllers/interaction_controller.d.ts +125 -0
- package/build/src/host/controllers/interaction_controller.js +981 -0
- package/build/src/host/controllers/pat_introspection_controller.d.ts +22 -0
- package/build/src/host/controllers/pat_introspection_controller.js +46 -0
- package/build/src/host/controllers/registration_controller.d.ts +18 -0
- package/build/src/host/controllers/registration_controller.js +382 -0
- package/build/src/host/controllers/social_controller.d.ts +8 -0
- package/build/src/host/controllers/social_controller.js +89 -0
- package/build/src/host/csrf.d.ts +29 -0
- package/build/src/host/csrf.js +14 -0
- package/build/src/host/default_mailer.d.ts +112 -0
- package/build/src/host/default_mailer.js +417 -0
- package/build/src/host/durable/account_deletion_workflow.d.ts +48 -0
- package/build/src/host/durable/account_deletion_workflow.js +86 -0
- package/build/src/host/durable/account_export_workflow.d.ts +68 -0
- package/build/src/host/durable/account_export_workflow.js +93 -0
- package/build/src/host/durable/index.d.ts +68 -0
- package/build/src/host/durable/index.js +77 -0
- package/build/src/host/email_templates.d.ts +39 -0
- package/build/src/host/email_templates.js +69 -0
- package/build/src/host/geo.d.ts +22 -0
- package/build/src/host/geo.js +39 -0
- package/build/src/host/i18n.d.ts +1416 -0
- package/build/src/host/i18n.js +1583 -0
- package/build/src/host/impersonation.d.ts +25 -0
- package/build/src/host/impersonation.js +31 -0
- package/build/src/host/key_rotation.d.ts +14 -0
- package/build/src/host/key_rotation.js +27 -0
- package/build/src/host/key_rotation_actions.d.ts +42 -0
- package/build/src/host/key_rotation_actions.js +27 -0
- package/build/src/host/login_attempt.d.ts +98 -0
- package/build/src/host/login_attempt.js +211 -0
- package/build/src/host/login_notify.d.ts +27 -0
- package/build/src/host/login_notify.js +142 -0
- package/build/src/host/middleware/account_auth.d.ts +7 -0
- package/build/src/host/middleware/account_auth.js +11 -0
- package/build/src/host/otp_lockout.d.ts +103 -0
- package/build/src/host/otp_lockout.js +221 -0
- package/build/src/host/rate_limit.d.ts +39 -0
- package/build/src/host/rate_limit.js +94 -0
- package/build/src/host/register_auth_host.d.ts +97 -0
- package/build/src/host/register_auth_host.js +466 -0
- package/build/src/host/renderers/edge_renderer.d.ts +12 -0
- package/build/src/host/renderers/edge_renderer.js +38 -0
- package/build/src/host/renderers/inertia_renderer.d.ts +70 -0
- package/build/src/host/renderers/inertia_renderer.js +54 -0
- package/build/src/host/runtime_settings.d.ts +181 -0
- package/build/src/host/runtime_settings.js +307 -0
- package/build/src/host/runtime_toggles.d.ts +807 -0
- package/build/src/host/runtime_toggles.js +784 -0
- package/build/src/host/security_notice_service.d.ts +36 -0
- package/build/src/host/security_notice_service.js +87 -0
- package/build/src/host/session_context.d.ts +23 -0
- package/build/src/host/session_context.js +89 -0
- package/build/src/host/sudo_mode.d.ts +56 -0
- package/build/src/host/sudo_mode.js +99 -0
- package/build/src/host/svg_chart.d.ts +15 -0
- package/build/src/host/svg_chart.js +45 -0
- package/build/src/host/trusted_device.d.ts +61 -0
- package/build/src/host/trusted_device.js +65 -0
- package/build/src/host/ui-dist/assets/index-CRWcmsex.js +137 -0
- package/build/src/host/ui-dist/assets/index-DTSmD4RU.css +1 -0
- package/build/src/host/ui-dist/index.html +17 -0
- package/build/src/host/user_agent.d.ts +18 -0
- package/build/src/host/user_agent.js +50 -0
- package/build/src/host/validators.d.ts +127 -0
- package/build/src/host/validators.js +53 -0
- package/build/src/keys/jwks_manager.d.ts +6 -0
- package/build/src/keys/jwks_manager.js +11 -0
- package/build/src/keys/keystore.d.ts +52 -0
- package/build/src/keys/keystore.js +68 -0
- package/build/src/keys/keystore_codec.d.ts +20 -0
- package/build/src/keys/keystore_codec.js +42 -0
- package/build/src/keys/keystore_crypto.d.ts +9 -0
- package/build/src/keys/keystore_crypto.js +27 -0
- package/build/src/keys/keystore_manager.d.ts +43 -0
- package/build/src/keys/keystore_manager.js +104 -0
- package/build/src/keys/keystore_vault.d.ts +113 -0
- package/build/src/keys/keystore_vault.js +265 -0
- package/build/src/mixins/json_column.d.ts +33 -0
- package/build/src/mixins/json_column.js +38 -0
- package/build/src/mixins/with_audit_log.d.ts +19 -0
- package/build/src/mixins/with_audit_log.js +39 -0
- package/build/src/mixins/with_auth_user.d.ts +24 -0
- package/build/src/mixins/with_auth_user.js +46 -0
- package/build/src/mixins/with_credentials.d.ts +20 -0
- package/build/src/mixins/with_credentials.js +29 -0
- package/build/src/mixins/with_mfa.d.ts +35 -0
- package/build/src/mixins/with_mfa.js +21 -0
- package/build/src/mixins/with_personal_access_token.d.ts +19 -0
- package/build/src/mixins/with_personal_access_token.js +42 -0
- package/build/src/mixins/with_provider_identity.d.ts +20 -0
- package/build/src/mixins/with_provider_identity.js +32 -0
- package/build/src/mixins/with_webauthn_credential.d.ts +37 -0
- package/build/src/mixins/with_webauthn_credential.js +46 -0
- package/build/src/observability/diagnostics_bridge.d.ts +6 -0
- package/build/src/observability/diagnostics_bridge.js +27 -0
- package/build/src/observability/metrics_controller.d.ts +5 -0
- package/build/src/observability/metrics_controller.js +24 -0
- package/build/src/observability/metrics_service.d.ts +2 -0
- package/build/src/observability/metrics_service.js +7 -0
- package/build/src/observability/otel_recorder.d.ts +10 -0
- package/build/src/observability/otel_recorder.js +59 -0
- package/build/src/observability/telescope/data_providers.d.ts +24 -0
- package/build/src/observability/telescope/data_providers.js +235 -0
- package/build/src/observability/telescope/extension.d.ts +29 -0
- package/build/src/observability/telescope/extension.js +167 -0
- package/build/src/observability/telescope/index.d.ts +8 -0
- package/build/src/observability/telescope/index.js +8 -0
- package/build/src/observability/wire_provider_events.d.ts +12 -0
- package/build/src/observability/wire_provider_events.js +30 -0
- package/build/src/password/common_passwords.d.ts +31 -0
- package/build/src/password/common_passwords.js +73 -0
- package/build/src/password/password_manager.d.ts +163 -0
- package/build/src/password/password_manager.js +191 -0
- package/build/src/password/policy.d.ts +71 -0
- package/build/src/password/policy.js +55 -0
- package/build/src/password/pwned.d.ts +36 -0
- package/build/src/password/pwned.js +52 -0
- package/build/src/pat/lucid_pat_store.d.ts +6 -0
- package/build/src/pat/lucid_pat_store.js +62 -0
- package/build/src/pat/pat_store.d.ts +31 -0
- package/build/src/pat/pat_store.js +1 -0
- package/build/src/pat/pat_tokens.d.ts +4 -0
- package/build/src/pat/pat_tokens.js +9 -0
- package/build/src/provider/build_provider.d.ts +45 -0
- package/build/src/provider/build_provider.js +219 -0
- package/build/src/provider/device_sources.d.ts +6 -0
- package/build/src/provider/device_sources.js +65 -0
- package/build/src/provider/interaction_actions.d.ts +36 -0
- package/build/src/provider/interaction_actions.js +55 -0
- package/build/src/provider/key_rotation_scheduler.d.ts +28 -0
- package/build/src/provider/key_rotation_scheduler.js +40 -0
- package/build/src/provider/keystore_reload.d.ts +21 -0
- package/build/src/provider/keystore_reload.js +39 -0
- package/build/src/provider/logout_sources.d.ts +13 -0
- package/build/src/provider/logout_sources.js +64 -0
- package/build/src/provider/oidc_service.d.ts +81 -0
- package/build/src/provider/oidc_service.js +254 -0
- package/build/src/provider/single_flight_lock.d.ts +18 -0
- package/build/src/provider/single_flight_lock.js +31 -0
- package/build/src/provider/token_exchange.d.ts +21 -0
- package/build/src/provider/token_exchange.js +124 -0
- package/build/src/register_routes.d.ts +16 -0
- package/build/src/register_routes.js +21 -0
- package/build/src/schema/ensure.d.ts +41 -0
- package/build/src/schema/ensure.js +262 -0
- package/build/stubs/config/authkit.stub +20 -0
- package/build/stubs/config/authkit_react.stub +52 -0
- package/build/stubs/main.d.ts +1 -0
- package/build/stubs/main.js +2 -0
- package/build/stubs/models/auth_user.stub +22 -0
- package/build/stubs/ui/edge/views/consent.edge +13 -0
- package/build/stubs/ui/edge/views/login.edge +19 -0
- package/build/stubs/ui/react/components/auth_shell.tsx +67 -0
- package/build/stubs/ui/react/pages/account/login.tsx +56 -0
- package/build/stubs/ui/react/pages/account/mfa.tsx +132 -0
- package/build/stubs/ui/react/pages/account/tokens.tsx +88 -0
- package/build/stubs/ui/react/pages/consent.tsx +39 -0
- package/build/stubs/ui/react/pages/forgot.tsx +44 -0
- package/build/stubs/ui/react/pages/login.tsx +171 -0
- package/build/stubs/ui/react/pages/mfa-challenge.tsx +72 -0
- package/build/stubs/ui/react/pages/reset.tsx +58 -0
- package/build/stubs/ui/react/pages/signup.tsx +78 -0
- package/build/stubs/ui/react/pages/verify-email.tsx +24 -0
- package/build/types.d.ts +7 -0
- package/build/types.js +1 -0
- package/package.json +147 -0
- package/stubs/config/authkit.stub +20 -0
- package/stubs/config/authkit_react.stub +52 -0
- package/stubs/main.ts +2 -0
- package/stubs/models/auth_user.stub +22 -0
- package/stubs/ui/edge/views/consent.edge +13 -0
- package/stubs/ui/edge/views/login.edge +19 -0
- package/stubs/ui/react/components/auth_shell.tsx +67 -0
- package/stubs/ui/react/pages/account/login.tsx +56 -0
- package/stubs/ui/react/pages/account/mfa.tsx +132 -0
- package/stubs/ui/react/pages/account/tokens.tsx +88 -0
- package/stubs/ui/react/pages/consent.tsx +39 -0
- package/stubs/ui/react/pages/forgot.tsx +44 -0
- package/stubs/ui/react/pages/login.tsx +171 -0
- package/stubs/ui/react/pages/mfa-challenge.tsx +72 -0
- package/stubs/ui/react/pages/reset.tsx +58 -0
- package/stubs/ui/react/pages/signup.tsx +78 -0
- package/stubs/ui/react/pages/verify-email.tsx +24 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { ClientInput, TokenEndpointAuthMethod } from './admin_clients_service.js';
|
|
2
|
+
/**
|
|
3
|
+
* Input de client OIDC — serve create E update (PATCH). Tudo opcional: no create
|
|
4
|
+
* o controller aplica defaults (ver {@link clientCreateInput}); no update os campos
|
|
5
|
+
* ausentes (undefined) são preservados pelo `AdminClientsService.update` (merge,
|
|
6
|
+
* ver {@link clientPartialInput}). `grants` é aceito como alias de `grantTypes`
|
|
7
|
+
* (o DTO de saída usa `grants`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const clientInputValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
10
|
+
clientId: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
11
|
+
redirectUris: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineString>>;
|
|
12
|
+
postLogoutRedirectUris: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineString>>;
|
|
13
|
+
grantTypes: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineEnum<readonly ["authorization_code", "refresh_token", "client_credentials", "urn:ietf:params:oauth:grant-type:token-exchange"]>>>;
|
|
14
|
+
grants: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineEnum<readonly ["authorization_code", "refresh_token", "client_credentials", "urn:ietf:params:oauth:grant-type:token-exchange"]>>>;
|
|
15
|
+
tokenEndpointAuthMethod: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineEnum<readonly ["client_secret_basic", "client_secret_post", "none"]>>;
|
|
16
|
+
backchannelLogoutUri: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
17
|
+
backchannelLogoutSessionRequired: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
18
|
+
}, {
|
|
19
|
+
clientId?: string | null | undefined;
|
|
20
|
+
grants?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | null | undefined;
|
|
21
|
+
redirectUris?: string[] | null | undefined;
|
|
22
|
+
postLogoutRedirectUris?: string[] | null | undefined;
|
|
23
|
+
grantTypes?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | null | undefined;
|
|
24
|
+
tokenEndpointAuthMethod?: "none" | "client_secret_basic" | "client_secret_post" | null | undefined;
|
|
25
|
+
backchannelLogoutUri?: string | null | undefined;
|
|
26
|
+
backchannelLogoutSessionRequired?: string | number | boolean | null | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
clientId?: string | undefined;
|
|
29
|
+
grants?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | undefined;
|
|
30
|
+
redirectUris?: string[] | undefined;
|
|
31
|
+
postLogoutRedirectUris?: string[] | undefined;
|
|
32
|
+
grantTypes?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | undefined;
|
|
33
|
+
tokenEndpointAuthMethod?: "none" | "client_secret_basic" | "client_secret_post" | undefined;
|
|
34
|
+
backchannelLogoutUri?: string | undefined;
|
|
35
|
+
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
clientId?: string | undefined;
|
|
38
|
+
grants?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | undefined;
|
|
39
|
+
redirectUris?: string[] | undefined;
|
|
40
|
+
postLogoutRedirectUris?: string[] | undefined;
|
|
41
|
+
grantTypes?: ("refresh_token" | "authorization_code" | "urn:ietf:params:oauth:grant-type:token-exchange" | "client_credentials")[] | undefined;
|
|
42
|
+
tokenEndpointAuthMethod?: "none" | "client_secret_basic" | "client_secret_post" | undefined;
|
|
43
|
+
backchannelLogoutUri?: string | undefined;
|
|
44
|
+
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
45
|
+
}>, Record<string, any> | undefined>;
|
|
46
|
+
/** Forma validada de um client (saída do {@link clientInputValidator}). */
|
|
47
|
+
export type ClientInputFields = {
|
|
48
|
+
clientId?: string;
|
|
49
|
+
redirectUris?: string[];
|
|
50
|
+
postLogoutRedirectUris?: string[];
|
|
51
|
+
grantTypes?: string[];
|
|
52
|
+
grants?: string[];
|
|
53
|
+
tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
|
|
54
|
+
backchannelLogoutUri?: string;
|
|
55
|
+
backchannelLogoutSessionRequired?: boolean;
|
|
56
|
+
};
|
|
57
|
+
/** Mapeia o input validado para um {@link ClientInput} COMPLETO (create), com defaults. */
|
|
58
|
+
export declare function clientCreateInput(v: ClientInputFields): ClientInput;
|
|
59
|
+
/**
|
|
60
|
+
* Mapeia o input validado para um {@link ClientInput} PARCIAL (PATCH): só inclui
|
|
61
|
+
* os campos presentes; o `AdminClientsService.update` preserva o resto via merge.
|
|
62
|
+
*/
|
|
63
|
+
export declare function clientPartialInput(v: ClientInputFields): Partial<ClientInput>;
|
|
64
|
+
/**
|
|
65
|
+
* Criação de usuário pelo admin (API + console). E-mail obrigatório e validado;
|
|
66
|
+
* nome/senha opcionais; `invite:true` cria sem senha e dispara o convite. A
|
|
67
|
+
* política de senha (força, comprimento mínimo do projeto) é checada DEPOIS pelo
|
|
68
|
+
* AdminUsersService.create (retorna `password_policy`); por isso aqui NÃO fixamos
|
|
69
|
+
* `minLength` — seria duplicar/contornar a policy configurável do projeto.
|
|
70
|
+
*/
|
|
71
|
+
export declare const adminUserCreateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
72
|
+
email: import("@vinejs/vine").VineString;
|
|
73
|
+
name: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
74
|
+
password: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
75
|
+
invite: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
76
|
+
}, {
|
|
77
|
+
name?: string | null | undefined;
|
|
78
|
+
password?: string | null | undefined;
|
|
79
|
+
invite?: string | number | boolean | null | undefined;
|
|
80
|
+
email: string;
|
|
81
|
+
}, {
|
|
82
|
+
name?: string | undefined;
|
|
83
|
+
password?: string | undefined;
|
|
84
|
+
invite?: boolean | undefined;
|
|
85
|
+
email: string;
|
|
86
|
+
}, {
|
|
87
|
+
name?: string | undefined;
|
|
88
|
+
password?: string | undefined;
|
|
89
|
+
invite?: boolean | undefined;
|
|
90
|
+
email: string;
|
|
91
|
+
}>, Record<string, any> | undefined>;
|
|
92
|
+
/** Atualização de usuário (PATCH): roles globais e/ou perfil. Tudo opcional. */
|
|
93
|
+
export declare const adminUserUpdateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
94
|
+
globalRoles: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineString>>;
|
|
95
|
+
name: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
96
|
+
avatarUrl: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
97
|
+
}, {
|
|
98
|
+
name?: string | null | undefined;
|
|
99
|
+
globalRoles?: string[] | null | undefined;
|
|
100
|
+
avatarUrl?: string | null | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
name?: string | null | undefined;
|
|
103
|
+
globalRoles?: string[] | undefined;
|
|
104
|
+
avatarUrl?: string | null | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
name?: string | null | undefined;
|
|
107
|
+
globalRoles?: string[] | undefined;
|
|
108
|
+
avatarUrl?: string | null | undefined;
|
|
109
|
+
}>, Record<string, any> | undefined>;
|
|
110
|
+
/** Substituição de roles globais no console (PATCH /users/:id/roles). */
|
|
111
|
+
export declare const adminUserRolesValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
112
|
+
roles: import("@vinejs/vine").OptionalModifier<import("@vinejs/vine").VineArray<import("@vinejs/vine").VineString>>;
|
|
113
|
+
}, {
|
|
114
|
+
roles?: string[] | null | undefined;
|
|
115
|
+
}, {
|
|
116
|
+
roles?: string[] | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
roles?: string[] | undefined;
|
|
119
|
+
}>, Record<string, any> | undefined>;
|
|
120
|
+
/** Criação de org: name, slug e ownerAccountId obrigatórios; logo opcional. */
|
|
121
|
+
export declare const orgCreateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
122
|
+
name: import("@vinejs/vine").VineString;
|
|
123
|
+
slug: import("@vinejs/vine").VineString;
|
|
124
|
+
ownerAccountId: import("@vinejs/vine").VineString;
|
|
125
|
+
logoUrl: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
126
|
+
}, {
|
|
127
|
+
logoUrl?: string | null | undefined;
|
|
128
|
+
name: string;
|
|
129
|
+
slug: string;
|
|
130
|
+
ownerAccountId: string;
|
|
131
|
+
}, {
|
|
132
|
+
logoUrl?: string | null | undefined;
|
|
133
|
+
name: string;
|
|
134
|
+
slug: string;
|
|
135
|
+
ownerAccountId: string;
|
|
136
|
+
}, {
|
|
137
|
+
logoUrl?: string | null | undefined;
|
|
138
|
+
name: string;
|
|
139
|
+
slug: string;
|
|
140
|
+
ownerAccountId: string;
|
|
141
|
+
}>, Record<string, any> | undefined>;
|
|
142
|
+
/** Atualização de org (PATCH): nome e/ou logo, ambos opcionais. */
|
|
143
|
+
export declare const orgUpdateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
144
|
+
name: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
145
|
+
logoUrl: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
146
|
+
}, {
|
|
147
|
+
name?: string | null | undefined;
|
|
148
|
+
logoUrl?: string | null | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
name?: string | undefined;
|
|
151
|
+
logoUrl?: string | null | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
name?: string | undefined;
|
|
154
|
+
logoUrl?: string | null | undefined;
|
|
155
|
+
}>, Record<string, any> | undefined>;
|
|
156
|
+
/** Adição de membro: accountId obrigatório; role opcional (default `member`). */
|
|
157
|
+
export declare const orgAddMemberValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
158
|
+
accountId: import("@vinejs/vine").VineString;
|
|
159
|
+
role: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
160
|
+
}, {
|
|
161
|
+
role?: string | null | undefined;
|
|
162
|
+
accountId: string;
|
|
163
|
+
}, {
|
|
164
|
+
role?: string | undefined;
|
|
165
|
+
accountId: string;
|
|
166
|
+
}, {
|
|
167
|
+
role?: string | undefined;
|
|
168
|
+
accountId: string;
|
|
169
|
+
}>, Record<string, any> | undefined>;
|
|
170
|
+
/** Troca de papel de membro: role obrigatório. */
|
|
171
|
+
export declare const orgMemberRoleValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
172
|
+
role: import("@vinejs/vine").VineString;
|
|
173
|
+
}, {
|
|
174
|
+
role: string;
|
|
175
|
+
}, {
|
|
176
|
+
role: string;
|
|
177
|
+
}, {
|
|
178
|
+
role: string;
|
|
179
|
+
}>, Record<string, any> | undefined>;
|
|
180
|
+
/** Criação de convite: e-mail obrigatório e validado; role opcional (default `member`). */
|
|
181
|
+
export declare const orgInvitationValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
182
|
+
email: import("@vinejs/vine").VineString;
|
|
183
|
+
role: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
184
|
+
}, {
|
|
185
|
+
role?: string | null | undefined;
|
|
186
|
+
email: string;
|
|
187
|
+
}, {
|
|
188
|
+
role?: string | undefined;
|
|
189
|
+
email: string;
|
|
190
|
+
}, {
|
|
191
|
+
role?: string | undefined;
|
|
192
|
+
email: string;
|
|
193
|
+
}>, Record<string, any> | undefined>;
|
|
194
|
+
/**
|
|
195
|
+
* Criação de role no catálogo: `name` obrigatório (o formato — uppercase +
|
|
196
|
+
* `ROLE_NAME_RE` — e a mensagem custom continuam no controller); `description`
|
|
197
|
+
* opcional.
|
|
198
|
+
*/
|
|
199
|
+
export declare const roleCreateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
200
|
+
name: import("@vinejs/vine").VineString;
|
|
201
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
202
|
+
}, {
|
|
203
|
+
description?: string | null | undefined;
|
|
204
|
+
name: string;
|
|
205
|
+
}, {
|
|
206
|
+
description?: string | undefined;
|
|
207
|
+
name: string;
|
|
208
|
+
}, {
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
name: string;
|
|
211
|
+
}>, Record<string, any> | undefined>;
|
|
212
|
+
/** Edição de role (PATCH): só `description` (o `name` vem da rota). */
|
|
213
|
+
export declare const roleUpdateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
214
|
+
description: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
215
|
+
}, {
|
|
216
|
+
description?: string | null | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
description?: string | undefined;
|
|
219
|
+
}, {
|
|
220
|
+
description?: string | undefined;
|
|
221
|
+
}>, Record<string, any> | undefined>;
|
|
222
|
+
/** `POST /tokens/verify` — token obrigatório. */
|
|
223
|
+
export declare const tokenVerifyValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
224
|
+
token: import("@vinejs/vine").VineString;
|
|
225
|
+
}, {
|
|
226
|
+
token: string;
|
|
227
|
+
}, {
|
|
228
|
+
token: string;
|
|
229
|
+
}, {
|
|
230
|
+
token: string;
|
|
231
|
+
}>, Record<string, any> | undefined>;
|
|
232
|
+
/**
|
|
233
|
+
* `accountId` obrigatório — para endpoints que o recebem por query/body (ex.:
|
|
234
|
+
* `POST /sessions/revoke-all?accountId=`). Como o valor pode vir de fontes
|
|
235
|
+
* diferentes (query OU route param), o controller monta o objeto e valida com
|
|
236
|
+
* `sessionAccountValidator.validate({ accountId })` (Vine valida qualquer dado,
|
|
237
|
+
* não só o body — `request.validateUsing` é só o atalho que valida `request.all()`).
|
|
238
|
+
*/
|
|
239
|
+
export declare const sessionAccountValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
240
|
+
accountId: import("@vinejs/vine").VineString;
|
|
241
|
+
}, {
|
|
242
|
+
accountId: string;
|
|
243
|
+
}, {
|
|
244
|
+
accountId: string;
|
|
245
|
+
}, {
|
|
246
|
+
accountId: string;
|
|
247
|
+
}>, Record<string, any> | undefined>;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import vine from '@vinejs/vine';
|
|
2
|
+
/**
|
|
3
|
+
* Validators VineJS dos recursos administrativos (Admin REST API + console admin).
|
|
4
|
+
*
|
|
5
|
+
* O console (B6) e a Admin REST API (R6) compartilham as MESMAS formas de input,
|
|
6
|
+
* então compartilham os MESMOS validators daqui. Cada controller chama
|
|
7
|
+
* `request.validateUsing(<validator>)` — um input inválido vira `E_VALIDATION_ERROR`
|
|
8
|
+
* (HTTP 422) pelo handler padrão do AdonisJS, substituindo as checagens manuais
|
|
9
|
+
* `request.input(...)` + 400 ad-hoc que existiam antes.
|
|
10
|
+
*
|
|
11
|
+
* `request.validateUsing` valida `request.all()` (body+query); para valores que
|
|
12
|
+
* vêm de OUTRAS fontes (route param, ou um accountId que pode vir de query OU
|
|
13
|
+
* param), chame o validator direto — `validator.validate({ ... })` — montando o
|
|
14
|
+
* objeto antes (ver {@link sessionAccountValidator}). Vine valida qualquer dado,
|
|
15
|
+
* não só o body.
|
|
16
|
+
*
|
|
17
|
+
* ── O que NÃO usa Vine (de propósito) ──────────────────────────────────────
|
|
18
|
+
* Nem todo input é candidato a validator com schema. Estes ficam com leitura
|
|
19
|
+
* manual de propósito (migrar seria regressão, não melhoria):
|
|
20
|
+
*
|
|
21
|
+
* - **Forms Edge** (`account_orgs`, `account_confirm`, `account_session`): são
|
|
22
|
+
* POSTs de formulário de sessão que, em input ausente, REDIRECIONAM de forma
|
|
23
|
+
* graciosa (ex.: de volta p/ `/account/orgs`). O throw→422 do Vine quebraria
|
|
24
|
+
* esse fluxo (vira flash-error/redirect do handler, não o redirect desenhado).
|
|
25
|
+
* - **Blobs WebAuthn** (`response` em interaction/account_mfa/account_confirm):
|
|
26
|
+
* credential JSON opaco, parseado pela lib de WebAuthn — não tem shape de
|
|
27
|
+
* campos p/ validar.
|
|
28
|
+
* - **Flags de checkbox** (`remember`, `trustDevice`): presença booleana.
|
|
29
|
+
* - **`pat_introspection`** (`token`): endpoint RFC 7662 — token ausente/inválido
|
|
30
|
+
* responde `{ active: false }`, não 422.
|
|
31
|
+
* - **`createToken` (`name`)**: opcional com default (`'Token'`) — nada a exigir.
|
|
32
|
+
*
|
|
33
|
+
* Regra de bolso: use Vine onde há INPUT ESTRUTURADO de API JSON que deva ser
|
|
34
|
+
* REJEITADO quando inválido (422). Form-redirect, blob opaco, flag e semântica de
|
|
35
|
+
* protocolo ficam de fora.
|
|
36
|
+
*/
|
|
37
|
+
const authMethod = vine.enum(['client_secret_basic', 'client_secret_post', 'none']);
|
|
38
|
+
/**
|
|
39
|
+
* Opções de validação de URL (L10): exige protocolo (URI absoluta), restringe a
|
|
40
|
+
* http/https (bloqueia `javascript:`, `ftp:`, etc.) e permite hosts de label única
|
|
41
|
+
* (`require_tld:false`) p/ não rejeitar `localhost` ou hostnames internos legítimos.
|
|
42
|
+
*/
|
|
43
|
+
const URL_OPTS = { require_protocol: true, require_tld: false, protocols: ['http', 'https'] };
|
|
44
|
+
/** Array de URIs ABSOLUTAS http/https. Rejeita strings que não são URL válida. */
|
|
45
|
+
const urlArray = vine.array(vine.string().trim().url(URL_OPTS));
|
|
46
|
+
/**
|
|
47
|
+
* Allowlist de grant_types aceitos no registro/edição de client (M10). Bloqueia
|
|
48
|
+
* `implicit` (tokens no fragment da URL — sem PKCE/refresh) e qualquer valor fora
|
|
49
|
+
* desta lista. Mantém os fluxos suportados: authorization_code, refresh_token,
|
|
50
|
+
* client_credentials e token-exchange (impersonation, gateada em token_exchange.ts).
|
|
51
|
+
*/
|
|
52
|
+
const ALLOWED_GRANT_TYPES = [
|
|
53
|
+
'authorization_code',
|
|
54
|
+
'refresh_token',
|
|
55
|
+
'client_credentials',
|
|
56
|
+
'urn:ietf:params:oauth:grant-type:token-exchange',
|
|
57
|
+
];
|
|
58
|
+
const grantTypeArray = vine.array(vine.enum(ALLOWED_GRANT_TYPES));
|
|
59
|
+
// NOTA: `response_types` NÃO é input de client nesta lib — é derivado por
|
|
60
|
+
// `AdminClientsService.create` (`['code']` quando há authorization_code, senão
|
|
61
|
+
// `[]`). Logo já está restrito a `code` sem precisar de validator (M10 ✓).
|
|
62
|
+
// ─── Clients OIDC ───────────────────────────────────────────────────────────
|
|
63
|
+
/**
|
|
64
|
+
* Input de client OIDC — serve create E update (PATCH). Tudo opcional: no create
|
|
65
|
+
* o controller aplica defaults (ver {@link clientCreateInput}); no update os campos
|
|
66
|
+
* ausentes (undefined) são preservados pelo `AdminClientsService.update` (merge,
|
|
67
|
+
* ver {@link clientPartialInput}). `grants` é aceito como alias de `grantTypes`
|
|
68
|
+
* (o DTO de saída usa `grants`).
|
|
69
|
+
*/
|
|
70
|
+
export const clientInputValidator = vine.compile(vine.object({
|
|
71
|
+
clientId: vine.string().trim().optional(),
|
|
72
|
+
// redirect/postLogout: URIs ABSOLUTAS (L10). `vine.string().url()` rejeita
|
|
73
|
+
// valores que não são URL (ex.: 'javascript:...', paths relativos).
|
|
74
|
+
redirectUris: urlArray.optional(),
|
|
75
|
+
postLogoutRedirectUris: urlArray.optional(),
|
|
76
|
+
// grant_types restrito à allowlist; `implicit` e desconhecidos viram 422 (M10).
|
|
77
|
+
grantTypes: grantTypeArray.optional(),
|
|
78
|
+
grants: grantTypeArray.optional(),
|
|
79
|
+
tokenEndpointAuthMethod: authMethod.optional(),
|
|
80
|
+
// backchannel_logout_uri também precisa ser URI absoluta (L10).
|
|
81
|
+
backchannelLogoutUri: vine.string().trim().url(URL_OPTS).optional(),
|
|
82
|
+
backchannelLogoutSessionRequired: vine.boolean().optional(),
|
|
83
|
+
}));
|
|
84
|
+
/** Mapeia o input validado para um {@link ClientInput} COMPLETO (create), com defaults. */
|
|
85
|
+
export function clientCreateInput(v) {
|
|
86
|
+
return {
|
|
87
|
+
clientId: v.clientId?.trim() || undefined,
|
|
88
|
+
redirectUris: v.redirectUris ?? [],
|
|
89
|
+
postLogoutRedirectUris: v.postLogoutRedirectUris ?? [],
|
|
90
|
+
grantTypes: v.grantTypes ?? v.grants ?? [],
|
|
91
|
+
tokenEndpointAuthMethod: v.tokenEndpointAuthMethod ?? 'client_secret_basic',
|
|
92
|
+
backchannelLogoutUri: v.backchannelLogoutUri || undefined,
|
|
93
|
+
backchannelLogoutSessionRequired: v.backchannelLogoutSessionRequired,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Mapeia o input validado para um {@link ClientInput} PARCIAL (PATCH): só inclui
|
|
98
|
+
* os campos presentes; o `AdminClientsService.update` preserva o resto via merge.
|
|
99
|
+
*/
|
|
100
|
+
export function clientPartialInput(v) {
|
|
101
|
+
const out = {};
|
|
102
|
+
if (v.redirectUris !== undefined)
|
|
103
|
+
out.redirectUris = v.redirectUris;
|
|
104
|
+
if (v.postLogoutRedirectUris !== undefined)
|
|
105
|
+
out.postLogoutRedirectUris = v.postLogoutRedirectUris;
|
|
106
|
+
const grants = v.grantTypes ?? v.grants;
|
|
107
|
+
if (grants !== undefined)
|
|
108
|
+
out.grantTypes = grants;
|
|
109
|
+
if (v.tokenEndpointAuthMethod !== undefined)
|
|
110
|
+
out.tokenEndpointAuthMethod = v.tokenEndpointAuthMethod;
|
|
111
|
+
if (v.backchannelLogoutUri !== undefined)
|
|
112
|
+
out.backchannelLogoutUri = v.backchannelLogoutUri.trim() || undefined;
|
|
113
|
+
if (v.backchannelLogoutSessionRequired !== undefined)
|
|
114
|
+
out.backchannelLogoutSessionRequired = v.backchannelLogoutSessionRequired;
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
// ─── Usuários ───────────────────────────────────────────────────────────────
|
|
118
|
+
/**
|
|
119
|
+
* Criação de usuário pelo admin (API + console). E-mail obrigatório e validado;
|
|
120
|
+
* nome/senha opcionais; `invite:true` cria sem senha e dispara o convite. A
|
|
121
|
+
* política de senha (força, comprimento mínimo do projeto) é checada DEPOIS pelo
|
|
122
|
+
* AdminUsersService.create (retorna `password_policy`); por isso aqui NÃO fixamos
|
|
123
|
+
* `minLength` — seria duplicar/contornar a policy configurável do projeto.
|
|
124
|
+
*/
|
|
125
|
+
export const adminUserCreateValidator = vine.compile(vine.object({
|
|
126
|
+
email: vine.string().trim().email(),
|
|
127
|
+
name: vine.string().trim().maxLength(255).optional(),
|
|
128
|
+
password: vine.string().maxLength(255).optional(),
|
|
129
|
+
invite: vine.boolean().optional(),
|
|
130
|
+
}));
|
|
131
|
+
/** Atualização de usuário (PATCH): roles globais e/ou perfil. Tudo opcional. */
|
|
132
|
+
export const adminUserUpdateValidator = vine.compile(vine.object({
|
|
133
|
+
globalRoles: vine.array(vine.string().trim()).optional(),
|
|
134
|
+
name: vine.string().trim().maxLength(255).nullable().optional(),
|
|
135
|
+
avatarUrl: vine.string().trim().maxLength(2048).nullable().optional(),
|
|
136
|
+
}));
|
|
137
|
+
/** Substituição de roles globais no console (PATCH /users/:id/roles). */
|
|
138
|
+
export const adminUserRolesValidator = vine.compile(vine.object({
|
|
139
|
+
roles: vine.array(vine.string().trim()).optional(),
|
|
140
|
+
}));
|
|
141
|
+
// ─── Organizações ─────────────────────────────────────────────────────────────
|
|
142
|
+
/** Criação de org: name, slug e ownerAccountId obrigatórios; logo opcional. */
|
|
143
|
+
export const orgCreateValidator = vine.compile(vine.object({
|
|
144
|
+
name: vine.string().trim().minLength(1).maxLength(255),
|
|
145
|
+
slug: vine.string().trim().minLength(1).maxLength(255),
|
|
146
|
+
ownerAccountId: vine.string().trim().minLength(1),
|
|
147
|
+
logoUrl: vine.string().trim().nullable().optional(),
|
|
148
|
+
}));
|
|
149
|
+
/** Atualização de org (PATCH): nome e/ou logo, ambos opcionais. */
|
|
150
|
+
export const orgUpdateValidator = vine.compile(vine.object({
|
|
151
|
+
name: vine.string().trim().minLength(1).maxLength(255).optional(),
|
|
152
|
+
logoUrl: vine.string().trim().nullable().optional(),
|
|
153
|
+
}));
|
|
154
|
+
/** Adição de membro: accountId obrigatório; role opcional (default `member`). */
|
|
155
|
+
export const orgAddMemberValidator = vine.compile(vine.object({
|
|
156
|
+
accountId: vine.string().trim().minLength(1),
|
|
157
|
+
role: vine.string().trim().minLength(1).optional(),
|
|
158
|
+
}));
|
|
159
|
+
/** Troca de papel de membro: role obrigatório. */
|
|
160
|
+
export const orgMemberRoleValidator = vine.compile(vine.object({
|
|
161
|
+
role: vine.string().trim().minLength(1),
|
|
162
|
+
}));
|
|
163
|
+
/** Criação de convite: e-mail obrigatório e validado; role opcional (default `member`). */
|
|
164
|
+
export const orgInvitationValidator = vine.compile(vine.object({
|
|
165
|
+
email: vine.string().trim().email(),
|
|
166
|
+
role: vine.string().trim().minLength(1).optional(),
|
|
167
|
+
}));
|
|
168
|
+
// ─── Catálogo de roles ──────────────────────────────────────────────────────
|
|
169
|
+
/**
|
|
170
|
+
* Criação de role no catálogo: `name` obrigatório (o formato — uppercase +
|
|
171
|
+
* `ROLE_NAME_RE` — e a mensagem custom continuam no controller); `description`
|
|
172
|
+
* opcional.
|
|
173
|
+
*/
|
|
174
|
+
export const roleCreateValidator = vine.compile(vine.object({
|
|
175
|
+
name: vine.string().trim().minLength(1),
|
|
176
|
+
description: vine.string().trim().optional(),
|
|
177
|
+
}));
|
|
178
|
+
/** Edição de role (PATCH): só `description` (o `name` vem da rota). */
|
|
179
|
+
export const roleUpdateValidator = vine.compile(vine.object({
|
|
180
|
+
description: vine.string().trim().optional(),
|
|
181
|
+
}));
|
|
182
|
+
// ─── Introspecção de token ──────────────────────────────────────────────────
|
|
183
|
+
/** `POST /tokens/verify` — token obrigatório. */
|
|
184
|
+
export const tokenVerifyValidator = vine.compile(vine.object({
|
|
185
|
+
token: vine.string().trim().minLength(1),
|
|
186
|
+
}));
|
|
187
|
+
// ─── Sessões ──────────────────────────────────────────────────────────────────
|
|
188
|
+
/**
|
|
189
|
+
* `accountId` obrigatório — para endpoints que o recebem por query/body (ex.:
|
|
190
|
+
* `POST /sessions/revoke-all?accountId=`). Como o valor pode vir de fontes
|
|
191
|
+
* diferentes (query OU route param), o controller monta o objeto e valida com
|
|
192
|
+
* `sessionAccountValidator.validate({ accountId })` (Vine valida qualquer dado,
|
|
193
|
+
* não só o body — `request.validateUsing` é só o atalho que valida `request.all()`).
|
|
194
|
+
*/
|
|
195
|
+
export const sessionAccountValidator = vine.compile(vine.object({
|
|
196
|
+
accountId: vine.string().trim().minLength(1),
|
|
197
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identificador NÃO-SENSÍVEL da API key admin que autenticou a request (R6),
|
|
3
|
+
* anexado pelo `adminApiGuard`. Usado pela trilha de auditoria REST para saber
|
|
4
|
+
* QUAL key agiu sem vazar o segredo (ex.: `admin-key:<8 hex>`). Ausente fora do
|
|
5
|
+
* grupo admin-api.
|
|
6
|
+
*/
|
|
7
|
+
declare module '@adonisjs/core/http' {
|
|
8
|
+
interface HttpContext {
|
|
9
|
+
adminApiKeyId?: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AuthSocialConfig, ResolvedRateLimitConfig } from '../define_config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bits de routing do config resolvido que o `registerAuthHost` precisa em tempo de
|
|
4
|
+
* REGISTRO de rota (síncrono). Stash feito no `boot()` do provider — que roda ANTES
|
|
5
|
+
* dos preloads (start/routes.ts) — para que `registerAuthHost` leia do config em vez
|
|
6
|
+
* de exigir que o consumidor reespecifique tudo (elimina o drift config↔registerAuthHost).
|
|
7
|
+
*
|
|
8
|
+
* Module-level porque o IdP é um por processo (mesmo padrão de config_locks).
|
|
9
|
+
*/
|
|
10
|
+
export interface AuthHostRuntimeConfig {
|
|
11
|
+
mountPath: string;
|
|
12
|
+
social?: AuthSocialConfig;
|
|
13
|
+
rateLimit: ResolvedRateLimitConfig;
|
|
14
|
+
adminEnabled: boolean;
|
|
15
|
+
adminApiEnabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Stash dos bits de routing (chamado no boot do provider). */
|
|
18
|
+
export declare function setAuthHostConfig(config: AuthHostRuntimeConfig): void;
|
|
19
|
+
/** Lê os bits de routing stashados; undefined se o boot ainda não rodou (fallback p/ opts/defaults). */
|
|
20
|
+
export declare function getAuthHostConfig(): AuthHostRuntimeConfig | undefined;
|
|
21
|
+
/** Limpa o stash — uso em testes. */
|
|
22
|
+
export declare function resetAuthHostConfig(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
let stashed;
|
|
2
|
+
/** Stash dos bits de routing (chamado no boot do provider). */
|
|
3
|
+
export function setAuthHostConfig(config) {
|
|
4
|
+
stashed = config;
|
|
5
|
+
}
|
|
6
|
+
/** Lê os bits de routing stashados; undefined se o boot ainda não rodou (fallback p/ opts/defaults). */
|
|
7
|
+
export function getAuthHostConfig() {
|
|
8
|
+
return stashed;
|
|
9
|
+
}
|
|
10
|
+
/** Limpa o stash — uso em testes. */
|
|
11
|
+
export function resetAuthHostConfig() {
|
|
12
|
+
stashed = undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
|
+
import type { ResolvedUploadsConfig } from '../define_config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Upload de avatar do host-kit usando o `@adonisjs/drive` JÁ configurado no app.
|
|
5
|
+
* Mesmo princípio do default_mailer/rate_limit: por padrão usamos a infra do
|
|
6
|
+
* host (o disk DEFAULT do drive do app), sem o dev precisar escrever nada; tudo
|
|
7
|
+
* é sobreponível via `config/authkit.ts` (`uploads.avatars`).
|
|
8
|
+
*
|
|
9
|
+
* Best-effort / fail-safe: se `@adonisjs/drive` não estiver instalado/configurado,
|
|
10
|
+
* {@link storeAvatar} retorna `null` e a feature degrada para o input de URL.
|
|
11
|
+
* Nunca lança na request por causa de drive ausente.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Service do `@adonisjs/drive` resolvido de forma preguiçosa. Tipado como `any` de
|
|
15
|
+
* propósito: a lib NÃO depende do drive em tempo de compilação (peer/opt-in).
|
|
16
|
+
*/
|
|
17
|
+
type DriveService = any;
|
|
18
|
+
/**
|
|
19
|
+
* Permite reapontar/limpar o loader do drive (usado em testes).
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function __setDriveLoaderForTests(fn: (() => Promise<DriveService | null>) | undefined): void;
|
|
23
|
+
/** Erro de validação do upload (mensagem já localizada no controller). */
|
|
24
|
+
export declare class AvatarUploadError extends Error {
|
|
25
|
+
reason: 'extname' | 'size';
|
|
26
|
+
constructor(reason: 'extname' | 'size', message: string);
|
|
27
|
+
}
|
|
28
|
+
/** File de multipart mínimo que precisamos do `request.file('avatar')`. */
|
|
29
|
+
export interface UploadedAvatar {
|
|
30
|
+
extname?: string | null;
|
|
31
|
+
size?: number;
|
|
32
|
+
/** Caminho temporário (drive lê daqui para stream). */
|
|
33
|
+
tmpPath?: string | null;
|
|
34
|
+
/** Move o arquivo para um disk do drive (API v3+). */
|
|
35
|
+
moveToDisk?: (key: string, options?: {
|
|
36
|
+
disk?: string;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Indica se o drive do app está disponível (para a view decidir mostrar o input
|
|
41
|
+
* de arquivo). Best-effort: nunca lança.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isDriveAvailable(): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Armazena o avatar no drive do host e retorna a URL pública.
|
|
46
|
+
*
|
|
47
|
+
* - Valida extensão (jpg/jpeg/png/webp) e tamanho (≤ maxSizeMb) — lança
|
|
48
|
+
* {@link AvatarUploadError} se inválido (o controller traduz/flasha).
|
|
49
|
+
* - Usa o disk configurado em `uploads.avatars.disk` ou o disk DEFAULT do app.
|
|
50
|
+
* - Se o drive estiver ausente/não-configurado → retorna `null` (degrada para URL).
|
|
51
|
+
*
|
|
52
|
+
* Nunca lança por causa de drive ausente; só lança em validação.
|
|
53
|
+
*/
|
|
54
|
+
export declare function storeAvatar(_ctx: HttpContext, cfg: ResolvedUploadsConfig, file: UploadedAvatar, accountId: string, messages: {
|
|
55
|
+
extname: string;
|
|
56
|
+
size: string;
|
|
57
|
+
}): Promise<string | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Deleta (best-effort, fail-safe) o avatar de uma conta no drive do host, a partir
|
|
60
|
+
* da URL/key armazenada. Usado pela deleção de conta (LGPD): apaga o arquivo se
|
|
61
|
+
* conseguirmos derivar a key dentro do diretório configurado.
|
|
62
|
+
*
|
|
63
|
+
* NUNCA lança: drive ausente, key não reconhecida ou erro de I/O → no-op. A key é
|
|
64
|
+
* derivada da `storedUrlOrKey` pegando o trecho a partir de `directory/` (cobre
|
|
65
|
+
* tanto uma key relativa quanto uma URL pública que contenha o caminho).
|
|
66
|
+
*/
|
|
67
|
+
export declare function deleteAvatar(cfg: ResolvedUploadsConfig, storedUrlOrKey: string | null | undefined): Promise<boolean>;
|
|
68
|
+
export {};
|