MCPcopy Create free account
hub / github.com/bricks-cloud/BricksLLM / getApiKey

Function getApiKey

internal/authenticator/authenticator.go:61–80  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

59}
60
61func getApiKey(req *http.Request) (string, error) {
62 list := []string{
63 req.Header.Get("x-api-key"),
64 req.Header.Get("api-key"),
65 }
66
67 split := strings.Split(req.Header.Get("Authorization"), " ")
68
69 if len(split) >= 2 {
70 list = append(list, split[1])
71 }
72
73 for _, key := range list {
74 if len(key) != 0 {
75 return key, nil
76 }
77 }
78
79 return "", internal_errors.NewAuthError("api key not found in header")
80}
81
82func rewriteHttpAuthHeader(req *http.Request, setting *provider.Setting) error {
83 uri := req.URL.RequestURI()

Callers 1

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected