Commit Graph

6 Commits (3913640f5b12f749011cf06ac7dc2e1d2346a19c)

Author SHA1 Message Date
veypi 3913640f5b feat(auth): replace user-level token version with session-based authentication
- Replace global user token version with per-session versioning in JWT claims
    - Add session CRUD operations with DB + Redis dual-write caching strategy
    - Create/list/revoke individual sessions and batch revoke other sessions
    - Update login flow to create sessions with device info and IP extraction
    - Update refresh flow to validate and rotate session-level token version
    - Update logout to revoke only the current session instead of all tokens
    - Add session management UI page with device/browser detection and relative time display
    - Add i18n keys for session management in both Chinese and English
    - Add sessions route and navigation menu items in both default and icon layouts
4 days ago
veypi 4c021e7e93 refactor(auth): Migrate token delivery to HttpOnly Cookie with version-based revocation
- Replace JWT in response body with HttpOnly Cookie (vb_access/vb_refresh) to prevent XSS token theft
    - Add Redis-based token version management with ±1 tolerance for multi-tab concurrent refresh
    - Implement strict refresh token rotation: version must match exactly, increment on each refresh
    - Simplify JWT Claims to only carry UserID + Type + Version, remove user profile fields
    - Remove session-based token tracking and cache blacklist in favor of version increment revocation
    - Remove getAuthHeaders, wrapAxios, wrapFetch, isExpired from frontend VBase client
    - Remove client-side token/localStorage management, frontend now relies on Cookie auto-attach
    - Add CookiePath config option and change default access token expiry from 24h to 15min
    - Update Vigo app initialization to use functional options pattern
    - Add empty-body cookie read fallback in refresh endpoint
3 weeks ago
veypi a7ffd15601 refactor: Remove multi-tenant org system and simplify auth
- Delete org API endpoints (add_member, create, del, get, list, member, patch, tree)
    - Delete models/org.go and remove Org/OrgMember models
    - Delete org-related test files (org_crud, org_load_middleware, org_permission, multi_tenant)
    - Delete org test scripts (03_org_permission.sh, 04_org_load_middleware.sh)
    - Simplify auth/auth.go by removing org context and role loading logic
    - Remove org claims from JWT tokens and login/register responses
    - Redesign Permission model with hierarchical level-based access control
    - Add auth/design.md with new permission system specification
    - Update user and role APIs to work without org context
4 months ago
veypi df0f7f047a refactor: Rename Config to Global and simplify app initialization
- Rename cfg.Config to cfg.Global for consistency
    - Simplify cli/main.go to use vbase.App.Run() pattern
    - Update init.go to create app with vigo.New and Init function
    - Update all references from cfg.Config to cfg.Global across api, libs, models, and tests
    - Fix VBase constructor parameter order in ui/vbase.js
    - Update ui/env.js to use new VBase('vb', '/') initialization
4 months ago
veypi 23c7f6cb7a refactor(auth): 重构认证系统,支持多种验证方式和 OAuth 提供商管理
- 新增验证模块(api/verification),统一处理短信和邮件验证码发送
    - 新增邮件发送功能(libs/email),支持 SMTP 协议
    - 重构短信模块(libs/sms),简化阿里云和腾讯云短信接口
    - 新增 OAuth 提供商管理 API(api/oauth/providers),支持 CRUD 操作
    - 新增系统设置管理 API(api/settings),支持动态配置更新
    - 重构认证方式管理(api/auth/methods),支持启用/禁用多种登录方式
    - 删除旧的 sms_providers 和 sms API 模块,迁移至新验证体系
    - 新增数据库模型:verification、email、oauth_provider、oauth_templates、setting
    - 更新配置文档,增加新功能的使用说明
4 months ago
veypi 52f2ae35ab upgrade new version 4 months ago