feat(audit): add authentication method tracking in audit logs
This commit is contained in:
@@ -68,9 +68,17 @@ func auditOperatorInfo(c *gin.Context) map[string]interface{} {
|
||||
"admin_id": c.GetInt("id"),
|
||||
"admin_username": c.GetString("username"),
|
||||
"admin_role": c.GetInt("role"),
|
||||
"auth_method": auditAuthMethod(c),
|
||||
}
|
||||
}
|
||||
|
||||
func auditAuthMethod(c *gin.Context) string {
|
||||
if c.GetBool("use_access_token") {
|
||||
return "access_token"
|
||||
}
|
||||
return "session"
|
||||
}
|
||||
|
||||
// markAuditLogged 标记当前请求已在 handler 内手动记录审计日志,
|
||||
// 使鉴权链路中的审计兜底(finishAdminAudit)跳过兜底记录,避免重复。
|
||||
func markAuditLogged(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user