middleware

package
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(token string) gin.HandlerFunc

用于系统数据操作相关鉴权

func AuthAnthropic

func AuthAnthropic(adminToken string) gin.HandlerFunc

用于Anthropic接口鉴权

两种携带方式都收,因为客户端有两种约定:

  • x-api-key:Anthropic 原生。Claude Code 读的是 ANTHROPIC_API_KEY;
  • Authorization: Bearer:Claude Code 读 ANTHROPIC_AUTH_TOKEN 时发的就是它(issue #38)。

两者都在时 **x-api-key 优先**。优先级写死才可预期:否则"哪个头生效"会随客户端 的实现细节漂移,而 401 现场看不出是哪一半出的问题。

func AuthGemini added in v0.6.7

func AuthGemini(adminToken string) gin.HandlerFunc

用于Gemini原生接口鉴权

func AuthOpenAI added in v0.6.0

func AuthOpenAI(adminToken string) gin.HandlerFunc

用于OpenAI接口鉴权

func Cors added in v0.6.25

func Cors() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL