mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
9f8890d159
- Declared module Wavelet in backend/go.mod - Replaced github.com/Rain-kl/Wavelet/ with clean Wavelet/ import paths across backend codebase - Updated architecture guards, Makefile, swagger, and build tests - 100% passed all tests, lint checks, and binary compilation
40 lines
1000 B
Go
40 lines
1000 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package auth
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Session and Context Keys
|
|
const (
|
|
UserNameKey = "username"
|
|
UserIDKey = "user_id"
|
|
UserObjKey = "user_obj"
|
|
TokenAuthKey = "token_auth" // 标记当前请求是否通过 Access Token 鉴权
|
|
TokenAdminKey = "token_admin" // Access Token 本身是否具有管理员权限
|
|
SessionTokenKey = "oauth_session_token" //nolint:gosec // false positive: this is a session key, not hardcoded credentials
|
|
PasswordHashKey = "password_hash"
|
|
SystemUsername = "system"
|
|
)
|
|
|
|
// OAuth State Cache Keys and Expirations
|
|
const (
|
|
OAuthStateCacheKeyFormat = "oauth:state:%s"
|
|
OAuthStateCacheKeyExpiration = 10 * time.Minute
|
|
oauthStateLimitKeyFormat = "oauth:state:limit:%s"
|
|
oauthStateLimitMax = 10
|
|
)
|
|
|
|
// OAuth Purpose Constants
|
|
const (
|
|
OAuthPurposeLogin = "login"
|
|
OAuthPurposeBind = "bind"
|
|
)
|
|
|
|
// Auth Source Types
|
|
const (
|
|
AuthSourceTypeOIDC = "oidc"
|
|
)
|