From 220ccd9158771346dfbf60c293dd0e46596028e8 Mon Sep 17 00:00:00 2001 From: syniron <66834451+SyniRon@users.noreply.github.com> Date: Tue, 28 Apr 2026 18:10:21 -0400 Subject: [PATCH] fix: bearer prefix inconsistency --- proto/milpacs.proto | 2 +- servers/grpc/authentication.go | 5 +---- servers/server.go | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/proto/milpacs.proto b/proto/milpacs.proto index 9225ffe..c67843a 100644 --- a/proto/milpacs.proto +++ b/proto/milpacs.proto @@ -29,7 +29,7 @@ import "google/protobuf/empty.proto"; // These annotations are used when generating the OpenAPI file. option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { - version: "2.1.0"; + version: "2.1.1"; }; external_docs: { url: "https://github.com/7cav/api"; diff --git a/servers/grpc/authentication.go b/servers/grpc/authentication.go index fc63c78..5515681 100644 --- a/servers/grpc/authentication.go +++ b/servers/grpc/authentication.go @@ -44,10 +44,7 @@ func NewAuthInterceptor(ds datastores.Datastore) grpc.UnaryServerInterceptor { } raw := strings.TrimSpace(authHeaders[0]) - if !strings.HasPrefix(raw, "Bearer ") { - return nil, status.Errorf(codes.Unauthenticated, "missing authorization token") - } - token := strings.TrimSpace(raw[len("Bearer "):]) + token := strings.TrimSpace(strings.TrimPrefix(raw, "Bearer ")) if token == "" || len(token) > maxTokenLen { return nil, status.Errorf(codes.Unauthenticated, "missing authorization token") } diff --git a/servers/server.go b/servers/server.go index 7b8b1aa..0a2ea18 100644 --- a/servers/server.go +++ b/servers/server.go @@ -38,7 +38,7 @@ import ( "gorm.io/gorm" ) -const version = "2.1.0" +const version = "2.1.1" type MicroServer struct { addr string