MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / extractToken

Function extractToken

server-source-code/internal/middleware/auth.go:137–147  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

135}
136
137func extractToken(r *http.Request) (token, source string) {
138 if auth := r.Header.Get("Authorization"); auth != "" {
139 if strings.HasPrefix(auth, "Bearer ") {
140 return strings.TrimPrefix(auth, "Bearer "), "header"
141 }
142 }
143 if c, err := r.Cookie("token"); err == nil {
144 return c.Value, "cookie"
145 }
146 return "", ""
147}

Callers 2

AuthWithSessionCheckFunction · 0.85
OptionalAuthFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected