security: add BearerPrefix constant for Authorization headers (#10101)

Introduce security.BearerPrefix ("Bearer ", RFC 6750) and use it
everywhere an "Authorization: Bearer <token>" header is constructed,
replacing the scattered "BEARER "/"Bearer " string literals. SeaweedFS
matches the scheme case-insensitively when parsing (security.GetJwt), so
behavior is unchanged; this removes the magic string and settles the
casing on the standard form. The parser's upper-case comparison stays as
is on purpose.
This commit is contained in:
Chris Lu
2026-06-24 19:36:42 -07:00
committed by GitHub
parent 4d3e5d94a9
commit 95427b5573
17 changed files with 32 additions and 22 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ func (store *IamGrpcStore) withIamClient(ctx context.Context, fn func(ctx contex
if len(signingKey) > 0 {
token := security.GenJwtForFilerAdmin(signingKey, expiresAfterSec)
if token != "" {
ctx = metadata.AppendToOutgoingContext(ctx, "authorization", "Bearer "+string(token))
ctx = metadata.AppendToOutgoingContext(ctx, "authorization", security.BearerPrefix+string(token))
}
}