diff --git a/server/canteen/internal/svc/servicecontext.go b/server/canteen/internal/svc/servicecontext.go index dcd1d889..9712cabb 100644 --- a/server/canteen/internal/svc/servicecontext.go +++ b/server/canteen/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/data-transfer/internal/svc/servicecontext.go b/server/data-transfer/internal/svc/servicecontext.go index 1a1a27a2..3236a65d 100644 --- a/server/data-transfer/internal/svc/servicecontext.go +++ b/server/data-transfer/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/map-library/internal/svc/servicecontext.go b/server/map-library/internal/svc/servicecontext.go index ccf526be..5ee6e83a 100644 --- a/server/map-library/internal/svc/servicecontext.go +++ b/server/map-library/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/orders/internal/svc/servicecontext.go b/server/orders/internal/svc/servicecontext.go index 99a7400a..61d8b459 100644 --- a/server/orders/internal/svc/servicecontext.go +++ b/server/orders/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/product-templatev2/internal/svc/servicecontext.go b/server/product-templatev2/internal/svc/servicecontext.go index b12e9921..635b8dce 100644 --- a/server/product-templatev2/internal/svc/servicecontext.go +++ b/server/product-templatev2/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/product/internal/svc/servicecontext.go b/server/product/internal/svc/servicecontext.go index b9157f3a..941adabc 100644 --- a/server/product/internal/svc/servicecontext.go +++ b/server/product/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) } diff --git a/server/shopping-cart-confirmation/internal/svc/servicecontext.go b/server/shopping-cart-confirmation/internal/svc/servicecontext.go index de8389d2..25e27c80 100644 --- a/server/shopping-cart-confirmation/internal/svc/servicecontext.go +++ b/server/shopping-cart-confirmation/internal/svc/servicecontext.go @@ -31,6 +31,9 @@ func NewServiceContext(c config.Config) *ServiceContext { func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) { AuthKey := r.Header.Get("Authorization") + if AuthKey == "" { + return nil, nil + } if len(AuthKey) <= 50 { return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey))) }