Documentation
¶
Index ¶
Constants ¶
View Source
const ( LocalUser = "user" LocalToken = "token" )
Locals keys / locals key
Variables ¶
View Source
var NoAuth bool
NoAuth disables all auth checks when enabled (dangerous). NoAuth 在启用时会关闭所有鉴权(危险模式)。
Functions ¶
func AuthMiddleware ¶
AuthMiddleware verifies JWT and session status. AuthMiddleware 验证 JWT 与会话状态。
func RequireRoot ¶
RequireRoot checks root privilege. RequireRoot 检查 root 权限。
Types ¶
type ContextUser ¶
ContextUser is stored in Fiber locals. ContextUser 存在于 Fiber locals 中。
type TokenClaims ¶
type TokenClaims struct {
jwt.RegisteredClaims
// Username is duplicated for convenience.
// Username 为方便起见冗余保存。
Username string `json:"username"`
// IsRoot indicates super user.
// IsRoot 表示是否为超级用户。
IsRoot bool `json:"is_root"`
// TokenType: "web" or "api".
// TokenType:token 类型,"web" 或 "api"。
TokenType string `json:"typ"`
}
TokenClaims defines JWT claims used by gridbeat. TokenClaims 定义 gridbeat 使用的 JWT Claims。
Click to show internal directories.
Click to hide internal directories.