apiKeyFromRequest returns the API key from the Authorization: Bearer header, or "" if absent. A non-Bearer Authorization header (e.g. Basic auth injected by a reverse proxy) is ignored.
(r *http.Request)
| 70 | // apiKeyFromRequest returns the API key from the Authorization: Bearer header, or "" if absent. |
| 71 | // A non-Bearer Authorization header (e.g. Basic auth injected by a reverse proxy) is ignored. |
| 72 | func apiKeyFromRequest(r *http.Request) string { |
| 73 | token, found := strings.CutPrefix(r.Header.Get("Authorization"), "Bearer ") |
| 74 | if !found { |
| 75 | return "" |
| 76 | } |
| 77 | return token |
| 78 | } |
| 79 | |
| 80 | // jwtFromCookie returns the session JWT from the auth cookie, or "" if absent |
| 81 | func jwtFromCookie(r *http.Request) string { |
no test coverage detected