@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
package/package.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adonis-agora/authkit-server",
|
|
3
|
+
"version": "0.34.0",
|
|
4
|
+
"description": "AdonisJS OIDC/OAuth2 provider (Identity Provider) toolkit: ejectable auth server with sessions, rate-limiting, MFA/TOTP, audit log, federated logout and OpenTelemetry metrics.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "dudousxd",
|
|
7
|
+
"homepage": "https://github.com/DavideCarvalho/adonis-authkit/tree/main/packages/authkit-server#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/DavideCarvalho/adonis-authkit.git",
|
|
11
|
+
"directory": "packages/authkit-server"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/DavideCarvalho/adonis-authkit/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"adonisjs",
|
|
18
|
+
"oidc",
|
|
19
|
+
"oauth2",
|
|
20
|
+
"openid-connect",
|
|
21
|
+
"authentication",
|
|
22
|
+
"authkit",
|
|
23
|
+
"identity-provider",
|
|
24
|
+
"rate-limiting",
|
|
25
|
+
"mfa",
|
|
26
|
+
"totp"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"type": "module",
|
|
32
|
+
"main": "./build/index.js",
|
|
33
|
+
"types": "./build/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"build",
|
|
36
|
+
"stubs"
|
|
37
|
+
],
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./build/index.js",
|
|
40
|
+
"./types": "./build/index.js",
|
|
41
|
+
"./durable": "./build/src/host/durable/index.js",
|
|
42
|
+
"./telescope": "./build/src/observability/telescope/index.js",
|
|
43
|
+
"./authkit_server_provider": "./build/providers/authkit_server_provider.js",
|
|
44
|
+
"./commands": "./build/commands/main.js",
|
|
45
|
+
"./commands/configure": "./build/commands/configure.js"
|
|
46
|
+
},
|
|
47
|
+
"adonisjs": {
|
|
48
|
+
"types": "@adonis-agora/authkit-server",
|
|
49
|
+
"providers": [
|
|
50
|
+
"@adonis-agora/authkit-server/authkit_server_provider"
|
|
51
|
+
],
|
|
52
|
+
"commands": [
|
|
53
|
+
"@adonis-agora/authkit-server/commands"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@adonis-agora/durable": "^0.2.0",
|
|
58
|
+
"@adonis-agora/telescope": "^0.1.0",
|
|
59
|
+
"@adonisjs/ally": "6.3.0",
|
|
60
|
+
"@adonisjs/core": "7.3.3",
|
|
61
|
+
"@adonisjs/drive": "4.0.0",
|
|
62
|
+
"@adonisjs/lock": "2.1.0",
|
|
63
|
+
"@adonisjs/lucid": "22.4.2",
|
|
64
|
+
"@adonisjs/redis": "9.2.0",
|
|
65
|
+
"@adonisjs/session": "8.1.0",
|
|
66
|
+
"@adonisjs/shield": "9.0.0",
|
|
67
|
+
"edge.js": "6.5.1"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@adonis-agora/durable": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@adonis-agora/telescope": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"edge.js": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@adonisjs/ally": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@adonisjs/drive": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@adonisjs/lock": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@adonisjs/redis": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@simplewebauthn/server": "^13.3.1",
|
|
94
|
+
"@vinejs/vine": "4.4.0",
|
|
95
|
+
"jose": "^5.9.0",
|
|
96
|
+
"koa": "^3.2.1",
|
|
97
|
+
"koa-mount": "^4.2.0",
|
|
98
|
+
"oidc-provider": "^9.8.4",
|
|
99
|
+
"otplib": "^12.0.1",
|
|
100
|
+
"qrcode": "^1.5.4",
|
|
101
|
+
"@adonis-agora/authkit-core": "0.7.0"
|
|
102
|
+
},
|
|
103
|
+
"devDependencies": {
|
|
104
|
+
"@adonis-agora/durable": "^0.2.0",
|
|
105
|
+
"@adonis-agora/telescope": "^0.1.0",
|
|
106
|
+
"@adonisjs/ally": "6.3.0",
|
|
107
|
+
"@adonisjs/core": "7.3.3",
|
|
108
|
+
"@adonisjs/drive": "4.0.0",
|
|
109
|
+
"@adonisjs/lucid": "22.4.2",
|
|
110
|
+
"@adonisjs/session": "8.1.0",
|
|
111
|
+
"@adonisjs/shield": "9.0.0",
|
|
112
|
+
"@adonisjs/tsconfig": "2.0.0",
|
|
113
|
+
"@japa/assert": "4.2.0",
|
|
114
|
+
"@japa/runner": "5.3.0",
|
|
115
|
+
"@poppinss/ts-exec": "1.4.4",
|
|
116
|
+
"@types/koa": "^2.15.2",
|
|
117
|
+
"@types/koa-mount": "^4.0.5",
|
|
118
|
+
"@types/luxon": "3.7.1",
|
|
119
|
+
"@types/node": "25.9.1",
|
|
120
|
+
"@types/qrcode": "^1.5.5",
|
|
121
|
+
"better-sqlite3": "^11.0.0",
|
|
122
|
+
"edge.js": "6.5.1",
|
|
123
|
+
"ioredis": "5.4.2",
|
|
124
|
+
"ioredis-mock": "^8.9.0",
|
|
125
|
+
"luxon": "3.7.2",
|
|
126
|
+
"tailwindcss": "^3.4.19",
|
|
127
|
+
"typescript": "6.0.3",
|
|
128
|
+
"@vitejs/plugin-react": "6.0.2",
|
|
129
|
+
"@types/react": "19.2.15",
|
|
130
|
+
"@types/react-dom": "19.2.3",
|
|
131
|
+
"react": "19.2.6",
|
|
132
|
+
"react-dom": "19.2.6",
|
|
133
|
+
"vite": "8.0.14",
|
|
134
|
+
"@tanstack/react-query": "5.100.14",
|
|
135
|
+
"react-error-boundary": "6.1.2",
|
|
136
|
+
"nuqs": "2.8.9",
|
|
137
|
+
"recharts": "3.8.1",
|
|
138
|
+
"@adonis-agora/authkit-react": "0.12.0"
|
|
139
|
+
},
|
|
140
|
+
"scripts": {
|
|
141
|
+
"build": "node scripts/build_host_css.mjs && node scripts/build_ui.mjs && tsc && node -e \"require('node:fs').cpSync('stubs','build/stubs',{recursive:true,filter:(s)=>!s.endsWith('.ts')})\" && node -e \"const fs=require('node:fs');if(fs.existsSync('assets'))fs.cpSync('assets','build/assets',{recursive:true})\" && node -e \"require('node:fs').cpSync('src/host/views','build/host/views',{recursive:true})\" && node -e \"const fs=require('node:fs');fs.mkdirSync('build/host/ui',{recursive:true});fs.readdirSync('src/host/ui').filter(f=>f.endsWith('.html')).forEach(f=>fs.copyFileSync('src/host/ui/'+f,'build/host/ui/'+f))\" && node -e \"require('node:fs').copyFileSync('commands/commands.json','build/commands/commands.json')\" && node -e \"const fs=require('node:fs');fs.mkdirSync('build/password',{recursive:true});fs.copyFileSync('src/password/common_passwords.txt','build/password/common_passwords.txt')\"",
|
|
142
|
+
"build:ui": "node scripts/build_ui.mjs",
|
|
143
|
+
"typecheck": "tsc --noEmit && node scripts/typecheck_ui.mjs",
|
|
144
|
+
"test": "node --import=@poppinss/ts-exec bin/test.ts",
|
|
145
|
+
"build:host-css": "node scripts/build_host_css.mjs"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.configPath('authkit.ts') })
|
|
3
|
+
}}}
|
|
4
|
+
import env from '#start/env'
|
|
5
|
+
import AuthUser from '#models/auth_user'
|
|
6
|
+
import { defineConfig, adapters, lucidAccountStore } from '@adonis-agora/authkit-server'
|
|
7
|
+
|
|
8
|
+
const authServerConfig = defineConfig({
|
|
9
|
+
issuer: env.get('AUTHKIT_ISSUER'),
|
|
10
|
+
adapter: adapters.redis({ connection: 'main' }),
|
|
11
|
+
jwks: { source: 'managed', algorithm: 'RS256' },
|
|
12
|
+
ttl: { accessToken: '15m', refreshToken: '30d' },
|
|
13
|
+
globalRolesClaim: 'roles',
|
|
14
|
+
accountStore: lucidAccountStore(AuthUser),
|
|
15
|
+
// Clients são gerenciados em runtime via console admin (/admin/clients) ou
|
|
16
|
+
// Admin API, sem necessidade de redeploy.
|
|
17
|
+
// Use: node ace authkit:clients:create --redirect-uri=https://app/cb
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export default authServerConfig
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.configPath('authkit.ts'), overwrite: true })
|
|
3
|
+
}}}
|
|
4
|
+
import env from '#start/env'
|
|
5
|
+
import AuthUser from '#models/auth_user'
|
|
6
|
+
import { defineConfig, adapters, inertiaRenderer } from '@adonis-agora/authkit-server'
|
|
7
|
+
|
|
8
|
+
const authServerConfig = defineConfig({
|
|
9
|
+
issuer: env.get('AUTHKIT_ISSUER'),
|
|
10
|
+
adapter: adapters.redis({ connection: 'main' }),
|
|
11
|
+
jwks: { source: 'managed', algorithm: 'RS256' },
|
|
12
|
+
clients: [
|
|
13
|
+
// registre seus clients OIDC aqui
|
|
14
|
+
],
|
|
15
|
+
ttl: { accessToken: '15m', refreshToken: '30d' },
|
|
16
|
+
globalRolesClaim: 'roles',
|
|
17
|
+
findAccount: async (sub) => {
|
|
18
|
+
const user = await AuthUser.find(sub)
|
|
19
|
+
if (!user) return null
|
|
20
|
+
return { id: user.id, email: user.email, globalRoles: user.globalRoles }
|
|
21
|
+
},
|
|
22
|
+
verifyCredentials: async (email, password) => {
|
|
23
|
+
const user = await AuthUser.query().where('email', email).first()
|
|
24
|
+
if (!user || !(await user.verifyPassword(password))) return null
|
|
25
|
+
return { id: user.id }
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Renderer Inertia/React: apenas as views listadas em `views` vão ao Inertia;
|
|
29
|
+
* as demais (incluindo todas as telas admin/*) recaem silenciosamente no
|
|
30
|
+
* renderer Edge built-in da lib — evitando SSR crash por página inexistente.
|
|
31
|
+
*
|
|
32
|
+
* A lista abaixo corresponde exatamente às páginas que o scaffold gerou.
|
|
33
|
+
* Adicione entradas aqui somente se criar a página React correspondente.
|
|
34
|
+
*/
|
|
35
|
+
render: inertiaRenderer({
|
|
36
|
+
prefix: 'authkit',
|
|
37
|
+
views: [
|
|
38
|
+
'login',
|
|
39
|
+
'consent',
|
|
40
|
+
'signup',
|
|
41
|
+
'forgot',
|
|
42
|
+
'reset',
|
|
43
|
+
'verify-email',
|
|
44
|
+
'mfa-challenge',
|
|
45
|
+
'account/login',
|
|
46
|
+
'account/tokens',
|
|
47
|
+
'account/mfa',
|
|
48
|
+
],
|
|
49
|
+
}),
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export default authServerConfig
|
package/stubs/main.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('app/models/auth_user.ts') })
|
|
3
|
+
}}}
|
|
4
|
+
import { BaseModel, column } from '@adonisjs/lucid/orm'
|
|
5
|
+
import { compose } from '@adonisjs/core/helpers'
|
|
6
|
+
import { withAuthUser, withCredentials } from '@adonis-agora/authkit-server'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Por padrão o AuthKit cria/usa as tabelas na conexão DEFAULT da aplicação
|
|
10
|
+
* (config/database.ts) — não força nenhum banco/schema próprio.
|
|
11
|
+
*
|
|
12
|
+
* Se você quiser isolar o AuthKit num schema ou banco dedicado, defina uma
|
|
13
|
+
* conexão no config/database.ts do app e referencie aqui, ex.:
|
|
14
|
+
*
|
|
15
|
+
* static connection = 'auth'
|
|
16
|
+
*
|
|
17
|
+
* (e aponte as migrations correspondentes para essa conexão).
|
|
18
|
+
*/
|
|
19
|
+
export default class AuthUser extends compose(BaseModel, withAuthUser(), withCredentials()) {
|
|
20
|
+
@column({ isPrimary: true })
|
|
21
|
+
declare id: string
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('resources/views/authkit/consent.edge') })
|
|
3
|
+
}}}
|
|
4
|
+
<!doctype html>
|
|
5
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>Autorizar</title>
|
|
6
|
+
<script src="https://cdn.tailwindcss.com"></script></head>
|
|
7
|
+
<body class="min-h-screen flex items-center justify-center bg-gray-50">
|
|
8
|
+
<form method="POST" action="/auth/interaction/{{ uid }}/consent" class="w-full max-w-sm bg-white p-6 rounded-lg shadow">
|
|
9
|
+
<h1 class="text-lg font-semibold mb-2">Autorizar acesso</h1>
|
|
10
|
+
<p class="text-sm text-gray-600 mb-4">O app <strong>{{ params.client_id }}</strong> quer acessar sua conta.</p>
|
|
11
|
+
<button class="w-full bg-black text-white rounded py-2">Autorizar</button>
|
|
12
|
+
</form>
|
|
13
|
+
</body></html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('resources/views/authkit/login.edge') })
|
|
3
|
+
}}}
|
|
4
|
+
<!doctype html>
|
|
5
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>Entrar</title>
|
|
6
|
+
<script src="https://cdn.tailwindcss.com"></script></head>
|
|
7
|
+
<body class="min-h-screen flex items-center justify-center bg-gray-50">
|
|
8
|
+
<form method="POST" action="/auth/interaction/{{ uid }}/login" class="w-full max-w-sm bg-white p-6 rounded-lg shadow">
|
|
9
|
+
<h1 class="text-lg font-semibold mb-4">Entrar</h1>
|
|
10
|
+
@if(error)
|
|
11
|
+
<p class="text-red-600 text-sm mb-3">{{ error }}</p>
|
|
12
|
+
@end
|
|
13
|
+
<label class="block text-sm mb-1">E-mail</label>
|
|
14
|
+
<input name="email" type="email" required class="w-full border rounded px-3 py-2 mb-3" />
|
|
15
|
+
<label class="block text-sm mb-1">Senha</label>
|
|
16
|
+
<input name="password" type="password" required class="w-full border rounded px-3 py-2 mb-4" />
|
|
17
|
+
<button class="w-full bg-black text-white rounded py-2">Entrar</button>
|
|
18
|
+
</form>
|
|
19
|
+
</body></html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('inertia/components/auth_shell.tsx') })
|
|
3
|
+
}}}
|
|
4
|
+
import type { ReactNode } from 'react'
|
|
5
|
+
|
|
6
|
+
export interface AuthBrand {
|
|
7
|
+
appName: string
|
|
8
|
+
accent: string
|
|
9
|
+
accentSoft?: string
|
|
10
|
+
company?: string
|
|
11
|
+
tagline?: string
|
|
12
|
+
audienceLabel?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const COMPANY_FALLBACK = 'Acme'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Layout de duas colunas para as telas de autenticacao do IdP.
|
|
19
|
+
* Painel esquerdo: marca (empresa guarda-chuva + produto). Painel direito: formulario.
|
|
20
|
+
*/
|
|
21
|
+
export default function AuthShell({
|
|
22
|
+
brand,
|
|
23
|
+
children,
|
|
24
|
+
}: {
|
|
25
|
+
brand?: AuthBrand
|
|
26
|
+
children: ReactNode
|
|
27
|
+
}) {
|
|
28
|
+
const accent = brand?.accent ?? '#111827'
|
|
29
|
+
const accentSoft = brand?.accentSoft ?? accent
|
|
30
|
+
const company = brand?.company ?? COMPANY_FALLBACK
|
|
31
|
+
const appName = brand?.appName ?? 'Sua conta'
|
|
32
|
+
const tagline = brand?.tagline ?? 'Acesso unificado'
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
|
|
36
|
+
<div className="w-full max-w-4xl overflow-hidden rounded-2xl bg-white shadow-xl ring-1 ring-black/5 grid md:grid-cols-2">
|
|
37
|
+
{/* Painel da marca */}
|
|
38
|
+
<div
|
|
39
|
+
className="relative flex flex-col justify-between p-8 text-white md:p-10"
|
|
40
|
+
style={{ backgroundImage: `linear-gradient(135deg, ${accent} 0%, ${accentSoft} 100%)` }}
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
className="text-xs font-semibold uppercase tracking-[0.2em] text-white/80"
|
|
44
|
+
aria-label="Empresa"
|
|
45
|
+
>
|
|
46
|
+
{company}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div className="mt-10 md:mt-0">
|
|
50
|
+
<h2 className="text-2xl font-bold leading-tight md:text-3xl">{appName}</h2>
|
|
51
|
+
<p className="mt-2 text-sm text-white/85">{tagline}</p>
|
|
52
|
+
{brand?.audienceLabel && (
|
|
53
|
+
<span className="mt-4 inline-block rounded-full bg-white/20 px-3 py-1 text-xs font-medium uppercase tracking-wide text-white ring-1 ring-white/30">
|
|
54
|
+
{brand.audienceLabel}
|
|
55
|
+
</span>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div className="mt-10 text-xs text-white/60">© {company}</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{/* Painel do formulario */}
|
|
63
|
+
<div className="p-8 md:p-10">{children}</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('inertia/pages/authkit/account/login.tsx') })
|
|
3
|
+
}}}
|
|
4
|
+
interface Props {
|
|
5
|
+
csrfToken: string
|
|
6
|
+
error?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function AccountLogin({ csrfToken, error }: Props) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
|
|
12
|
+
<form
|
|
13
|
+
method="POST"
|
|
14
|
+
action="/account/login"
|
|
15
|
+
className="w-full max-w-sm rounded-2xl bg-white p-8 shadow-xl ring-1 ring-black/5"
|
|
16
|
+
>
|
|
17
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
18
|
+
<div className="text-xs font-semibold uppercase tracking-[0.2em] text-gray-400">Acme</div>
|
|
19
|
+
<h1 className="mt-2 text-xl font-semibold text-gray-900">Minha conta</h1>
|
|
20
|
+
<p className="mt-1 text-sm text-gray-500">Gerencie seus tokens de acesso.</p>
|
|
21
|
+
|
|
22
|
+
{error && <p className="mt-4 text-sm text-red-600">{error}</p>}
|
|
23
|
+
|
|
24
|
+
<label htmlFor="email" className="mt-6 mb-1 block text-sm font-medium text-gray-700">
|
|
25
|
+
E-mail
|
|
26
|
+
</label>
|
|
27
|
+
<input
|
|
28
|
+
id="email"
|
|
29
|
+
name="email"
|
|
30
|
+
type="email"
|
|
31
|
+
required
|
|
32
|
+
autoFocus
|
|
33
|
+
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none focus:border-gray-900"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<label htmlFor="password" className="mt-4 mb-1 block text-sm font-medium text-gray-700">
|
|
37
|
+
Senha
|
|
38
|
+
</label>
|
|
39
|
+
<input
|
|
40
|
+
id="password"
|
|
41
|
+
name="password"
|
|
42
|
+
type="password"
|
|
43
|
+
required
|
|
44
|
+
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none focus:border-gray-900"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<button
|
|
48
|
+
type="submit"
|
|
49
|
+
className="mt-6 w-full rounded-lg bg-gray-900 py-2.5 text-sm font-semibold text-white transition hover:opacity-90"
|
|
50
|
+
>
|
|
51
|
+
Entrar
|
|
52
|
+
</button>
|
|
53
|
+
</form>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('inertia/pages/authkit/account/mfa.tsx') })
|
|
3
|
+
}}}
|
|
4
|
+
interface Props {
|
|
5
|
+
csrfToken: string
|
|
6
|
+
enabled: boolean
|
|
7
|
+
enrolling?: boolean
|
|
8
|
+
secret?: string | null
|
|
9
|
+
qrDataUrl?: string | null
|
|
10
|
+
error?: string
|
|
11
|
+
recoveryCodes?: string[] | null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function AccountMfa({
|
|
15
|
+
csrfToken,
|
|
16
|
+
enabled,
|
|
17
|
+
enrolling,
|
|
18
|
+
secret,
|
|
19
|
+
qrDataUrl,
|
|
20
|
+
error,
|
|
21
|
+
recoveryCodes,
|
|
22
|
+
}: Props) {
|
|
23
|
+
return (
|
|
24
|
+
<div className="min-h-screen bg-gray-100 p-4">
|
|
25
|
+
<div className="mx-auto max-w-2xl">
|
|
26
|
+
<div className="flex items-center justify-between py-6">
|
|
27
|
+
<div>
|
|
28
|
+
<div className="text-xs font-semibold uppercase tracking-[0.2em] text-gray-400">Acme</div>
|
|
29
|
+
<h1 className="text-xl font-semibold text-gray-900">Verificação em duas etapas</h1>
|
|
30
|
+
</div>
|
|
31
|
+
<form method="POST" action="/account/logout">
|
|
32
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
33
|
+
<button type="submit" className="text-sm text-gray-500 hover:underline">
|
|
34
|
+
Sair
|
|
35
|
+
</button>
|
|
36
|
+
</form>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{error && <p className="mb-4 text-sm text-red-600">{error}</p>}
|
|
40
|
+
|
|
41
|
+
{recoveryCodes && recoveryCodes.length > 0 && (
|
|
42
|
+
<div className="mb-6 rounded-lg border border-emerald-300 bg-emerald-50 p-4">
|
|
43
|
+
<p className="text-sm font-medium text-emerald-900">
|
|
44
|
+
Guarde seus códigos de recuperação — eles não serão mostrados de novo:
|
|
45
|
+
</p>
|
|
46
|
+
<ul className="mt-3 grid grid-cols-2 gap-2">
|
|
47
|
+
{recoveryCodes.map((rc) => (
|
|
48
|
+
<li key={rc}>
|
|
49
|
+
<code className="block rounded bg-white px-3 py-2 text-sm text-emerald-800 ring-1 ring-emerald-200">
|
|
50
|
+
{rc}
|
|
51
|
+
</code>
|
|
52
|
+
</li>
|
|
53
|
+
))}
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{enrolling ? (
|
|
59
|
+
<div className="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
60
|
+
<p className="text-sm text-gray-600">
|
|
61
|
+
Escaneie o QR code com seu app autenticador (Google Authenticator, 1Password, etc.).
|
|
62
|
+
</p>
|
|
63
|
+
{qrDataUrl && (
|
|
64
|
+
<img src={qrDataUrl} alt="QR code TOTP" className="mx-auto my-4 h-48 w-48" />
|
|
65
|
+
)}
|
|
66
|
+
{secret && (
|
|
67
|
+
<>
|
|
68
|
+
<p className="text-center text-xs text-gray-500">Ou informe manualmente:</p>
|
|
69
|
+
<code className="mx-auto mt-1 block w-fit break-all rounded bg-gray-100 px-3 py-2 text-sm text-gray-800">
|
|
70
|
+
{secret}
|
|
71
|
+
</code>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
<form method="POST" action="/account/mfa/confirm" className="mt-6">
|
|
75
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
76
|
+
<label htmlFor="code" className="mb-1 block text-sm font-medium text-gray-700">
|
|
77
|
+
Código de confirmação
|
|
78
|
+
</label>
|
|
79
|
+
<input
|
|
80
|
+
id="code"
|
|
81
|
+
name="code"
|
|
82
|
+
inputMode="numeric"
|
|
83
|
+
pattern="[0-9]*"
|
|
84
|
+
maxLength={6}
|
|
85
|
+
autoFocus
|
|
86
|
+
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-center text-lg tracking-[0.4em] outline-none focus:border-gray-900"
|
|
87
|
+
/>
|
|
88
|
+
<button
|
|
89
|
+
type="submit"
|
|
90
|
+
className="mt-4 w-full rounded-lg bg-gray-900 py-2.5 text-sm font-semibold text-white"
|
|
91
|
+
>
|
|
92
|
+
Ativar verificação em duas etapas
|
|
93
|
+
</button>
|
|
94
|
+
</form>
|
|
95
|
+
</div>
|
|
96
|
+
) : enabled ? (
|
|
97
|
+
<div className="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
98
|
+
<p className="text-sm text-gray-700">
|
|
99
|
+
A verificação em duas etapas está{' '}
|
|
100
|
+
<span className="font-semibold text-emerald-700">ativa</span> nesta conta.
|
|
101
|
+
</p>
|
|
102
|
+
<form method="POST" action="/account/mfa/disable" className="mt-4">
|
|
103
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
104
|
+
<button
|
|
105
|
+
type="submit"
|
|
106
|
+
className="rounded-lg border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50"
|
|
107
|
+
>
|
|
108
|
+
Desativar
|
|
109
|
+
</button>
|
|
110
|
+
</form>
|
|
111
|
+
</div>
|
|
112
|
+
) : (
|
|
113
|
+
<div className="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
114
|
+
<p className="text-sm text-gray-700">
|
|
115
|
+
A verificação em duas etapas está desativada. Ative-a para proteger sua conta com um app
|
|
116
|
+
autenticador.
|
|
117
|
+
</p>
|
|
118
|
+
<form method="POST" action="/account/mfa/enroll" className="mt-4">
|
|
119
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
120
|
+
<button
|
|
121
|
+
type="submit"
|
|
122
|
+
className="rounded-lg bg-gray-900 px-4 py-2 text-sm font-semibold text-white"
|
|
123
|
+
>
|
|
124
|
+
Ativar verificação em duas etapas
|
|
125
|
+
</button>
|
|
126
|
+
</form>
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('inertia/pages/authkit/account/tokens.tsx') })
|
|
3
|
+
}}}
|
|
4
|
+
interface TokenRow {
|
|
5
|
+
id: string
|
|
6
|
+
name: string
|
|
7
|
+
scopes: string[]
|
|
8
|
+
audience: string | null
|
|
9
|
+
lastUsedAt: string | null
|
|
10
|
+
createdAt: string
|
|
11
|
+
}
|
|
12
|
+
interface Props {
|
|
13
|
+
csrfToken: string
|
|
14
|
+
createdToken: string | null
|
|
15
|
+
tokens: TokenRow[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function AccountTokens({ csrfToken, createdToken, tokens }: Props) {
|
|
19
|
+
return (
|
|
20
|
+
<div className="min-h-screen bg-gray-100 p-4">
|
|
21
|
+
<div className="mx-auto max-w-2xl">
|
|
22
|
+
<div className="flex items-center justify-between py-6">
|
|
23
|
+
<div>
|
|
24
|
+
<div className="text-xs font-semibold uppercase tracking-[0.2em] text-gray-400">Acme</div>
|
|
25
|
+
<h1 className="text-xl font-semibold text-gray-900">Tokens de acesso</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<form method="POST" action="/account/logout">
|
|
28
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
29
|
+
<button type="submit" className="text-sm text-gray-500 hover:underline">
|
|
30
|
+
Sair
|
|
31
|
+
</button>
|
|
32
|
+
</form>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{createdToken && (
|
|
36
|
+
<div className="mb-6 rounded-lg border border-emerald-300 bg-emerald-50 p-4">
|
|
37
|
+
<p className="text-sm font-medium text-emerald-900">
|
|
38
|
+
Token criado — copie agora, não será mostrado de novo:
|
|
39
|
+
</p>
|
|
40
|
+
<code className="mt-2 block break-all rounded bg-white px-3 py-2 text-sm text-emerald-800 ring-1 ring-emerald-200">
|
|
41
|
+
{createdToken}
|
|
42
|
+
</code>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
|
|
46
|
+
<form
|
|
47
|
+
method="POST"
|
|
48
|
+
action="/account/tokens"
|
|
49
|
+
className="mb-6 flex gap-2 rounded-xl bg-white p-4 shadow-sm ring-1 ring-black/5"
|
|
50
|
+
>
|
|
51
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
52
|
+
<input
|
|
53
|
+
name="name"
|
|
54
|
+
placeholder="Nome do token (ex.: CI deploy)"
|
|
55
|
+
className="flex-1 rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none focus:border-gray-900"
|
|
56
|
+
/>
|
|
57
|
+
<button type="submit" className="rounded-lg bg-gray-900 px-4 text-sm font-semibold text-white">
|
|
58
|
+
Criar
|
|
59
|
+
</button>
|
|
60
|
+
</form>
|
|
61
|
+
|
|
62
|
+
<div className="overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-black/5">
|
|
63
|
+
{tokens.length === 0 ? (
|
|
64
|
+
<p className="p-6 text-sm text-gray-500">Nenhum token ainda.</p>
|
|
65
|
+
) : (
|
|
66
|
+
tokens.map((t) => (
|
|
67
|
+
<div key={t.id} className="flex items-center justify-between border-b border-gray-100 p-4 last:border-0">
|
|
68
|
+
<div>
|
|
69
|
+
<p className="text-sm font-medium text-gray-900">{t.name}</p>
|
|
70
|
+
<p className="text-xs text-gray-500">
|
|
71
|
+
Criado em {new Date(t.createdAt).toLocaleDateString('pt-BR')}
|
|
72
|
+
{t.lastUsedAt ? ` · último uso ${new Date(t.lastUsedAt).toLocaleDateString('pt-BR')}` : ' · nunca usado'}
|
|
73
|
+
</p>
|
|
74
|
+
</div>
|
|
75
|
+
<form method="POST" action={`/account/tokens/${t.id}/revoke`}>
|
|
76
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
77
|
+
<button type="submit" className="text-sm text-red-600 hover:underline">
|
|
78
|
+
Revogar
|
|
79
|
+
</button>
|
|
80
|
+
</form>
|
|
81
|
+
</div>
|
|
82
|
+
))
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('inertia/pages/authkit/consent.tsx') })
|
|
3
|
+
}}}
|
|
4
|
+
import AuthShell, { type AuthBrand } from '../../components/auth_shell'
|
|
5
|
+
|
|
6
|
+
export default function AuthkitConsent({
|
|
7
|
+
uid,
|
|
8
|
+
params,
|
|
9
|
+
csrfToken,
|
|
10
|
+
brand,
|
|
11
|
+
}: {
|
|
12
|
+
uid: string
|
|
13
|
+
params: { client_id: string }
|
|
14
|
+
csrfToken: string
|
|
15
|
+
brand?: AuthBrand
|
|
16
|
+
}) {
|
|
17
|
+
const accent = brand?.accent ?? '#111827'
|
|
18
|
+
const appName = brand?.appName ?? params.client_id
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<AuthShell brand={brand}>
|
|
22
|
+
<form method="POST" action={'/auth/interaction/' + uid + '/consent'}>
|
|
23
|
+
<input type="hidden" name="_csrf" value={csrfToken} />
|
|
24
|
+
<h1 className="text-xl font-semibold text-gray-900">Autorizar acesso</h1>
|
|
25
|
+
<p className="mt-2 text-sm text-gray-600">
|
|
26
|
+
O app <strong>{appName}</strong> quer acessar sua conta.
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
type="submit"
|
|
31
|
+
className="mt-6 w-full rounded-lg py-2.5 text-sm font-semibold text-white transition hover:opacity-90"
|
|
32
|
+
style={{ backgroundColor: accent }}
|
|
33
|
+
>
|
|
34
|
+
Autorizar
|
|
35
|
+
</button>
|
|
36
|
+
</form>
|
|
37
|
+
</AuthShell>
|
|
38
|
+
)
|
|
39
|
+
}
|