stripBearerScheme removes the "Bearer " prefix from an Authorization header value. RFC 6750 §2.1 specifies the scheme name as case- INSENSITIVE; a literal `TrimPrefix(h, "Bearer ")` would silently fail on `bearer ate2a_…` or `BEARER ate2a_…`. Returns the raw header value when no Bearer scheme was us
(h string)
| 645 | // when no Bearer scheme was used (lets the legacy unprefixed API-key |
| 646 | // path continue to work). |
| 647 | func stripBearerScheme(h string) string { |
| 648 | parts := strings.SplitN(h, " ", 2) |
| 649 | if len(parts) == 2 && strings.EqualFold(parts[0], "Bearer") { |
| 650 | return parts[1] |
| 651 | } |
| 652 | return h |
| 653 | } |
| 654 | |
| 655 | // authenticateUser extracts and validates the bearer credential from |
| 656 | // the request, returning the owning user. |
no outgoing calls
no test coverage detected