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