mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-12 17:10:55 +00:00
Co-authored-by: bircni <bircni@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
22 lines
562 B
Go
22 lines
562 B
Go
// 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)
|
|
}
|