MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / stripBearerScheme

Function stripBearerScheme

internal/agent/api.go:647–653  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

645// when no Bearer scheme was used (lets the legacy unprefixed API-key
646// path continue to work).
647func 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.

Callers 2

authenticatePrincipalMethod · 0.85
authChallengeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected