Documentation
¶
Index ¶
Constants ¶
View Source
const (
// ContextKeyClaims is the gin context key for storing validated claims.
ContextKeyClaims = "ws_claims"
)
Variables ¶
This section is empty.
Functions ¶
func ExtractTokenFromQuery ¶
ExtractTokenFromQuery extracts a "token" query parameter from a URL.
func Middleware ¶
func Middleware(jwtSecret string, authRequired bool) gin.HandlerFunc
Middleware returns a Gin handler that validates JWT tokens for WebSocket upgrade requests. It checks the Authorization header first, then falls back to the "token" query parameter.
func ValidateOrigin ¶
ValidateOrigin checks if a request origin is in the allowed origins list. An empty allowlist permits all origins.
Types ¶
Click to show internal directories.
Click to hide internal directories.