mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-17 05:52:13 +09:00
feat: Add audit logging (#38189)
Co-authored-by: bircni <bircni@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Copyright 2026 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"gitea.dev/modules/web/middleware"
|
||||
)
|
||||
|
||||
// Credential kinds naming how a request authenticated, recorded so an audit
|
||||
// event can point at the token rather than only at its owner.
|
||||
const (
|
||||
credentialAccessToken = "access-token"
|
||||
credentialOAuth2Grant = "oauth2-grant"
|
||||
)
|
||||
|
||||
func setAuthCredential(store DataStore, kind string, id int64) {
|
||||
store.GetData()[middleware.ContextDataKeyAuthCredential] = kind + ":" + strconv.FormatInt(id, 10)
|
||||
}
|
||||
Reference in New Issue
Block a user