MCPcopy Index your code
hub / github.com/coder/coder / ExtractBearerToken

Function ExtractBearerToken

aibridge/utils/auth.go:6–14  ·  view source on GitHub ↗

ExtractBearerToken extracts the token from a "Bearer " authorization header.

(auth string)

Source from the content-addressed store, hash-verified

4
5// ExtractBearerToken extracts the token from a "Bearer <token>" authorization header.
6func ExtractBearerToken(auth string) string {
7 if auth := strings.TrimSpace(auth); auth != "" {
8 fields := strings.Fields(auth)
9 if len(fields) == 2 && strings.EqualFold(fields[0], "Bearer") {
10 return fields[1]
11 }
12 }
13 return ""
14}

Calls 1

FieldsMethod · 0.65