MCPcopy Index your code
hub / github.com/mudler/LocalAI / GetAPIKey

Function GetAPIKey

core/http/auth/middleware.go:221–224  ·  view source on GitHub ↗

GetAPIKey returns the resolved API key from the echo context, or nil. Nil for session-cookie and legacy-env-key authentication.

(c echo.Context)

Source from the content-addressed store, hash-verified

219// GetAPIKey returns the resolved API key from the echo context, or nil.
220// Nil for session-cookie and legacy-env-key authentication.
221func GetAPIKey(c echo.Context) *UserAPIKey {
222 k, _ := c.Get(contextKeyAPIKey).(*UserAPIKey)
223 return k
224}
225
226// GetSource returns the request's authentication source: UsageSourceAPIKey,
227// UsageSourceWeb, UsageSourceLegacy, or empty if no authentication was performed.

Callers 2

UsageMiddlewareFunction · 0.92
middleware_test.goFile · 0.92

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected