Commit Graph
24 Commits
Author SHA1 Message Date
naibaandcloudcode 7b54a2d5ea feat(jwt): server-side session table with keyId + obfuscated uid claims
Replace the {user_id, ip} claim pair with {keyId, uid}:
- keyId is a 32-byte random id that points to a row in the new
  jwt_sessions table holding the real user id, bound IP, UA hash,
  TokenVersion and expiry.
- uid is the user id encoded through pkg/idcodec; mismatch between
  claim uid and session.UserID trips WAF block on the caller IP.
- identityHandler now rejects unknown/revoked/expired sessions, IP
  drift and stale TokenVersion. Refresh updates session.ExpiresAt.

User.TokenVersion bumps on password change and revokes outstanding
sessions, so a leaked JWT secret alone is no longer enough to forge
a token. JWTSession rows are GC'd every 10 minutes (expired + grace
or revoked >24h). OAuth2 callback shares the same issue path.

Includes regression tests for happy path, mismatched claim uid,
revoked session, TokenVersion bump, IP drift and unknown keyId.

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
2026-05-26 03:51:05 +00:00
naiba e816e94fca feat: server transfer rotation 2026-05-25 10:17:34 +00:00
UUBulb b6fed87d61 fix: member-created services shouldn't be applied to admin resources (#1113) 2025-08-28 22:37:44 +08:00
UUBulb 9ee5595da7 generate agent_secret for old users (#1021) 2025-03-08 18:47:42 +08:00
UUBulb 553f8e58d4 fix: oauth2 redirect url not consistent (#930)
* fix: oauth2 redirect url not consistent

* only use one redirect uri

* feat: allow to disable password authentication

* generate translation template

* update error

* redirect

* query
2024-12-31 22:29:29 +08:00
naiba 18020939da feat: 绑定 oauth2 2024-12-28 23:50:59 +08:00
naiba 4af7e83004 feat: list & block online users 2024-12-22 01:08:07 +08:00
UUBulb 653d0cf2e9 feat: user roles (#852)
* [WIP] feat: user roles

* update

* update

* admin handler

* update

* feat: user-specific connection secret

* simplify some logics

* cleanup

* update waf

* update user api error handling

* update waf api

* fix codeql

* update waf table

* fix several problems

* add pagination for waf api

* update permission checks

* switch to runtime check

* 1

* cover?

* some changes
2024-12-22 00:05:41 +08:00
UUBulb 885330e948 update profile api (#16)
* update profile api

* rename

* fix realip assertion

* add waf api
2024-11-23 16:22:22 +08:00
naiba 387da11f1b feat: create user, read users, batch delete users 2024-10-22 21:19:30 +08:00
naiba 53f1abb7c8 refactor: login & refresh token 2024-10-20 14:05:43 +08:00
naiba 9e6bbd3386 🎉 init swaggo 2024-10-19 23:14:53 +08:00
naiba 8ae885874b 🔒️ more secure token generation 2022-12-16 23:34:14 +08:00
ysicing b4a5dd550e feat(oauth2): add gitea oauth2 support
add gitea oauth2 support

Signed-off-by: ysicing <i@ysicing.me>
2022-10-12 19:34:15 +08:00
naiba e5c507f4e8 dashboard v0.13.20 Login with Gitlab、Jihulab 2022-05-26 20:00:20 +08:00
naiba 0a6658fcb4 🔖 dashboard v0.12.27 取消用户名unique,有些用户 gitee/github 用户名相同导致无法启动 2022-04-26 22:54:40 +08:00
naiba b5f33a6c5b ⬆️ dashboard v0.12.26 update gorm fields tags 2022-04-26 12:46:44 +08:00
naiba bb966b2c82 🗑 优化无效数据清理 2021-07-19 20:27:21 +08:00
naiba d7a3ba607b 🔊 v0.3.0 计划任务(定期备份等场景) 2021-01-19 09:59:04 +08:00
naiba a41c792577 💥 v2.0 必须更新面板,新增服务监控 2021-01-16 00:45:49 +08:00
naiba fcbd564bff up(notification): 添加修改删除通知、报警规则 2020-12-19 23:11:16 +08:00
naiba 22935a52de 修复 go mod 不兼容 2020-12-13 00:43:25 +08:00
奶爸 70f0e92343 持久化Token 2019-12-20 23:58:09 +08:00
奶爸 d8c4364653 Web 服务 2019-12-08 16:59:58 +08:00