MCPcopy Create free account
hub / github.com/SMNETSTUDIO/Groq2API / Authorization

Function Authorization

middlewares/auth.go:9–25  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

7)
8
9func Authorization(c *gin.Context) {
10 if global.Authorization != "" {
11 authHeader := c.GetHeader("Authorization")
12 if authHeader == "" {
13 c.JSON(401, gin.H{"error": "Unauthorized"})
14 c.Abort()
15 return
16 }
17
18 if global.Authorization != strings.Replace(authHeader, "Bearer ", "", 1) {
19 c.JSON(401, gin.H{"error": "Unauthorized"})
20 c.Abort()
21 return
22 }
23 }
24 c.Next()
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected